log file size monitoring in Nagios for Windows OS

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
Uday Kumar
Posts: 32
Joined: Wed May 11, 2016 11:59 pm

log file size monitoring in Nagios for Windows OS

Post 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
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: log file size monitoring in Nagios for Windows OS

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