2
0
mirror of https://github.com/munin-monitoring/contrib.git synced 2018-11-08 00:59:34 +01:00

Merge pull request #1 from steveschnepp/patch-1

Port to /bin/sh
This commit is contained in:
varnav 2012-06-29 03:36:19 -07:00
commit afcf16bc8d

View File

@ -1,28 +1,26 @@
#!/usr/bin/php #! /bin/sh
<? # Munin plugin
# Gets number of active channels
# By Eugene Varnavsky
# Converted to /bin/sh by Steve Schnepp
# June 2012
# Version 1.0
#
# LGPL License
// Munin plugin if [ $1 = "autoconf" ]; then
// Gets number of active channels echo "yes"
// By Eugene Varnavsky exit 0
// June 2012 fi
// Version 1.0
//
// LGPL License
if (isset($argv[1]) && $argv[1] == "autoconf") { if [ $1 = "config" ]; then
echo "yes\n"; echo "graph_title Asterisk Channels"
exit(0); echo "graph_args --base 1000 -l 0"
} echo "graph_vlabel Channels"
if (isset($argv[1]) && $argv[1] == "config") { echo "graph_category asterisk"
echo "graph_title Asterisk Channels\n"; echo "channels.label Channels"
echo "graph_args --base 1000 -l 0\n"; exit 0
echo "graph_vlabel Channels\n"; fi
echo "graph_category asterisk\n";
echo "channels.label Channels\n";
exit (0);
}
$out = `asterisk -x "core show channels"`; asterisk -x "core show channels" | awk '/active channels/ { print "channels.value " $1 }'
preg_match('/(\d{1,4}) active channels/i', $out, $channels); exit 0
echo "channels.value $channels[1]\n";
?>