Alert if file exists

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
ronaldocr
Posts: 24
Joined: Wed Jun 05, 2019 8:31 am

Alert if file exists

Post by ronaldocr »

We are having issues where lot of core file are being generated and dumped in /var/core. I would like to know how can I set up alert so it alert whenever a core file exists in the /var/core. I see there is a check_file_age plugin it alerts if the file does not exist, I want to get an alert if file exists. Please let me.

Thanks in advance.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Alert if file exists

Post by lmiltchev »

You will be better off using the folder_watch.pl plugin that ships with Nagios XI. You could run something like this:

Code: Select all

/usr/local/nagios/libexec/folder_watch.pl  -D /var/core -F '[^\0]+' -C 'ls -lA' -r -w 0: -c 0 -f
You will get OK status from the plugin if the directory is empty, and will get CRITICAL if there is one or more files in it.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked