Page 1 of 2

File Count Monitoring using NRPE

Posted: Fri Nov 30, 2012 7:07 am
by MSPk
Hi,

We are trying to monitor the number of files in a directory on a remote windows server using the plugin from the below link. when I run the .exe file on widnows it works fine. Now i need to call it from nagios server. I have been going through some documentation and found that a command needs to added to the nrpe.cfg, does the below commad look fine or am i supposed to create it in a different way?

command[check_file_count]=\\ipaddress\test-file-count\check_winfile

https://www.itefix.no/i2/check_winfile

Please assist.

Re: File Count Monitoring using NRPE

Posted: Fri Nov 30, 2012 8:31 am
by scottwilkerson
What you need to do is install NSClient++ on the windows box if it isn't already
32bit
http://assets.nagios.com/downloads/nagi ... ble-32.msi
64bit
http://assets.nagios.com/downloads/nagi ... ble-64.msi

Enable NRPE

Place the check_winfile.exe in C:\Program Files\NSClient++\scripts

Then, add the following under [External Scripts] add your command, like

Code: Select all

check_file_count=scripts\check_winfile.exe -t C:\temp --filter "age ge -24 hours" --critical 0
Save
Restart NSClient++

Then from your XI server you should be able to call the command like

/usr/local/nagios/libexec/check_nrpe -H <IP_ADDRESS> -c check_file_count

Re: File Count Monitoring using NRPE

Posted: Fri Nov 30, 2012 8:46 am
by HAL
HI

Where can i find [External Scripts]

The client is already installed and NRPE is enabled

The addition at remote host side is not clear.

Re: File Count Monitoring using NRPE

Posted: Fri Nov 30, 2012 8:47 am
by scottwilkerson
Sorry I didn't add that, you add it to the nsc.ini in C:\Program Files\NSClient++

Re: File Count Monitoring using NRPE

Posted: Mon Dec 03, 2012 5:15 am
by MSPk
Hi,

Thanks for the reply....We are trying to monitor the file count in multiple directories on the same server. How do i modify the command to accept an argument - which will be the path of folder where the check has to be performed - rathere than creating multiple check commands in the nsc.ini file.

I have already set the allow aruments option to 1

Re: File Count Monitoring using NRPE

Posted: Mon Dec 03, 2012 11:29 am
by yancy
You can specify a list of values seperated by comma, or multiple --target commands

https://www.itefix.no/i2/check_winfile
--target file/directory[,file/directory]...]] [[--target ...] ... ]
This option specifies targets to check. A target can be a simple file or a recursive list of files in a directory. You can specify several comma separated targets for one --target option, as well as several --target options. At least one is required.
So for example to check both drive c: and c:\windows:

Code: Select all

 
check_winfile.exe --target "c:\windows","c:"
FILE OK - 58043 files to consider |'selected files'=58043;;; 'all files'=58043 '
deleted files'=0

Re: File Count Monitoring using NRPE

Posted: Tue Dec 04, 2012 5:10 am
by MSPk
that shows the combined count of all the files in the folders included in the target field....!! we need an ability set the threshold for each of the folder on a server.

Re: File Count Monitoring using NRPE

Posted: Tue Dec 04, 2012 2:27 pm
by slansing
Hi there,

We are trying to monitor the file count in multiple directories on the same server
It appears it is doing what you asked, could you add a little more detail to your most recent request? What exactly do you need returned to the Nagios server. Did you want it to tell you specifically how many files are in each directory separated out?

Re: File Count Monitoring using NRPE

Posted: Wed Dec 05, 2012 8:18 am
by MSPk
Yes,

From the pevious post where it says i can list multiple files using comma....I have tried that and the output returned to nagios is the sum of all the files from each of these folder combined.

My Original ques was if I could create a command using nrpe which takes the filepath on the remote folder as an argument, which can save me a lot of time rather than creating a command for each folder and keep it in NSC.ini file

Re: File Count Monitoring using NRPE

Posted: Wed Dec 05, 2012 12:42 pm
by sreinhardt
If you would like to separate each folder, you will need to create individual checks for each folder. The plugins intent is to combine all files\folders, on a per check basis.