Alert if new file is not created after x hours.

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
spiderpig82
Posts: 22
Joined: Wed Aug 27, 2014 7:29 am

Alert if new file is not created after x hours.

Post by spiderpig82 »

Hi,

i got an windows shared folder that i would like to monitor, if file in folder is not created in x hours i would like to get an warning.

any ideas?
jolson
Attack Rabbit
Posts: 2560
Joined: Thu Feb 12, 2015 12:40 pm

Re: Alert if new file is not created after x hours.

Post by jolson »

You may want to look at this plugin:
http://exchange.nagios.org/directory/Pl ... in/details

You could do something like:
cscript.exe //NoLogo check_files.vbs -p D:Logs -f "AgeCreated:>7*60*60*24" -f "RegEx:.*.log$" -w 5 -c 5
Count files in D:Logs, and look only for log (*.log) files that are
created at least 7 days ago, return CRITICAL if more than 5 was found.
If that does not work for you, I suggest taking a look at the following plugins to see if any of them might work: http://exchange.nagios.org/directory/Pl ... ile-System

The following may interest you:
share-file-check.sh
check_file_present
Twits Blog
Show me a man who lives alone and has a perpetually clean kitchen, and 8 times out of 9 I'll show you a man with detestable spiritual qualities.
spiderpig82
Posts: 22
Joined: Wed Aug 27, 2014 7:29 am

Re: Alert if new file is not created after x hours.

Post by spiderpig82 »

I tried this VBS script on the windows machine
http://exchange.nagios.org/directory/Pl ... le/details
and it works, but I'm not sure what I should do next or how i can add it to nagios.
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: Alert if new file is not created after x hours.

Post by jdalrymple »

Here is the ticket for you:

http://nsclient.org/nscp/wiki/guides/na ... al_scripts

nsclient documentation really does make it seem harder than it is. Basically you're going to:
  • install nsclient++
    copy your vbs to your scripts
    add a line to a section of your nsclient.ini:

Code: Select all

check_something=cscript.exe //T:30 //NoLogo scripts\check_something.vbs //someargument
  • add a Nagios service that runs the command

Code: Select all

check_nrpe -H mywindowshost -c check_something
That's a wildly simplified version, but should get you going.
Locked