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

29 lines
661 B
Plaintext
Raw Normal View History

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