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
checking a file existence using nrpe
Re: checking a file existence using nrpe
It'll probably be quicker to search: https://www.google.com/search?q=nagios+ ... 8&oe=utf-8
A few examples:
https://exchange.nagios.org/directory/P ... ts/details
http://stackoverflow.com/questions/2373 ... a-log-file
A few examples:
https://exchange.nagios.org/directory/P ... ts/details
http://stackoverflow.com/questions/2373 ... a-log-file
Re: checking a file existence using nrpe
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.
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
Re: checking a file existence using nrpe
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:
You can call these scripts remotely via check_nrpe. Let us know if you are having any more questions/issues.
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.0Code: 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)Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: checking a file existence using nrpe
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 ?
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
I made it
sorry little firewall issue ...thanks a lot again..
Re: checking a file existence using nrpe
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.
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