How to monitor file size

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
Frédéric GRANAT
Posts: 445
Joined: Mon Nov 19, 2012 11:36 am

How to monitor file size

Post by Frédéric GRANAT »

Hi,
I would like to monitor the size of a particular file, file located on a windows server.
By example :
If size != 0 : alert

In case of alert, I would like to send it to an email address.

Ideally I wouldn't like to install a component on my server (nrpe client,...etc)

What's the easiest way to perform that ?
User avatar
mbellerue
Posts: 1403
Joined: Fri Jul 12, 2019 11:10 am

Re: How to monitor file size

Post by mbellerue »

We have some plugins on the Exchange that check the file size of files on SMB shares, or FTP servers. Maybe one of these could be useful?
https://exchange.nagios.org/index.php?o ... ile%20size

Another option would be to create a passive check. This would be more work without an agent like NCPA on the system. But not impossible. You could create a Powershell script to query WMI for the file size, and report back via NRDP on the Nagios XI server. Here is a document that shows more information about NRDP.
https://assets.nagios.com/downloads/nag ... erview.pdf

Here is an example Powershell command for getting the size of a file.

Code: Select all

(Get-WmiObject -Class CIM_LogicalFile -Namespace "root\cimv2" -Property "FileSize" -Filter "Name = 'C:\\Monitoring\\ReadHere\\blah.txt'").FileSize
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked