From 6d8f1804dd208b47decdc1d9a8d5f6c278ec5921 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=F8rn=20Ruberg?= Date: Thu, 12 Oct 2006 14:50:06 +0200 Subject: [PATCH] Initial version --- plugins/other/cpuload_ | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100755 plugins/other/cpuload_ diff --git a/plugins/other/cpuload_ b/plugins/other/cpuload_ new file mode 100755 index 00000000..347a7a79 --- /dev/null +++ b/plugins/other/cpuload_ @@ -0,0 +1,29 @@ +#!/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 }'