Nrpe custom plugin
Posted: Fri Mar 10, 2017 8:26 pm
Hi All ,I have the following scenario:
Both Debian jessie
Monitoring server: 192.168.0.200
Client server: 192.168.0.100
Nagios and Nrpe works fine on both servers.Now , i want to monitor some values of iostat on the client server(.100), so i'm runnng the command
#iostat -xm 20 in the background to a file(iostat.txt). Then i have the following on the client server.
#command[check_iostat.php]=tail -100 /usr/lib/nagios/plugins/iostat.txt | tac | grep Device -B2000 -m1 | tac
This gives the following is the output of the command when run on command line.
# tail -100 /usr/lib/nagios/plugins/iostat.txt | tac | grep Device -B2000 -m1 | tac
Device: rrqm/s wrqm/s r/s w/s rMB/s wMB/s avgrq-sz avgqu-sz await r_await w_await svctm %util
sdc 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
sdb 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
sda 0.00 0.50 0.00 0.70 0.00 0.00 13.71 0.01 8.29 0.00 8.29 8.29 0.58
i only want the values for r/s,w/s,rMB/s,wMB/s,%util on the monitoring server,
i'm pulling the above output.My question is, on the monitoring server , can i create a php script to filter the values i want and present them on Nagios ?
Thank you .
Both Debian jessie
Monitoring server: 192.168.0.200
Client server: 192.168.0.100
Nagios and Nrpe works fine on both servers.Now , i want to monitor some values of iostat on the client server(.100), so i'm runnng the command
#iostat -xm 20 in the background to a file(iostat.txt). Then i have the following on the client server.
#command[check_iostat.php]=tail -100 /usr/lib/nagios/plugins/iostat.txt | tac | grep Device -B2000 -m1 | tac
This gives the following is the output of the command when run on command line.
# tail -100 /usr/lib/nagios/plugins/iostat.txt | tac | grep Device -B2000 -m1 | tac
Device: rrqm/s wrqm/s r/s w/s rMB/s wMB/s avgrq-sz avgqu-sz await r_await w_await svctm %util
sdc 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
sdb 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
sda 0.00 0.50 0.00 0.70 0.00 0.00 13.71 0.01 8.29 0.00 8.29 8.29 0.58
i only want the values for r/s,w/s,rMB/s,wMB/s,%util on the monitoring server,
i'm pulling the above output.My question is, on the monitoring server , can i create a php script to filter the values i want and present them on Nagios ?
Thank you .