Table of Contents
Check CPU
Script: check_cpu
It is a plugin to check cpu usage and cpu io wait. It reads cpu data from output of top command and shows
hwi - Time spent handling hardware interrupt routines. (Whenever a peripheral unit want attention form the CPU, it literally pulls a line, to signal the CPU to service it) swi - Time spent handling software interrupt routines. (a piece of code, calls an interrupt routineā¦) st - Time spent on involuntary waits by virtual cpu while hypervisor is servicing another processor (stolen from a virtual machine)
nice - Time spent running niced user processes (User defined priority) wait - Time spent on waiting on IO peripherals (eg. disk)
system - Time spent in kernel space user - Time spent in user space idle - Time spent in idle operations
For all values it sends performance data.
If there are processes with status D they will be shown (to analyze cpu waits).
Standalone installation
From this repository you need next to this script:
-
inc_pluginfunctions
shared function for all IML checks written in bash
Syntax
> check_cpu -h
______________________________________________________________________
CHECK_CPU
v1.16
(c) Institute for Medical Education - University of Bern
Licence: GNU GPL 3
https://os-docs.iml.unibe.ch/icinga-checks/Checks/check_cpu.html
______________________________________________________________________
check cpu usage and cpu wait
Cpu infos are taken from output of top command.
On higher cpu usage it can show processes that cause cpu waits and
with most cpu consumption.
SYNTAX:
check_cpu [-w WARN_LIMIT] [-c CRITICAL_LIMIT] [-i CRITICAL_IO_WAIT] [-p PROCESS_LIMIT]
OPTIONS:
-w VALUE cpu usage warning level (default: 75)
-c VALUE cpu usage critical level (default: 90)
-i VALUE io wait critical level (default: 50)
-p VALUE show process info with highest cpu consumption if
usage is > NN %; default: 50
-h or --help show this help.
PARAMETERS:
None.
EXAMPLE:
check_cpu -w 60 -c 80 -p 40
Examples
check_cpu -w 60 -c 80 -i 40
check cpu usage.
It shows a warning if usage is higer 60%.
It shows critical status if usage is higer 80% or io wait is 40%
./check_cpu -w 60 -c 80 -i 40
OK: CPU-USAGE [%] 11.3 ... user: 6.2 - system: 4.1 - idle: 88.7 - wait: 0.0
Limits: usage warn at 60 .. critical at 80 .. io wait limit 40
INFO : cpu is in normal ranges.
Legend:
hwi - Time spent handling hardware interrupt routines. (Whenever a peripheral unit want attention form the CPU, it literally pulls a line, to signal the CPU to service it)
swi - Time spent handling software interrupt routines. (a piece of code, calls an interrupt routine...)
st - Time spent on involuntary waits by virtual cpu while hypervisor is servicing another processor (stolen from a virtual machine)
nice - Time spent running niced user processes (User defined priority)
wait - Time spent on waiting on IO peripherals (eg. disk)
system - Time spent in kernel space
user - Time spent in user space
idle - Time spent in idle operations
|cpu-usage=11.3;60;80;0;100 cpu-wait=0.0;;40;0;100 cpu-system=4.1;;;0;100 cpu-user=6.2;;;0;100 cpu-idle=88.7;;;0;100 cpu-nice=0.0;;;0;100 cpu-hwi=0.5;;;0;100 cpu-swi=0.5;;;0;100 cpu-st=0.0