summaryrefslogtreecommitdiff
path: root/files/plugins/xen_memory
blob: 90bc7050427b4667e7d9f72eb3a500f63a4cba3f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/bin/sh
#
# Script to monitor memory status of the xen host
#
# Parameters understood:
#
#     config    (required)
#     autoconf  (optional - used by munin-config)
#

MAXDOMAINS=16

if [ "$1" = "autoconf" ]; then
        if which xm > /dev/null ; then
                echo yes
                exit 0
        fi
        echo "no (xm not found)"
        exit 1
fi

if [ "$1" = "config" ]; then

        echo 'graph_title Xen Memory'
        echo 'graph_args --base 1000 -l 0'
        echo 'graph_scale no'
        echo 'graph_vlabel MB'
        echo 'graph_category xen'
        echo 'graph_info This graph shows of many mS wall time where used by a domain'
                # xm info | while read name bla value; do echo "$name $value"; done
        /usr/sbin/xm info | while read name bla value; do
                                #total_memory 2047
                                #free_memory 1476
                name=`echo $name | sed -e"s/-/_/"`

                if [ "$name" = "total_memory" ]; then
                        echo "$name.label $name"
                        echo "$name.type GAUGE"
                        echo "$name.min 0"
                        echo "$name.info total memory"
                                fi
                if [ "$name" = "free_memory" ]; then
                        echo "$name.label $name"
                        echo "$name.type GAUGE"
                    echo "$name.draw AREA"
#                    echo "$name.draw STACK"
                        echo "$name.min 0"
                        echo "$name.info free memory"
                                fi
        done
        exit 0
fi

/usr/sbin/xm info | while read name bla value; do
        name=`echo $name | sed -e"s/-/_/"`
        if [ "$name" = "total_memory" ]; then
                echo "$name.value $value"
        fi
        if [ "$name" = "free_memory" ]; then
                echo "$name.value $value"
        fi
done