nsc command to count files in the directory

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
newbieatnagios
Posts: 1
Joined: Wed Mar 25, 2015 9:01 pm

nsc command to count files in the directory

Post by newbieatnagios »

Hi Expert,

I'm new in this tool, I would just want to ask if possible to monitor or count how many files in the specific directory ex. c:\nagios.

Thanks
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: nsc command to count files in the directory

Post by jdalrymple »

Here is a plugin that does what you want:

http://exchange.nagios.org/directory/Pl ... nt/details

It doesn't really relate to the NSC product, I'm not sure how that relates... but this plugin will do what you ask and report back to Nagios.
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: nsc command to count files in the directory

Post by Box293 »

NSClient++ includes this capability:

Check the amount of files in a folder (and sub-folders). Generate a warning if more that 500 files exist, critical if more than 1000 files exist.

NSClient++ 0.3.9

Code: Select all

Command:
check_nrpe -H 192.168.142.1 -t 30 -c CheckFiles -a path='C:\\NO BACKUP' pattern=*.* 'filter=size gt 0b' 'master-syntax={%total% Files Found}' MaxWarn=500 MaxCrit=1000

Output:
{12347 Files Found}, found files: 12347 > critical|'found files'=12347;500;1000
NSClient++ 0.4.1

Code: Select all

Command:
check_nrpe -H 192.168.142.1 -t 30 -c CheckFiles -a path='C:\\NO BACKUP' pattern=*.* 'master-syntax={%total% Files Found}' MaxWarn=500 MaxCrit=1000

Output:
{12347 Files Found}, found files: 12347 > critical|'found files'=12347;500;1000
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Locked