Mix server monitoring using Nagios
There is a Nagios plugin available to monitor a mix server. It is using the monitoring interface provided by the mix server itself and has to be activated in the mix server first. During the installation of the mix software the option "--enable-server_monitoring" has to be added. Additonally, while configuring the mix server in Step 2 the monitoring interface (i.e. the network interface and the port) has to be specified.
The Nagios plugin may be found in the mix source directory in the subdirectory misc/nagios or it can be downloaded from here. The script has to be saved within the Nagios plugin directory and must be made executable.
This script, check-mix-server, is written in Perl and is using the Nagios::Plugin and XML::Simple modules. These modules must be installed as well. If they are provided by the (Linux) distribution they may be installed by the packet manager. Using Debian/Ubuntu aptitude is doing all the things necessary:
> sudo aptitude install libxml-simple-perl libnagios-plugin-perl
As an alternative the required modules may be installed from the CPAN:
> sudo perl -MCPAN -e shell ... cpan> install XML::Simple cpan> install Nagios::Plugin cpan> quit
Calling the script/plugin check-mix-server is conforming to all requirements outlined in the guidelines for Nagios plugins. Information about available parameters can be obtained by executing the script with the options --help or, to get an abbreviated version, --usage.
> check-mix-server -? Usage: check-mix-server -H|--hostname <host> [-p|--port <port>] [ -v|--verbose ] [-t <timeout>] . -?, --usage Print usage information -h, --help Print detailed help screen -V, --version Print version information --extra-opts=[section][@file] Read options from an ini file. See http://nagiosplugins.org/extra-opts for usage -H, --hostname=HOST Hostname or IP address of the mix server (required) -p, --port=INTEGER Monitoring port of your mix server (default: 8080) -t, --timeout=INTEGER Seconds before plugin times out (default: 15) -v, --verbose Show details for command-line debugging (can repeat up to 3 times)
- --hostname | -H: This is a necessary parameter. The IP address or the hostname has to be specified.
- --port | -p: Port 8080 is used as the default monitoring port. If the mix configuration differs in this regard an other port may be declared using this parameter.
- --timeout | -t: The timeout has as a default value 15 sec but can be changed without problem using this parameter (e.g. down to 5 sec).
The plugin/script check-mix-server checks the state of the mix server and its respective cascade. If both are in the state OK the plugin returns OK as well. If there occurs a warning or a critical state during one of the tests the plugin is returning the error.
Example 1: If everything is working as it should:
> check-mix-server -H 22.214.171.124 MIXSERVER OK - mix is operating, first mix online
Example 2: If the mix server is not reachable the script/plugin returns the value "4" and the following error message:
> check-mix-server -H 126.96.36.199 MIXSERVER UNKNOWN - An error occured while trying to connect to mix.
Concerning the mix server the following states are distinguished:
|Mix is getting initialized||OK||0|
|Mix is working||OK||0|
|Mix is restarting||OK||0|
Regarding the cascade the following states are available:
|Mix is connected with predecessor/successor||OK||0|
|Mix is online (the cascade may be used)||OK||0|