Page 1 of 1

checking a file existence using nrpe

Posted: Tue Feb 02, 2016 11:19 am
by rmank
Hello ,

am a new bee to nagios ,can you help me to tell how can I check the existence of a file (eg /tmp/sql) etc via nrpe ?

And also is there a way to report alert (via nrpe again) if there are some keyword ,eg if there is something like 'error 'the return should be critical ,like that

thanks a lot a ton

Re: checking a file existence using nrpe

Posted: Tue Feb 02, 2016 1:25 pm
by gormank

Re: checking a file existence using nrpe

Posted: Tue Feb 02, 2016 4:20 pm
by tmcdonald
The links that @gormank have shared are a good place to start, but I do need to mention that Nagios Logserver is a better tool for the job:

https://www.nagios.com/products/nagios-log-server/

We built it specifically to solve this problem, and monitoring logs with it is going to be much simpler in the long run.

Re: checking a file existence using nrpe

Posted: Tue Feb 02, 2016 4:39 pm
by lmiltchev
rmank, you got help from 2 people already but I will post my reply anyway. :)
You can use the following two plugins:
https://github.com/pld-linux/monitoring ... _exists.sh
https://exchange.nagios.org/directory/P ... nt/details

Here's a couple of examples of plugins, run locally:

Code: Select all

./check_file_exists.sh /usr/local/nagios/var/nagios.log
OK: /usr/local/nagios/var/nagios.log EXISTS :: [1454392800] LOG ROTATION: DAILY
[1454392800] LOG VERSION: 2.0

Code: Select all

 ./check_file_content.pl -f /usr/local/nagios/etc/nagios.cfg -i "enable_notifications=0" -n 0
OK for /usr/local/nagios/etc/nagios.cfg (1 found)
You can call these scripts remotely via check_nrpe. Let us know if you are having any more questions/issues.

Re: checking a file existence using nrpe

Posted: Wed Feb 03, 2016 3:24 am
by rmank
thanks a lot all...
lmiltchev ..I tried locally it working well ,should I need to declare this a command for both the nrpe config ,on the nagios server and the clients ?

Re: checking a file existence using nrpe

Posted: Wed Feb 03, 2016 4:24 am
by rmank
I made it :) sorry little firewall issue ...thanks a lot again..

Re: checking a file existence using nrpe

Posted: Wed Feb 03, 2016 11:03 am
by rkennedy
No problem! Glad to see you made it past the firewall. :)

I'll close this out now, but feel free to open a new thread if you ever need assistance in the future.