Set your custom command on the client:
Code: Select all
# vi /usr/local/nagios/etc/nrpe.cfg
Add a command definition at the end of the file (for example):
Code: Select all
command[check_mount]=/usr/local/nagios/libexec/check_mount.sh $ARG1$
Note:
1. Make sure you have "check_mount.sh" coppied to "/usr/local/nagios/libexec" directory, and that the owner is root. Make it executable:
Code: Select all
# chmod +x /usr/local/nagios/libexec/check_mount.sh
2. You may have to change another line in "nrpe.cfg" like this:
3. Restart the daemon:
4. Test your plugin locally first - for example:
Code: Select all
# cd /usr/local/nagios/libexec
# ./check_mount.sh -p /boot -t ext3
Test your check from the Nagios server (from the command line):
# cd /usr/local/nagios/libexec
Code: Select all
# ./check_nrpe -H <target_machine_IP_address> -c check_mount -a '-p /boot -t ext3'
You should see something like this as an output:
Once you got it working from the command line, you can add the new service check in Nagios XI:
Go to: Core Config Manager->Monitoring->Services
Filter the results by config name and find your target machine.
Clone a service by clicking on the "Copy" Action button next to it. For example, you can "clone" the "/ Disk Usage" service.
Change the "Service description" to something that makes sense to you, for example, "check_boot".
Your "check command" should be
check_nrpe, $ARG1$ should be
check_mount and for $ARG2$ you can enter
-a '-p /boot -t ext3'
Click on "Save" and "Apply Configuration".
Schedule an immediate check - you should get:
check_mount.png