Page 1 of 1

Nagios check files count on Windows

PostPosted: Mon Jan 11, 2021 2:43 am
by jaysyu
Hi Guys.

does anyone know how to monitor the amount of files in a folder in windows?
In my nagios, I want to monitor how many files are in a windows server folder at a certain hour.
If in the specified time span, the files in the folder are below 16, then Nagios will send a notification.
I have nsclient installed on windows and use nrpe to monitor this. But I lack information about the commands or scripts used.

I found this article https://support.nagios.com/kb/article/f ... s-783.html
And the command is "./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' "

But, but I don't know exactly where to enter the command, in the Nagios command file or in the nsclient windows file?

Thank you

Re: Nagios check files count on Windows

PostPosted: Tue Jan 12, 2021 4:01 pm
by gormank
I usually just search the internet as shown...
https://www.google.com/search?rlz=1C1GC ... CA0&uact=5

If you want to use check_files you need to have it defined in nsclient.ini in Windows, and then define a service on the nagios server that uses check_nrpe.

Re: Nagios check files count on Windows

PostPosted: Mon Jan 18, 2021 10:23 pm
by mcapra
jaysyu wrote:But, but I don't know exactly where to enter the command, in the Nagios command file or in the nsclient windows file?


Which NSClient++ version are you running on the Windows machine?

check_files is a built-in NSClient++ plugin:
https://docs.nsclient.org/reference/windows/CheckDisk/

I'd suggest reviewing the "getting started" documentation:
https://assets.nagios.com/downloads/nag ... ndows.html

Which does everything with NCPA, which is very different from NSClient++, but the Nagios Core configurations are pretty comparable. If you're trying to monitor a machine using NSClient++, you'd need to change your service/command definitions to leverage the check_nrpe plugin instead of check_ncpa. But if you're totally new to Nagios Core in general, I'd suggest starting with NCPA as it's pretty well documented and has official support. Though it doesn't do everything NSClient++ does, it'll at least get you acquainted with some Nagios Core fundamentals.

Re: Nagios check files count on Windows

PostPosted: Sat Feb 06, 2021 7:02 am
by orgmf
jaysyu wrote:Hi Guys.

does anyone know how to monitor the amount of files in a folder in windows?
In my nagios, I want to monitor how many files are in a windows server folder at a certain hour.
If in the specified time span, the files in the folder are below 16, then Nagios will send a notification.
I have nsclient installed on windows and use nrpe to monitor this. But I lack information about the commands or scripts used.

I found this article https://support.nagios.com/kb/article/f ... s-783.html
And the command is "./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' "

But, but I don't know exactly where to enter the command, in the Nagios command file or in the nsclient windows file?

Thank you


You can use poweshell commands to do this...