Projet

Général

Profil

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

root / plugins / processes / proc_mem @ 4b400a73

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

1
#!/bin/sh
2
#
3
# (c) 2010, Rodrigo Sieiro <rsieiro@gmail.com>
4
# Based on the 'du_multidirs' plugin, written by Christian Kujau <lists@nerdbynature.de>
5
#
6
# Configure it by using the processes env var, i.e.:
7
#
8
# [proc_mem]
9
# env.processes         munin-node apache2
10
#
11

    
12
. $MUNIN_LIBDIR/plugins/plugin.sh
13

    
14
if [ "$1" = "autoconf" ]; then
15
        echo yes
16
        exit 0
17
fi
18

    
19
processes=${processes:="munin-node"}
20

    
21
if [ "$1" = "config" ]; then
22
        echo 'graph_title Memory usage by process'
23
        echo 'graph_args --base 1024 -l 0'
24
        echo 'graph_vlabel Bytes'
25
        echo 'graph_category memory'
26
        echo 'graph_info This graph shows the memory usage of several processes'
27

    
28
        for proc in $processes; do
29
                echo "$proc.label $proc"
30
        done
31

    
32
#       echo "$u".warning 0
33
#       echo "$u".critical 0
34

    
35
        exit 0
36
fi
37

    
38
for proc in $processes; do
39
        echo "$proc.value " `ps u -C $proc | awk 'BEGIN { sum = 0 } NR > 1 { sum += $6 }; END { print sum * 1024 }'`
40
done