Search Exchange
Search All Sites
Nagios Live Webinars
Let our experts show you how Nagios can help your organization.Login
Directory Tree
Check Files - Windows NRPE plugin
Meet The New Nagios Core Services Platform
Built on over 25 years of monitoring experience, the Nagios Core Services Platform provides insightful monitoring dashboards, time-saving monitoring wizards, and unmatched ease of use. Use it for free indefinitely.
Monitoring Made Magically Better
- Nagios Core on Overdrive
- Powerful Monitoring Dashboards
- Time-Saving Configuration Wizards
- Open Source Powered Monitoring On Steroids
- And So Much More!
Script Name : check_files.vbs
Usage Syntax : cscript.exe //NoLogo check_filecount.vbs -p [-r] [-f ] -w -c | -h
Author : Alex Simenduev, PlanetIT (http://www.planetit.ws)
Version : 2009.11.1
LastModified : 1/11/2009
Description : Counts the number of files in given directory and its
subdirectories, with optional filters applied. The output is
compatible with Nagios. Default Exit code is 3 (UNKNOWN)
Examples:
cscript.exe //NoLogo check_files.vbs -p C:WindowsTemp -w 100 -c 200
Count files in C:WindowsTemp, return WARNING if number of
files more than 100 and CRITICAL if more than 200.
cscript.exe //NoLogo check_files.vbs -p D:Files -f "Size:>1024*1024" -w 5 -c 20
Count files in D:Files, and look only for files that are bigger than 1MB,
return WARNING if number of files more than 5 and CRITICAL if more than 20.
cscript.exe //NoLogo check_files.vbs -p D:Logs -f "AgeCreated:>7*60*60*24" -f "RegEx:.*.log$" -w 5 -c 5
Count files in D:Logs, and look only for log (*.log) files that are
created at least 7 days ago, return CRITICAL if more than 5 was found.
cscript.exe //NoLogo check_files.vbs -p C:Windows -r -f "RegEx:.*.tmp$" -w 20 -c 50
Count files in C:Windows and its subdirectories, and look only for tmp (*.tmp) files,
return WARNING if number of files more than 20 and CRITICAL if more than 50 was found.
License:
- This script is supplied as-is without any support, I hope it works for you.
- You free to modify/distribute this script as you wish, but you must have the following line in the script:
Original author Alex Simenduev, PlanetIT (http://www.planetit.ws)
Change Log:
Legend:
[*] Informational, [!] Bugix, [+] Added, [-] Removed
Version 2009.11.1:
[!] More accurate argument parsing, will fix some small bugs.
[!] Fixed bug in RegEx filter if in pattern a ':' sign was specified.
[+] Added check for invalid filter type, script will exit with error printed.
[+] Added check for invalid filter value, script will exit with error printed.
[+] Added examples to the help screen.
[*] Recursive check is optional now, use '-r' option to turn it on.
Version 2009.10.29:
[!] More accurate check for the '--path' argument, added message.
Version 2009.10.28:
[*] Initial release.
Usage Syntax : cscript.exe //NoLogo check_filecount.vbs -p
Author : Alex Simenduev, PlanetIT (http://www.planetit.ws)
Version : 2009.11.1
LastModified : 1/11/2009
Description : Counts the number of files in given directory and its
subdirectories, with optional filters applied. The output is
compatible with Nagios. Default Exit code is 3 (UNKNOWN)
Examples:
cscript.exe //NoLogo check_files.vbs -p C:WindowsTemp -w 100 -c 200
Count files in C:WindowsTemp, return WARNING if number of
files more than 100 and CRITICAL if more than 200.
cscript.exe //NoLogo check_files.vbs -p D:Files -f "Size:>1024*1024" -w 5 -c 20
Count files in D:Files, and look only for files that are bigger than 1MB,
return WARNING if number of files more than 5 and CRITICAL if more than 20.
cscript.exe //NoLogo check_files.vbs -p D:Logs -f "AgeCreated:>7*60*60*24" -f "RegEx:.*.log$" -w 5 -c 5
Count files in D:Logs, and look only for log (*.log) files that are
created at least 7 days ago, return CRITICAL if more than 5 was found.
cscript.exe //NoLogo check_files.vbs -p C:Windows -r -f "RegEx:.*.tmp$" -w 20 -c 50
Count files in C:Windows and its subdirectories, and look only for tmp (*.tmp) files,
return WARNING if number of files more than 20 and CRITICAL if more than 50 was found.
License:
- This script is supplied as-is without any support, I hope it works for you.
- You free to modify/distribute this script as you wish, but you must have the following line in the script:
Original author Alex Simenduev, PlanetIT (http://www.planetit.ws)
Change Log:
Legend:
[*] Informational, [!] Bugix, [+] Added, [-] Removed
Version 2009.11.1:
[!] More accurate argument parsing, will fix some small bugs.
[!] Fixed bug in RegEx filter if in pattern a ':' sign was specified.
[+] Added check for invalid filter type, script will exit with error printed.
[+] Added check for invalid filter value, script will exit with error printed.
[+] Added examples to the help screen.
[*] Recursive check is optional now, use '-r' option to turn it on.
Version 2009.10.29:
[!] More accurate check for the '--path' argument, added message.
Version 2009.10.28:
[*] Initial release.