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

Directory Tree

check_windows_files.ps1

Rating
1 vote
Favoured:
0
Current Version
1.3
Last Release Date
2022-05-16
Compatible With
  • Nagios 4.x
  • Nagios XI
License
GPL
Hits
7567
Files:
FileDescription
check_windows_files.ps1check_windows_files.ps1
Nagios CSP

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!
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.

In 1.2, you now get performance data if you're checking either the number of files in a directory, or checking the size of a file. Thanks to Terminator81 over on GitHub for the suggestion!
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:MyCoolfile.txt. This site removes the extra slashes. You need two slashes for every slash.

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:MyCool

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