Projet

Général

Profil

Paste
Télécharger au format
Statistiques
| Branche: | Révision:

root / plugins / other / cpuload_ @ e908d2d2

Historique | Voir | Annoter | Télécharger (913 octets)

1
#!/bin/bash
2
#
3
# Munin-plugin to monitor the CPU usage for one or more given process name(s)
4
#
5
# Use the environment variable "process" to define more than one process
6
# name if required. Process names must be separated by comma, no whitespace.
7
#
8
# [cpuload_postfix]
9
# env.process master,qmgmr,proxymap,pickup
10
#
11
# GNU GPL, Bj?rn Ruberg
12

    
13
# Find process names from env variables for the given plugin
14
# If not, extract from filename.
15

    
16
test -n "$process" || process=`echo $0 | cut -d _ -f 2`
17

    
18
if [ "$1" = "config" ]; then
19
    echo "graph_title CPU load for $process"
20
    echo 'graph_category processes'
21
    echo "graph_info This graph shows the CPU load for $process, as reported by 'ps'"
22
    echo 'cpuload.label CPU load'
23
    echo "cpuload.info CPU load of $process"
24
    echo "cpuload.type GAUGE"
25
    exit 0
26
fi
27

    
28
echo -n "cpuload.value "
29
ps -C $process -o pcpu,comm --no-header | awk '{ sum += $1 } END { print sum }'