- void addAllowedServer(string server)
Add an allowed nagios server (all other server are not allowed to communicate with gnmond)
The allowed servers will be merged between all healthLogicFiles
- addCluster(name, initialHosts, refreshTime=1, checkWith=<module 'Plugins.Input.Gmond' from './Plugins/Input/Gmond.pyc'>)
- void addCluster(string name, list initialHosts,int refreshTime):
Adds a cluster whitch sould be controled by gnmond.
The name has to be unique and the same name as given in ganglia for this cluster
The list of initial hosts should consist of at least one node,
those are used as initial hosts.
Gnmond will try to get new metrics from this cluster every refreshTime minutes
To use another imput plugin than Gmond, you can give this plugin as checkWith.
It you want to use for example the plugin XX.py write in yout Health Plugin
import Plugins.Output.XX as XX
To get more infos about Input Plugins see README or /Plugins/Input/example.py.off
- addGroup(name, hosts)
- void addGroup(name,hosts):
Defines a gruop of hosts, that can be used to define health rules
The name has to be unique,
the hostslist has to consists the hostnames for all members of the group.
The hostnames has to be the same as used by ganglia (normaly not ip-addresses, therefore this is not allowed)
To aviod name clashed its a good idea to use the cluster name as prefix.
However, its possible to have nodes from different clusters in one group.
The groups will be stored for every health plugin independant
- addRecord(name, status, short, longer='', perf='')
- void addRecord(string name,int status,string short [,string longer] [,string perfData])
Defines a new record, that can be used for example by Nagios.
name as to be an unique string, and shound not begin with gnmond_
status has to be an integer out of NAGIOS_OK,NAGIOS_WARNING,NAGIOS_CRITICAL,NAGIOS_UNKNOWN (you will usualy use NAGIOS_OK)
short has to be a short message string. It is not allowed to consist
long can be additional messaged
perf us used for nagios performence data. If you want to use it, make shore that the string is correct formated.
For exmaple 'label'='actual''unit';'warning';'critical';'minimum';'maximum'; (unit is a string, everything else a numeric value
- Metrics getCluster(string name)
Get the metric for a cluster defined with addCluster
- Metrics getGroup(string name)
Get the metric f
or a group defined with addGroup
- Metrics getNode(string name)
Get the metric for a single node
- log(string, priority=7)
- void log(string string, int priority) or log(string string)
send log messages. Log is done to console or syslog (you can define this with setLogging).
You can set a priority to your log messages to prevent spaming the log.
You can use LOGGER_DEBUG, LOGGER_INFO, LOGGER_WARNING, LOGGER_CRITICAL.
Use LOGGER_DEBUG for debugging messages, LOGGER_INFO for status messgages.
You should not use LOGGER_WARNING or LOGGER_CRITICAL normally.
- void setExecutionTime(int time)
Set the time interval for whitch gnmond will execute the health logic plugin in minutes
This value will be stored for every health logic plugin independant
- setLogging(priority, console=False)
- void setLogging(int priority, bool console) or setLogging(int priority)
Configures the logging. Every message with an higher priority than 'priority' will be logged.
Priority can either be GnmondLogger.DEBUG, GnmondLogger.INFO, GnmondLogger.WARNING or GnmondLogger.CRITICAL
If console==true the logging output will be sent to the console, otherwise to syslog
To see all messaged (for example to debug, you should use setDebug, or call gmnond with the option --debug)
IMPORTANT: If you set console=true and gnmond is running as daemon, the log will be lost!
If you want to see the log on console, start gnmond with --nodaemon
- void setMaxEcecutionTime(int time)
Set the maximum running time in seconds for the health logic.
If the health logic takes more than this time, it might be crashed, and will be terminated
This values will be stored for every health logic plugin independant
- setRecord(name, status, short, longer='', perf='')
- void setRecord(string name,int status,string short [,int longer] [,string perfData])
Sets the status of an already defined record.
Input values have to be the same as for addRecord
If the record is set twice, it will use the higher record status