Search Exchange
Search All Sites
Nagios Live Webinars
Let our experts show you how Nagios can help your organization.Login
Directory Tree
check_cpu.py
1.0
- Nagios 3.x
- Nagios 4.x
GPL
56933
File | Description |
---|---|
check_cpu.py | Python script |
check_nrpe_cpu_check_cpu.php | pnp4nagios template file |
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!
Overall and per-core processor utilization monitoring with graphing in pnp4nagios
::Requisites::
Python 2.6 or newer
python-psutils library installed
::Usage::
./check_cpu.py -w/--warn -c/--crit
-w / --warn = int value for warning level (overall only)
-c / --crit = int value for critical level (overall only)
::Notes::
1 - Intended to better monitor per-core CPU utilization of modern multi-core processors.
2 - Single cpu core alert will only issue a WARNING as a single core saturation event typically only impacts the application that is causing the core saturation.
3 - Per core monitoring and alerting allows a Sys Admin to locate and resolve cpu resource issues that may not show in overall use or system load checks
4 - Works with pnp4nagios graphing and should create a graph for overall cpu use, and one for each cpu core for tracking historical data
5 - Has not been tested on Nagios systems without pnp4nagios but it should work fine
6 - Script will detect number of CPU cores, there should be no limit to number of cores. You will get a graph for overall and one for each core detected in pnp4nagios
::Usage::
Add the following line to your /etc/nagios/nrpe.cfg file near the other command entries. Be sure to confirm the path the cudacheck script.
command[check_cpu]=/usr/lib64/nagios/plugins/check_cpu.py -w 95 -c 99
To call the check_cpu.py script in Nagios with check_nrpe add the following service to the appropriate Nagios file
define service{
use linux-service,service-pnp
hosts list,of,comma,seperated,hostnames,goes,here
service_description CPU Utilization
servicegroups CPU
check_command check_nrpe!check_cpu
}
::SELinux::
If you have SELinux enabled you'll need to run chcon command to allow this script to be executed by the Nagios NRPE plugin. An example is included below. Be sure to confirm the path before issuing the command.
chcon -t nagios_unconfined_plugin_exec_t /usr/lib64/nagios/plugins/check_cpu.py
::pnp4nagios Template::
This template requires PHP 5.4 or newer, CentOS is still on PHP 5.3 as of this update. You can follow the webtatic repo upgrade process. I completed the upgrade to 5.6 without issue using it. (https://webtatic.com/packages/php56/)
A big thanks to George Hansper who wrote a php template for a check_cpu.py script of his own. I was able to trim and re-use his template and it works great.
::Requisites::
Python 2.6 or newer
python-psutils library installed
::Usage::
./check_cpu.py -w/--warn
-w / --warn = int value for warning level (overall only)
-c / --crit = int value for critical level (overall only)
::Notes::
1 - Intended to better monitor per-core CPU utilization of modern multi-core processors.
2 - Single cpu core alert will only issue a WARNING as a single core saturation event typically only impacts the application that is causing the core saturation.
3 - Per core monitoring and alerting allows a Sys Admin to locate and resolve cpu resource issues that may not show in overall use or system load checks
4 - Works with pnp4nagios graphing and should create a graph for overall cpu use, and one for each cpu core for tracking historical data
5 - Has not been tested on Nagios systems without pnp4nagios but it should work fine
6 - Script will detect number of CPU cores, there should be no limit to number of cores. You will get a graph for overall and one for each core detected in pnp4nagios
::Usage::
Add the following line to your /etc/nagios/nrpe.cfg file near the other command entries. Be sure to confirm the path the cudacheck script.
command[check_cpu]=/usr/lib64/nagios/plugins/check_cpu.py -w 95 -c 99
To call the check_cpu.py script in Nagios with check_nrpe add the following service to the appropriate Nagios file
define service{
use linux-service,service-pnp
hosts list,of,comma,seperated,hostnames,goes,here
service_description CPU Utilization
servicegroups CPU
check_command check_nrpe!check_cpu
}
::SELinux::
If you have SELinux enabled you'll need to run chcon command to allow this script to be executed by the Nagios NRPE plugin. An example is included below. Be sure to confirm the path before issuing the command.
chcon -t nagios_unconfined_plugin_exec_t /usr/lib64/nagios/plugins/check_cpu.py
::pnp4nagios Template::
This template requires PHP 5.4 or newer, CentOS is still on PHP 5.3 as of this update. You can follow the webtatic repo upgrade process. I completed the upgrade to 5.6 without issue using it. (https://webtatic.com/packages/php56/)
A big thanks to George Hansper who wrote a php template for a check_cpu.py script of his own. I was able to trim and re-use his template and it works great.
Reviews (0)
Be the first to review this listing!