2
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2018-11-08 00:59:34 +01:00
contrib-munin/plugins/cpu/cpuload_
dipohl e777037d06 Plugin-Gallery: Get better 2nd level headings
Review of category processes, system, snmp
2017-02-24 19:50:15 +01:00

29 lines
913 B
Bash
Executable file

#!/bin/bash
#
# Munin-plugin to monitor the CPU usage for one or more given process name(s)
#
# Use the environment variable "process" to define more than one process
# name if required. Process names must be separated by comma, no whitespace.
#
# [cpuload_postfix]
# env.process master,qmgmr,proxymap,pickup
#
# GNU GPL, Bjørn Ruberg
# Find process names from env variables for the given plugin
# If not, extract from filename.
test -n "$process" || process=`echo $0 | cut -d _ -f 2`
if [ "$1" = "config" ]; then
echo "graph_title CPU load for $process"
echo 'graph_category processes'
echo "graph_info This graph shows the CPU load for $process, as reported by 'ps'"
echo 'cpuload.label CPU load'
echo "cpuload.info CPU load of $process"
echo "cpuload.type GAUGE"
exit 0
fi
echo -n "cpuload.value "
ps -C $process -o pcpu,comm --no-header | awk '{ sum += $1 } END { print sum }'