Projet

Général

Profil

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

root / plugins / asterisk / asterisk_inuse @ 4df1c1a4

Historique | Voir | Annoter | Télécharger (1,29 ko)

1 85e8d320 spleen
#!/bin/sh
2
#
3
# add this into munin/plugin-conf.d/plugins.conf:
4
# 
5
# [asterisk_inuse]
6
# user root
7
#
8
9
if [ "$1" = "autoconf" ]; then
10
    if [ -x /usr/local/sbin/asterisk ]; then
11
        /usr/local/sbin/asterisk -rx 'sip show inuse' > /dev/null
12
        if [ $? = "0" ]; then
13
                echo yes
14
                exit 0
15
        else
16
                    echo no
17
                    exit 1
18
            fi
19
    else
20
        echo no
21
        exit 1
22
    fi
23
fi
24
25
if [ "$1" = "config" ]; then
26
        echo 'graph_title Line use'
27
        echo 'graph_args --base 1000 -l 0'
28
        echo 'graph_vlabel line use and connected users states'
29
	echo 'graph_noscale true'
30
	echo 'graph_info will be info'
31
        echo 'graph_category asterisk'
32
        echo 'inuse.label inuse'
33
        echo 'inuse.type GAUGE'
34
	echo 'inuse.info sip show inuse'
35
	echo 'connected.label connected'
36
        echo 'connected.type GAUGE'
37
        echo 'connected.info sip show peers'
38
	echo 'connected.warning 10:300'
39
	echo 'connected.critical 1:500'
40
        exit 0
41
fi
42
43
INUSE=`/usr/local/sbin/asterisk -rx 'sip show inuse' | grep -v "0/0" | grep -v " 0 " | grep -v " name" | wc -l`
44
CONN=`/usr/local/sbin/asterisk -rx 'sip show peers' | grep OK | wc -l`
45
46
if [ "$INUSE" -ge "1" ]; then
47
	echo "inuse.value"$INUSE
48
else
49
	echo "inuse.value 0"
50
fi
51
52
echo "connected.value"$CONN