2012-06-29 11:10:28 +02:00
|
|
|
#! /bin/sh
|
|
|
|
# Munin plugin
|
|
|
|
# Gets number of active channels
|
|
|
|
# By Eugene Varnavsky
|
|
|
|
# Converted to /bin/sh by Steve Schnepp
|
|
|
|
# June 2012
|
|
|
|
# Version 1.0
|
2018-08-02 02:03:42 +02:00
|
|
|
#
|
2012-06-29 16:22:23 +02:00
|
|
|
# Run as root or make sure munin user can run 'asterisk -r' command
|
|
|
|
#
|
|
|
|
# [asterisk_channels]
|
|
|
|
# user root
|
2012-06-29 11:10:28 +02:00
|
|
|
#
|
|
|
|
# LGPL License
|
2012-06-28 21:26:07 +02:00
|
|
|
|
2012-06-29 16:19:55 +02:00
|
|
|
if [ "$1" = "autoconf" ]; then
|
2012-06-29 16:22:23 +02:00
|
|
|
[ -z $(which asterisk) ] && echo "no" || echo "yes"
|
2012-06-29 11:10:28 +02:00
|
|
|
exit 0
|
|
|
|
fi
|
2012-06-28 21:26:07 +02:00
|
|
|
|
2012-06-29 16:19:55 +02:00
|
|
|
if [ "$1" = "config" ]; then
|
2012-06-29 11:10:28 +02:00
|
|
|
echo "graph_title Asterisk Channels"
|
|
|
|
echo "graph_args --base 1000 -l 0"
|
|
|
|
echo "graph_vlabel Channels"
|
2017-02-22 04:48:52 +01:00
|
|
|
echo "graph_category voip"
|
2012-06-29 11:10:28 +02:00
|
|
|
echo "channels.label Channels"
|
|
|
|
exit 0
|
|
|
|
fi
|
2012-06-28 21:26:07 +02:00
|
|
|
|
2012-12-19 11:09:50 +01:00
|
|
|
asterisk -rx "core show channels" | awk '/active channels/ { print "channels.value " $1 }'
|
2012-06-29 11:10:28 +02:00
|
|
|
exit 0
|