Page 1 of 1

log file size monitoring in Nagios for Windows OS

Posted: Thu Sep 08, 2016 4:01 am
by Uday Kumar
Hi Team,

Is it possible to monitor a log file size in windows for every five minutes.

Scenarios:

I have a log file which changes its size in frequent intervals.

If the file size remains same even after 3 checks with out changing its size, than an alert should be triggered.
If size changes , we should not want any alert.

Please help us with some checks for window OS

Re: log file size monitoring in Nagios for Windows OS

Posted: Thu Sep 08, 2016 10:23 am
by rkennedy
You should be able to write a plugin which would do this to be used with NSClient++, but it would take quite a bit of logic to have it do what you're after.

Using powershell you can get the size of the file with something like this -

Code: Select all

PS C:\Users\rkennedy> get-item 'C:\netstat.txt'


    Directory: C:\


Mode                LastWriteTime     Length Name
----                -------------     ------ ----
-a---         6/13/2016   3:44 PM      13416 netstat.txt
You would need to build the logic after that though, so that it counts 3 checks and sets the exit code accordingly for Nagios.