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

Nagios CPU mpstat Plugin New!

Rating
0 votes
Favoured:
0
Current Version
1.0
Last Release Date
2025-05-22
Compatible With
  • Nagios 3.x
  • Nagios 4.x
  • Nagios XI
Owner
License
GPL
Hits
82
Files:
FileDescription
check_cpu_mpstat.shMain Nagios plugin script to monitor CPU usage using mpstat with configurable thresholds.
LICENSEGNU GPL version 3 license governing the usage, modification, and distribution of the script.
README.txtBrief guide for installation, usage, and dependencies of the check_cpu_mpstat.sh plugin.
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!
Enhanced CPU Utilization Check using mpstat, with support for user/system/iowait thresholds. Based on the original check_cpu.sh script by Andreas Baess.
check_cpu_mpstat.sh is a Bash plugin for Nagios, Centreon, and other compatible monitoring platforms. It checks CPU usage statistics — specifically user, system, and iowait percentages — using the mpstat command from the sysstat package, which provides improved accuracy and multi-core compatibility over older tools like iostat and vmstat.

This script is based on the original check_cpu.sh plugin by Andreas Baess, but replaces vmstat with mpstat, adds robust argument parsing, per-category thresholds, and better compatibility with modern Linux systems.

???? Features
Uses mpstat for accurate CPU sampling, supporting multi-core systems

Configurable thresholds per category: user, system, iowait

Compatible with Nagios, Centreon, and other Nagios-style monitoring systems

Outputs performance data for graphing

Customizable sampling interval and number of samples

Returns standard Nagios exit codes (OK, WARNING, CRITICAL, UNKNOWN)

???? Requirements
mpstat (usually provided by the sysstat package)

Bash (tested with GNU Bash 4+)

?? Example Usage
./check_cpu_mpstat.sh -uw 70 -uc 90 -sw 60 -sc 85 -iw 40 -ic 60 -i 1 -n 1
???? Arguments
Flag Description
-uw Warning threshold for user CPU (%)
-uc Critical threshold for user CPU (%)
-sw Warning threshold for system CPU (%)
-sc Critical threshold for system CPU (%)
-iw Warning threshold for iowait CPU (%)
-ic Critical threshold for iowait CPU (%)
-i Interval between samples (seconds)
-n Number of samples to average
-h Help output

???? Example Output
CPU OK: user=12% system=5% iowait=1% idle=82% | cpu_user=12%;70;90; cpu_sy

???? Credits
Original idea and structure by Andreas Baess
Original plugin: check_cpu.sh