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_paging_file

Rating
0 votes
Favoured:
0
Current Version
2013-12-10
Last Release Date
2013-12-12
Compatible With
  • Nagios 3.x
  • Nagios XI
License
GPL
Hits
65670
Files:
FileDescription
check_paging_file.zipPlugin, pnp template and Read Me
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!
The purpose of this plugin is to check the Windows Paging File Size and Usage and return this information back to Nagios. The plugin can be run without any arguments, it will just return a service status of OK. Optionally you can trigger Warning or Critical states on the Paging File Size AND/OR Usage.
This plugin is designed to be run by NSClient++ on the host you want to check. It is not designed to allow you to check a remote host, this is why there is no option to specify the host name.

Paging File Size:
In relation to Virtual Machines and 64bit Operating Systems there is no need to have paging files that are 1.5 x VM Memory. This leads to wasted disk space, remember that paging to disk is bad, fix the problem by adding more memory to the VM.
The purpose of checking the paging file size is to ensure that standards are being applied across your environment.
You have two choices here, check to make sure the paging file is EXACTLY x size OR check to make sure the paging file does NOT EXCEED x size.

All values are in MEGABYTES.

You also MUST to define if you want the service state to be returned as CRITICAL or WARNING. Personally I use warning as I am using this size check for auditing purposes.

Examples:
Check Paging File EXACT Size of 3434 MB with a warning state:
cscript /nologo check_paging_file.vbs -check_size_exact 3434 -check_size_return_state warn

Check Paging File Size does NOT EXCEED 2456 MB with a critical state:
cscript /nologo check_paging_file.vbs -check_size_dont_exceed 2456 -check_size_return_state crit

Check Paging File Size does NOT EXCEED 1886 MB with a warning state:
cscript /nologo check_paging_file.vbs -check_size_dont_exceed 1886 -check_size_return_state warn


Paging File Usage:
Paging to disk affects performance. To page to disk means that extra CPU cycles and read/write operations need to occur. A simple fix is to add more memory to the computer to resolve the problem but how much memory do you need to add? Simply take the paging file usage that is occuring and add this amount of extra memory to the computer.
There is always a small amount of paging that occurs on a computer, this check can alert you once warning AND/OR critical thresholds have been exceeded. This check will tell you the amount of paging that is occurring in MEGABYTES.

Examples:
Check Paging File Usage, warning at 512 MB and critical at 1024 MB:
cscript /nologo check_paging_file.vbs -warn_usage 512 -crit_usage 1024

Check Paging File Usage, warning at 512 MB
cscript /nologo check_paging_file.vbs -warn_usage 512

Check Paging File Usage, critical at 1024 MB
cscript /nologo check_paging_file.vbs -crit_usage 1024


Performing both Paging File Size and Usage checks:
Check Paging File Size does NOT EXCEED 1886 MB with a warning state AND Check Paging File Usage, warning at 512 MB and critical at 1024 MB:
cscript /nologo check_paging_file.vbs -check_size_dont_exceed 1886 -check_size_return_state warn -warn_usage 512 -crit_usage 1024

Check Paging File EXACT Size of 3434 MB with a critical state AND Check Paging File Usage, warning at 512 MB:
cscript /nologo check_paging_file.vbs -check_size_exact 3434 -check_size_return_state crit -warn_usage 512


Configuring Nagios and NSClient++
Nagios:
The following shows you how to configure your Command AND Service definitions.
Command Definition:
define command {
command_name check_paging_file
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -t 30 -c check_paging_file -a '$ARG1$ $ARG2$ $ARG3$ $ARG4$ $ARG5$ $ARG6$ $ARG7$ $ARG8$'
}
NOTE: In the above command_line there are single quotes that start at $ARG1$ and end at $ARG8$.

Service Definition:
Check Paging File EXACT Size of 3434 MB with a critical state AND Check Paging File Usage, warning at 512 MB and critical at 1024 MB
define service {
host_name your_host
service_description Paging File Size and Usage
check_command check_paging_file!check_size_exact!3434!-check_size_return_state!crit!-warn_usage!512!-crit_usage!1024
max_check_attempts 3
check_interval 3
retry_interval 3
register 1
}

NSClient++
Version 0.3.x
Copy the plugin to the scripts directory.
Add the following to the [NRPE Handlers] section in NSC.ini:
check_paging_file=cscript.exe //T:30 //NoLogo scriptscheck_paging_file.vbs $ARG1$ $ARG2$ $ARG3$ $ARG4$ $ARG5$ $ARG6$ $ARG7$ $ARG8$

Nagios PNP Performance Graph Template
A custom pnp performance graph template has been provided, this generates two seperate performance graphs.
The file must be placed into the pnp/templates directory on your Nagios host. I have only tested this on Nagios XI and the default location on a Nagios XI host is /usr/local/nagios/share/pnp/templates.
NOTE: The name of the file MUST match the name of the Command Definition command_name. In the example above it is called check_paging_file and hence this is why the template is called check_paging_file.php.


License:
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

To see the license type:
cscript /nologo check_paging_file.vbs -license | more


Help:
To see the help type:
cscript /nologo check_paging_file.vbs -help | more


Version Notes:
2012-10-05 Initial release.

2012-10-10 Updated plugin performance data to include the name of the plugin as the ending string, pnp will see this and use the custom pnp template. This works if you are using this plugin as a passive check.

2013-12-10 Fixed bug when using both warn_usage and crit_usage at the same time, reported by Marcel Kalinna.