Nrpe custom plugin

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
simonx
Posts: 6
Joined: Fri Mar 10, 2017 7:53 pm

Nrpe custom plugin

Post by simonx »

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 .
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: Nrpe custom plugin

Post by mcapra »

simonx wrote:My question is, on the monitoring server , can i create a php script to filter the values i want and present them on Nagios ?
You certainly could, but I think it would be much better to have the plugin you are executing on the remote machine return the proper Nagios plugin outputs. Here's a link to the documentation for developing a Nagios plugin:
https://nagios-plugins.org/doc/guidelines.html
Former Nagios employee
https://www.mcapra.com/
simonx
Posts: 6
Joined: Fri Mar 10, 2017 7:53 pm

Re: Nrpe custom plugin

Post by simonx »

Thanks.

I have managed to put together the script.

My last question is on how do i do generic configs on the nagios server to cater for about 20 hosts, i'm avoiding doing configs on commands.cfg and services for each of the 20 hosts.

Thanks once again.
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: Nrpe custom plugin

Post by mcapra »

One way many users address large configuration sets is to group their hosts into a hostgroup. Then, if those hosts share common check (cpu, disk, memory, etc) you can assign those services to the hostgroup rather than individual hosts. Then, any hosts that are a part of that hostgroup would inherit those services. You could also use a host template to contain things like contacts, check times, check commands, etc.

More information:
https://assets.nagios.com/downloads/nag ... #hostgroup
https://assets.nagios.com/downloads/nag ... tance.html
Former Nagios employee
https://www.mcapra.com/
simonx
Posts: 6
Joined: Fri Mar 10, 2017 7:53 pm

Re: Nrpe custom plugin

Post by simonx »

i have managed to fix the issue.Thank you
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: Nrpe custom plugin

Post by cdienger »

Glad to hear you've been able to fix the issue. Is it okay to close the thread at this point or did you have any further questions?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
simonx
Posts: 6
Joined: Fri Mar 10, 2017 7:53 pm

Re: Nrpe custom plugin

Post by simonx »

Please close it , thank you
Locked