2011-01-07 14:12:51 +01:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# add this into munin/plugin-conf.d/plugins.conf:
|
2018-08-02 02:03:42 +02:00
|
|
|
#
|
2011-01-07 14:12:51 +01:00
|
|
|
# [asterisk_inuse]
|
|
|
|
# user root
|
|
|
|
#
|
|
|
|
|
|
|
|
if [ "$1" = "autoconf" ]; then
|
2013-06-23 16:14:18 +02:00
|
|
|
if [ which asterisk ]; then
|
|
|
|
asterisk -rx 'sip show inuse' > /dev/null
|
2011-01-07 14:12:51 +01:00
|
|
|
if [ $? = "0" ]; then
|
|
|
|
echo yes
|
|
|
|
else
|
|
|
|
echo no
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
echo no
|
|
|
|
fi
|
2018-09-16 04:01:57 +02:00
|
|
|
exit 0
|
2011-01-07 14:12:51 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$1" = "config" ]; then
|
|
|
|
echo 'graph_title Line use'
|
|
|
|
echo 'graph_args --base 1000 -l 0'
|
|
|
|
echo 'graph_vlabel line use and connected users states'
|
|
|
|
echo 'graph_noscale true'
|
|
|
|
echo 'graph_info will be info'
|
2017-02-22 04:48:52 +01:00
|
|
|
echo 'graph_category voip'
|
2011-01-07 14:12:51 +01:00
|
|
|
echo 'inuse.label inuse'
|
|
|
|
echo 'inuse.type GAUGE'
|
|
|
|
echo 'inuse.info sip show inuse'
|
|
|
|
echo 'connected.label connected'
|
|
|
|
echo 'connected.type GAUGE'
|
|
|
|
echo 'connected.info sip show peers'
|
|
|
|
echo 'connected.warning 10:300'
|
|
|
|
echo 'connected.critical 1:500'
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2013-06-23 16:14:18 +02:00
|
|
|
INUSE=`asterisk -rx 'sip show inuse' | grep -v "0/0" | grep -v " 0 " | grep -v " name" | wc -l`
|
|
|
|
CONN=`asterisk -rx 'sip show peers' | grep OK | wc -l`
|
2011-01-07 14:12:51 +01:00
|
|
|
|
|
|
|
if [ "$INUSE" -ge "1" ]; then
|
2013-06-23 16:14:18 +02:00
|
|
|
echo "inuse.value "$INUSE
|
2011-01-07 14:12:51 +01:00
|
|
|
else
|
|
|
|
echo "inuse.value 0"
|
|
|
|
fi
|
|
|
|
|
2013-06-23 16:14:18 +02:00
|
|
|
echo "connected.value "$CONN
|