checking a file existence using nrpe

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
rmank
Posts: 20
Joined: Tue Apr 14, 2015 6:35 am

checking a file existence using nrpe

Post 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
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: checking a file existence using nrpe

Post 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.
Former Nagios employee
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: checking a file existence using nrpe

Post 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.
Be sure to check out our Knowledgebase for helpful articles and solutions!
rmank
Posts: 20
Joined: Tue Apr 14, 2015 6:35 am

Re: checking a file existence using nrpe

Post 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 ?
rmank
Posts: 20
Joined: Tue Apr 14, 2015 6:35 am

Re: checking a file existence using nrpe

Post by rmank »

I made it :) sorry little firewall issue ...thanks a lot again..
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: checking a file existence using nrpe

Post 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.
Former Nagios Employee
Locked