Nagios check files count on Windows

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
jaysyu
Posts: 1
Joined: Mon Jan 11, 2021 1:29 am

Nagios check files count on Windows

Post 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
gormank
Posts: 1114
Joined: Tue Dec 02, 2014 12:00 pm

Re: Nagios check files count on Windows

Post 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.
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: Nagios check files count on Windows

Post 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.
Former Nagios employee
https://www.mcapra.com/
orgmf
Posts: 1
Joined: Sat Feb 06, 2021 6:44 am
Location: USA

Re: Nagios check files count on Windows

Post 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...
Locked