Nagios - Add-ons/Plugins

Plugins helps to monitor databases, operating systems, applications, network equipment, protocols with Nagios. Plugins are compiled executables or script (Perl or non-Perl) that extends Nagios functionality to monitor servers and hosts. Nagios will execute a Plugin to check the status of a service or host. Nagios can be compiled with support for an embedded Perl interpreter to execute Perl plugins. Without it, Nagios executes Perl and non-Perl plugins by forking and executing the plugins as an external command.
Nagios has the following plugins available in it −
Official Nagios Plugins − There are 50 official Nagios Plugins. Official Nagios plugins are developed and maintained by the official Nagios Plugins Team.
Community Plugins − There are over 3,000 third party Nagios plugins that have been developed by hundreds of Nagios community members.
Custom Plugins − You can also write your own Custom Plugins. There are certain guidelines that must be followed to write Custom Plugins.
While writing custom plugin in Nagios, you need to follow the guidelines given below −
Plugins should provide a "-V" command-line option (verify the configuration changes)
Print only one line of text
Print the diagnostic and only part of the help message
Network plugins use DEFAULT_SOCKET_TIMEOUT to timeout
"-v", or "--verbose“ is related to verbosity level
"-t" or "--timeout" (plugin timeout);
"-w" or "--warning" (warning threshold);
"-c" or "--critical" (critical threshold);
"-H" or "--hostname" (name of the host to check)
Multiple Nagios plugin run and perform checks at the same time, for all of them to run smoothly together, Nagios plugin follow a status code. The table given below tells the exit code status and its description −
Nagios plugins use options for their configuration. The following are few important parameters accepted by Nagios plugin −
-h, --help
This provides help
-V, --version
This prints the exact version of the plugin
-v, --verbose
This makes the plugin give a more detailed information on what it is doing
-t, --timeout
This provides the timeout (in seconds); after this time, the plugin will report CRITICAL status
-w, --warning
This provides the plugin-specific limits for the WARNING status
-c, --critical
This provides the plugin-specific limits for the CRITICAL status
-H, --hostname
This provides the hostname, IP address, or Unix socket to communicate with
-4, --use-ipv4
This lets you use IPv4 for network connectivity
-6, --use-ipv6
This lets you use IPv6 for network connectivity
-p, --port
This is used to connect to the TCP or UDP port
-s, -- send
This provides the string that will be sent to the server
-e, --expect
This provides the string that should be sent back from the server
-q, --quit
This provides the string to send to the server to close the connection
Nagios plugin package has lot of checks available for hosts and services to monitor the infrastructure. Let us try out Nagios plugins to perform few checks.
SMTP is a protocol that is used for sending emails. Nagios standard plugins have commands for perform checks for SMTP. The command definition for SMTP −
define command {
   command_name check_smtp
   command_line $USER2$/check_smtp -H $HOSTADDRESS$
}

Let us use Nagios plugin to monitor MySQL. Nagios offers 2 plugins to monitor MySQL. The first plugin checks if mysql connection is working or not, and the second plugin is used to calculate the time taken to run a SQL query.
The commands definitions for both are as follows −
define command {
   command_name check_mysql
   command_line $USER1$/check_mysql –H $HOSTADDRESS$ -u $ARG1$ -p $ARG2$ -d
   $ARG3$ -S –w 10 –c 30
}

define command {
   command_name check_mysql_query
   command_line $USER1$/check_mysql_query –H $HOSTADDRESS$ -u $ARG1$ -p $ARG2$ -d
   $ARG3$ -q $ARG4$ –w $ARG5$ -c $ARG6$
}

Note − Username, password, and database name are required as arguments in both the commands.
Nagios offers plugin to check the disk space mounted on all the partitions. The command definition is as follows
define command {
   command_name check_partition
   command_line $USER1$/check_disk –p $ARG1$ –w $ARG2$ -c $ARG3$
}

Majority of checks can be done through standard Nagios plugins. But there are applications which require special checks to monitor them, in which case you can use 3rd party Nagios plugins which will provide more sophisticated checks on the application. It is important to know about security and licensing issues when you are using a 3rd party plugin form Nagios exchange or downloading the plugin from another website.
 Print
 Add Notes
 Bookmark this page