Search Exchange
Search All Sites
Nagios Live Webinars
Let our experts show you how Nagios can help your organization.Login
Directory Tree
check_windows_files.ps1
1.3
2022-05-16
- Nagios 4.x
- Nagios XI
GPL
7569
File | Description |
---|---|
check_windows_files.ps1 | check_windows_files.ps1 |
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!
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.
-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.
Reviews (0)
Be the first to review this listing!