File Count Monitoring using NRPE

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
MSPk
Posts: 317
Joined: Fri Aug 24, 2012 12:03 am

File Count Monitoring using NRPE

Post 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.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: File Count Monitoring using NRPE

Post 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
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
HAL
Posts: 151
Joined: Thu Sep 27, 2012 7:57 am

Re: File Count Monitoring using NRPE

Post 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.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: File Count Monitoring using NRPE

Post by scottwilkerson »

Sorry I didn't add that, you add it to the nsc.ini in C:\Program Files\NSClient++
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
MSPk
Posts: 317
Joined: Fri Aug 24, 2012 12:03 am

Re: File Count Monitoring using NRPE

Post 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
yancy
Posts: 523
Joined: Thu Oct 06, 2011 10:12 am

Re: File Count Monitoring using NRPE

Post 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
MSPk
Posts: 317
Joined: Fri Aug 24, 2012 12:03 am

Re: File Count Monitoring using NRPE

Post 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.
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: File Count Monitoring using NRPE

Post 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?
MSPk
Posts: 317
Joined: Fri Aug 24, 2012 12:03 am

Re: File Count Monitoring using NRPE

Post 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
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: File Count Monitoring using NRPE

Post 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.
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
Locked