PlanetIT.WS - Beta

Welcome, Guest

Search: Advanced

Home » Monitoring » Nagios » Nagios plugin: Check Files - Windows NRPE plugin

Nagios plugin: Check Files - Windows NRPE plugin Print View

Article Stats:
Submitted by: alex
Date: 2010-04-09 00:05:11
Views: 1410
Rating: Not yet rated

Download (from my Google code project)

Script Name  : check_files.vbs
Usage Syntax : cscript.exe //NoLogo check_filecount.vbs
                 -p <path> [-r] [-f <filter>] -w <warn> -c <crit> | -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:\Windows\Temp -w 100 -c 200
  Count files in C:\Windows\Temp, 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.


Comments

No comments posted.

Add Comment



Enter the code shown:

Visual CAPTCHA