Monitoring File count using wmi/nrpe/command

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
linearstack
Posts: 26
Joined: Tue Nov 07, 2017 7:35 pm

Monitoring File count using wmi/nrpe/command

Post by linearstack »

Hi

I want to setup monitoring of file count in a particular folder using wmi/command/nrpe.
Can you please advise how can setup using command or plugin etc.

I tried this using check command "check_file_service".
I created a new command as:
$USER1$/folder_watch.pl -H $HOSTADDRESS -u $ARG1$ -p $ARG2$ -f $ARG3$ -D $ARG4$ $ARG5$

where Arguments are as:

ARG1 = 'username'
ARG2 = 'password'
ARG3 = files
ARG4 = C:\test (path of folder which we want to monitor files)
ARG5 = -F '[^\0] ' -w 5 -c 10

Can you please advise how to fix this or if there is any other way to achieve this?

Thanks
benjaminsmith
Posts: 5324
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

Re: Monitoring File count using wmi/nrpe/command

Post by benjaminsmith »

Hi,

Do you have NSClient installed on the remote Windows System? We have helpful examples on the following page.

See: File And Folder Checks

For NSLCIent, the check command would look like:

Code: Select all

./check_nrpe -H 10.25.14.2 -c check_files -a path='C:\\Temp' pattern=*.* 'warning=count>500' 'critical=count>1000' top-syntax='${status}: ${count} files found' 'empty-state=ok'
For the case of WMI, you can check the folder size, for example.

Code: Select all

./check_wmi_plus.pl -H 10.25.14.3 -u wmiagent -p Str0ngP@ssw0rd -m checkfoldersize -a C:/Temp
Let us know which approach you'd like to use and if you need assistance.

Benjamin
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!
linearstack
Posts: 26
Joined: Tue Nov 07, 2017 7:35 pm

Re: Monitoring File count using wmi/nrpe/command

Post by linearstack »

Thanks for replying.
We are actually monitoring it using WMI.
With WMI we want to set the monitoring of number of files in folder rather than folder size.
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Monitoring File count using wmi/nrpe/command

Post by ssax »

You should be able to do this which checks the count:

CRITICAL if count greater than 10:

Code: Select all

./check_wmi_plus.pl -H 10.25.14.3 -u wmiagent -p 'Str0ngP@ssw0rd' -m checkfoldersize -a C:/Temp -c _ItemCount=10
CRITICAL if count less than 10:

Code: Select all

./check_wmi_plus.pl -H 10.25.14.3 -u wmiagent -p 'Str0ngP@ssw0rd' -m checkfoldersize -a C:/Temp -c _ItemCount=10:
You can change 10 to whatever you'd like:

https://nagios-plugins.org/doc/guidelin ... HOLDFORMAT
Locked