Home Directory Plugins System Metrics File System check_windows_files.ps1

Search Exchange

Search All Sites

Nagios Live Webinars

Let our experts show you how Nagios can help your organization.

Contact Us

Phone: 1-888-NAGIOS-1
Email: sales@nagios.com

Login

Remember Me

check_windows_files.ps1

Rating
0 votes
Favoured:
0
Current Version
1.1
Last Release Date
2019-12-06
Compatible With
  • Nagios 4.x
  • Nagios XI
License
GPL
Hits
715
Files:
FileDescription
check_windows_files.ps1check_windows_files.ps1
Network Monitoring Software - Download Nagios XI
Log Management Software - Nagios Log Server - Download
Netflow Analysis Software - Nagios Network Analyzer - Download
Another plugin to check files in Windows. Meant to be run via an agent like NCPA. Check if a file exists, check the size of a file, check the number of files in a directory.
Nothing terribly special here. Just a 3-in-1 Powershell plugin to check if a file exists, the size of a file, or the number of files in a directory. Let's take a look at the switches.

-checkPath
Required. This is the path you will use for your check. If you are checking that a file exists, or checking the size of a file, this should point directly to a file. E.g. C:My\Cool\file.txt

Which brings up the second point. I have not validated the path yet, so make sure you use two backslashes. This is required for the CIM queries.

-exists
Not required. This is a switch, so just invoking it will get the script started down the path of verifying whether a file exists or not.

-shouldnotexist
Not required. Another switch, one to be used with -exists. Use this switch if you are checking to see if a file exists, and you want to be alerted that it does exist.

-size
Not required. This is a switch, and sets the script down the path of checking a file's size, reported in bytes.

-sizewarning
Not required, integer. The number provided here sets the warning threshold, in bytes.

-sizecritical
Not required, integer. The number provided here sets the critical threshold, in bytes.

-number
Not required, switch. Sets the script down the path of monitoring the number of files in a directory. For this, your -checkPath should end in a directory without trailing slashes. E.g. -checkPath C:\My\Cool

-numwarning
Not required, integer. The number provided here sets the warning threshold for number of files in the specified directory.

-numcritical
Not required, integer. The number provided here sets the critical threshold for the number of files in the specified directory.