1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-21 18:41:03 +00:00

- have some dirs

This commit is contained in:
Steve Schnepp 2012-02-13 18:24:46 +01:00
parent 0b089ea777
commit 08346aac58
687 changed files with 0 additions and 0 deletions

230
plugins/voip/murmur_ice_users Executable file
View file

@ -0,0 +1,230 @@
#!/usr/bin/php
<?php
/**
** =head1 NAME
**
** murmur_ice_users
**
** =head1 DESCRIPTION
**
** This plugin monitors users on a Mumble server (a.k.a. murmur).
** It uses PHP and ICE to to query murmur. On debian, you can install mumble-server-web
** to get the dependencies installed and set up.
**
**
** =head1 CONFIGURATION
**
** You can specify a different ip:port in the munin-node config file as follow:
**
** [murmur_ice_users]
** env.host 127.0.0.1
** env.port 6502
** env.IceProfile xxxxx
** env.IceSecret xxxxx
**
** =head1 AUTHOR
**
** Original Author Thomas L<>veil
** Modification by DisasteR - 2011/04/19
**
** =head1 LICENSE
**
** Permission to use, copy, and modify this software with or without fee
** is hereby granted, provided that this entire notice is included in
** all source code copies of any software which is or includes a copy or
** modification of this software.
**
** THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR
** IMPLIED WARRANTY. IN PARTICULAR, NONE OF THE AUTHORS MAKES ANY
** REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE
** MERCHANTABILITY OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR
** PURPOSE.
**
**
** =head1 MAGIC MARKERS
**
** #%# family=contrib
** #%# capabilities=autoconf
**
**
** =head1 VERSION
**
** 1.2
**
** =head1 CHANGELOG
**
** =head2 1.0 - 2009/05/04
**
** initial release
**
** =head2 1.1 - 2011/01/13
**
** fix to make it work with murmur v1.2.2
**
** =head3 1.2 - 2011/04/19
**
** Code cleaning and refactoring
** Stats for root server and Virtual Servers
**
** =cut
*/
$host = "127.0.0.1";
$port = "6502";
$IceProfile = 'Murmur123';
$IceSecret = array( 'secret' => 'mumble42' );
if (isset($_ENV['host'])) $host = $_ENV['host'];
if (isset($_ENV['port'])) $port = $_ENV['port'];
if (isset($_ENV['IceProfile'])) $IceProfile = $_ENV['IceProfile'];
if (isset($_ENV['IceScret'])) $IceSecret = array( 'secret' => $_ENV['IceScret'] );
if (count($argv)==1) {
do_count();
}
switch ($argv[1])
{
case 'autoconf':
do_autoconf();
break;
case 'config':
do_config();
break;
default:
do_count();
break;
}
exit(1);
function IceConnect()
{
global $ICE, $host, $port, $IceProfile, $IceSecret;
try
{
Ice_loadProfile($IceProfile);
$iceproxy = $ICE->stringToProxy("Meta:tcp -h $host -p $port");
$metaServer = $iceproxy->ice_checkedCast("::Murmur::Meta")->ice_context($IceSecret);
}
catch (Exception $e)
{
fwrite(STDERR, $e."\n");
exit(1);
}
return $metaServer;
}
function do_autoconf()
{
$metaServer = null;
$metaServer = IceConnect();
if ($metaServer != null)
{
fwrite(STDOUT, "yes\n");
exit(0);
}
fwrite(STDOUT, "no\n");
exit(1);
}
function do_config_header()
{
fwrite(STDOUT, "graph_title Mumble Users\n");
fwrite(STDOUT, "graph_vlabel Connected Users\n");
fwrite(STDOUT, "graph_category VoIP\n");
fwrite(STDOUT, "graph_info This graph shows the number of connected users on a murmur server\n");
fwrite(STDOUT, "total_maxusers.label Maximum allowed users\n");
fwrite(STDOUT, "total_maxusers.type GAUGE\n");
fwrite(STDOUT, "total_online.label Connected users\n");
fwrite(STDOUT, "total_online.type GAUGE\n");
}
function do_config_data()
{
global $ICE, $IceSecret;
try
{
$metaServer = IceConnect();
$AdefaultConf = $metaServer->getDefaultConf();
$AvirtualServer = $metaServer->getAllServers();
foreach ($AvirtualServer as $numserver=>$s)
{
$serverid = $s->ice_context($IceSecret)->id();
$servename = $s->ice_context($IceSecret)->getConf( 'registername');
$servename = preg_replace('/[^a-zA-Z0-9-#\$%&@\.+=§\/\\\]/', ' ', $servename);
$servename = trim(preg_replace('/\s+/', ' ', $servename));
fwrite(STDOUT, "vserver_".$serverid."_maxusers.label ".$servename." Max users\n");
fwrite(STDOUT, "vserver_".$serverid."_maxusers.type GAUGE\n");
fwrite(STDOUT, "vserver_".$serverid."_online.label ".$servename." Connected users\n");
fwrite(STDOUT, "vserver_".$serverid."_online.type GAUGE\n");
}
exit(0);
}
catch (Exception $e)
{
fwrite(STDERR, $e."\n");
exit(1);
}
}
function do_config()
{
do_config_header();
do_config_data();
exit(0);
}
function do_count()
{
global $ICE, $IceSecret;
$totalMaxUsers="0";
$totalConnectedUsers="0";
try
{
$metaServer = IceConnect();
$AdefaultConf = $metaServer->getDefaultConf();
$AvirtualServer = $metaServer->getAllServers();
foreach ($AvirtualServer as $numserver=>$s)
{
$maxusers = $s->ice_context($IceSecret)->getConf( 'users' );
if (!$maxusers) $maxusers = $AdefaultConf['users'];
$totalMaxUsers += intval($maxusers);
if ($s->ice_context( $IceSecret )->isRunning())
{
$connectedUsers = count($s->ice_context($IceSecret)->getUsers());
$totalConnectedUsers += intval($connectedUsers);
}
else
$connectedUsers = 0;
$serverid = $s->ice_context($IceSecret)->id();
fwrite(STDOUT, "vserver_".$serverid."_maxusers.value ".$maxusers."\n");
fwrite(STDOUT, "vserver_".$serverid."_online.value ".$connectedUsers."\n");
}
fwrite(STDOUT, "total_maxusers.value ".$totalMaxUsers."\n");
fwrite(STDOUT, "total_online.value ".$totalConnectedUsers."\n");
exit(0);
}
catch (Exception $e)
{
fwrite(STDERR, $e."\n");
exit(1);
}
}
?>

150
plugins/voip/murmur_users Executable file
View file

@ -0,0 +1,150 @@
#!/usr/bin/php
<?php
error_reporting( E_ALL &!E_NOTICE); //to avoid of the crap generation
/*///////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////
Murmur users online grahpher
ver 0.2alpha 2008.12.02, 20:32
author _KaszpiR_ kaszpir at gmail dot com
code is under GPL
Requirements:
- PHP installed in CLI (so you can run it in command line)
Make sure the first line of this file points to the working php cli interpreter
- Murmur logfile readable by the munin user/group
Notice:
- script allows the usage of the 'config' and 'autoconf' parameters during startup, make fure you edt config section before running it
- $limit - number of lines to tail from the lgo file, better keep it below 5000 for lower cpu load,
aditionally on busy servers you can keep it really low, suggested 3x maximum number of users online
- tested on
PHP 5.2.6-3 with Suhosin-Patch 0.9.6.2 (cli) (built: Aug 21 2008 17:02:32)
murmur 1.1.4 precompiled binaries from sourceforge net, all running under debian etch
- this is not the best way to get users connected to the murmur server, maybe in the beginnign of the 2009 gonna make another script
Known issues and limitations:
- counts all users on the server not respecting different server instances
- if limit of 5000 log entries can sometimes be not enough on busy servers
- can returrn wrong number of users due to the simple user tracking (by nick, should be more advanced but I'm too lazy,)
usually error is fixed after player performs any action on server like join/part channel or mute/unmute etc
Todo:
- get server id for parsing
- get logs from MySQL
- use DBUS or ICE instead of plain log file
///////////////////////////////////////////////////////////////////////////////////////////////////*/
/////////////////////////////////////////////////////////////////////////////////////////////////////
//configuration
$limit=5000; //numbers of lines to process from log file
$logfile="/home/kaszpir/murmur/murmur.log"; // path to the murmur log file
//end of configuration
/////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////
//autoconf test
if(isset($argv[1]) && $argv[1] == "autoconf")
{
if(is_readable($logfile))
{
fwrite(STDOUT, "Yes\n");
}
else
{
fwrite(STDOUT, "No\n");
fwrite(STDERR, "check if '$logfile' exists and it is allowed to be read by munin user group\n");
}
return 0;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////
//config, set rrd files
if(isset($argv[1]) && $argv[1] == "config")
{
if(is_readable($logfile))
{
fwrite(STDOUT, "graph_title Mumble Users\n");
fwrite(STDOUT, "graph_vlabel Connected Users\n");
fwrite(STDOUT, "graph_category VoIP\n");
fwrite(STDOUT, "graph_info This graph shows the number of connected users on a murmur server\n");
fwrite(STDOUT, "murmur.label Users on server\n");
fwrite(STDOUT, "murmur.type GAUGE\n");
return 0;
}else {
echo "check if '$logfile' exists and it is allowed to be read by munin user group\n";
return 1;
}
return 0;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////
// do the magic
if(!$limit || ($limit >=5000 ) || $limit <= 0) $limit = 5000;
$out = shell_exec("tail -n ".$limit." \"".$logfile."\"");
$fp = split("\n",$out);
if(!count(@$fp)) {
fwrite(STDOUT, "0\n");
return 1;
}
//var_dump($fp);
$online=0;
$offline=0;
$seen = array();
for($i=count($fp);$i>(count($fp)-$limit);--$i)
{
$l = trim($fp[$i]);
if(!$l) continue;
list(
$crap,
$w,
$date,
$time,
$serverid,
$id,
$nick,
$id2,
$msg,
) = preg_split("/<(.*)>(.*) (.*) ([0-9]) => <(.*)\:(.*)\((.*)\)>(.*)/",$fp[$i],-1,PREG_SPLIT_DELIM_CAPTURE);
if(!strlen(trim($nick))) continue;
if(!array_key_exists($nick,$seen)){
if(
strpos($msg," Connection closed")!==FALSE
|| strpos($msg," Tiemout")!==FALSE
){
$seen[$nick]['online'] = 0;
$offline+=1;
}
else
{
$seen[$nick]['online'] = 1;
$online+=1;
}
}
}
fwrite(STDOUT, "murmur.value ".$online."\n");
//var_dump($seen);
return 0;
/////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////
//end of file
?>

View file

@ -0,0 +1,225 @@
#!/usr/bin/php
<?php
error_reporting( E_ALL & ~E_NOTICE ); //to avoid of the crap generation
/* // do not remove this line
/////////////////////////////////////////////////////////////////////////////////////////////////////
Murmur users online grapher PHP using ICE
ver 0.4 2011.06.10, 15:44
author _KaszpiR_ kaszpir at gmail dot com
code is under GPL
Requirements:
- PHP installed in CLI (so you can run it in command line)
Make sure the first line of this file points to the pworking php cli inrepreter
- ICE framework on server
- Murmur server with ICE enabled
/////////////////////////////////////////////////////////////////////////////////////////////////////
Configuration:
1. link creation
create a symlink to thie file in the following format:
murmurice_ip_port_sid_description
where ip/port correspond to the ip and port on which the mumble ice interface listens to
sid is the server id we want to query (mumble can run multiple servers )
description - any kind of short text where _ will be replaced with spaces
By default script tries to connect 127.0.0.1:6502 and query server id 1
2. ice profile configuration
This is not needed with ice 3.4.1
Scroll down in this file and change
$ice_profile = 'Murmur';
to the profile that is installed on the server, this is required if you have multiple Ice profiles for various applicaitions.
/////////////////////////////////////////////////////////////////////////////////////////////////////
Script returns:
channels number = number of existing channels on server (with temoprary ones)
players number = number of all connected users on server
registered number = number of connected and registered users on server
unregistered number = number of connected and not registered users on server
chanlinks number = linked chanels
error number = this is set to 1 when there is error with communicatind with server via ice
On any error script exits with status 1, otherwise it is 0.
///////////////////////////////////////////////////////////////////////////////////////////////////
Changelog:
- ver 0.4 2011.06.10, 15:44 stable
fix for ICE 3.4.1 that does not use Ice_loadprofile() function
extended description
fixed typos
fixed warning messages in logs
release
- ver 0.3 2011.04.2, 12:32 stable
fi
- ver 0.2 2010.02.16 beta
some minor fixes
- ver 0.1 2009.03.13 alpha
first private release
///////////////////////////////////////////////////////////////////////////////////////////////////
Todo:
- load iceprofile from env var
///////////////////////////////////////////////////////////////////////////////////////////////////
*/ //do not remove this line
$ice_profile = 'Murmur';
// Define STDIN in case if it is not already defined by PHP for some reason
if(!defined("STDIN"))
{
define("STDIN", fopen('php://stdin','r'));
}
if(!defined("STDERR"))
{
define("STDERR", fopen('php://stderr','w'));
}
list($dummy,$ip,$port,$serverid,$desc) = explode("_",$argv[0],5);
if(!$ip) $ip="127.0.0.1";
if(!$port) $port=6502;
if(!$serverid) $serverid=1;
/////////////////////////////////////////////////////////////////////////////////////////////////////
//autoconf test
if(isset($argv[1]) && $argv[1] == "autoconf")
{
if(FALSE)
{
}
else
{
fwrite(STDOUT, "No\n");
fwrite(STDERR, "symlink ".$argv[0]." to somethilg like ".$argv[0]."_127.0.0.1_6502_1_description_here \n");
}
return 0;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////
//config, set rrd files
if(isset($argv[1]) && $argv[1] == "config")
{
if(TRUE)
{
// yea dirty hack
echo "graph_title Mumble Users".($desc?" on ".str_replace("_"," ",$desc):"")."\n";
echo "graph_vlabel Connected Users\n";
echo "graph_category VoIP\n";
echo "graph_info This graph shows the number of connected users on a murmur server\n";
echo "channels.label Chans\n";
echo "players.label Total Users\n";
echo "registered.label Registerd\n";
echo "unregistered.label Unregistered\n";
echo "chanlinks.label Linked chans\n";
echo "error.label Server status error\n";
$arr=array("channels","players","registered","unregistered","chanlinks","error");
foreach($arr as $field){
echo "".$field.".draw LINE1\n";
echo "".$field.".type GAUGE\n";
}
return 0;
}else {
echo "RTFM\n";
return 1;
}
return 0;
}
$online_noreg=0;
$online_reg=0;
$channels=0;
$links=0;
//echo "Serverid:".$serverid."\n";
if (Ice_intversion() >= 30400) {
require 'Ice.php';
require 'Murmur.php';
} else {
Ice_loadProfile($ice_profile);
}
try {
if (Ice_intversion() >= 30400) {
$initData = new Ice_InitializationData;
$initData->properties = Ice_createProperties();
$initData->properties->setProperty("Ice.MessageSizeMax", "65536");
$ICE = Ice_initialize($initData);
}
$base = $ICE->stringToProxy("Meta:tcp -h ".$ip." -p ".$port);
$meta = $base->ice_checkedCast("::Murmur::Meta");
$servers = $meta->getBootedServers();
$default = $meta->getDefaultConf();
foreach($servers as $s) {
$name = $s->getConf("registername");
if (! $name) {
$name = $default["registername"];
}
if($s->id() !=$serverid) continue;
$chanlist = $s->getChannels();
$channels = count($chanlist);
foreach($chanlist as $chan=>$c){
$links+=count($c->links);
}
$players = $s->getUsers();
foreach($players as $id => $p) {
if($p->userid ==-1)
$online_noreg++;
else
$online_reg++;
}
}
} catch (Ice_LocalException $ex) {
fwrite(STDERR,"ERROR: IP=".$ip.", Port=".$port.", Id=".$serverid."\n");
fwrite(STDERR,$ex);
echo "channels.value 0\n";
echo "players.value 0\n";
echo "registered.value 0\n";
echo "unregistered.value 0\n";
echo "chanlinks.value ".$links."\n";
echo "error.value 1\n";
return 1;
}
echo "channels.value ".$channels."\n";
echo "players.value ".($online_noreg+$online_reg)."\n";
echo "registered.value ".$online_reg."\n";
echo "unregistered.value ".$online_noreg."\n";
echo "chanlinks.value ".$links."\n";
echo "error.value 0\n";
return 0;
?>

View file

@ -0,0 +1,241 @@
#!/usr/bin/php
<?php
error_reporting( E_ALL & ~E_NOTICE ); //to avoid of the crap generation
/* // do not remove this line
/////////////////////////////////////////////////////////////////////////////////////////////////////
Murmur users online grapher PHP using ICE, shows averages
ver 0.2 2011.06.10, 15:44
author _KaszpiR_ kaszpir at gmail dot com
code is under GPL
Requirements:
- PHP installed in CLI (so you can run it in command line)
Make sure the first line of this file points to the pworking php cli inrepreter
- ICE framework on server
- Murmur server with ICE enabled
/////////////////////////////////////////////////////////////////////////////////////////////////////
Configuration:
1. link creation
create a symlink to thie file in the following format:
murmurice_ip_port_sid_description_avg
where ip/port correspond to the ip and port on which the mumble ice interface listens to
sid is the server id we want to query (mumble can run multiple servers )
description - any kind of short text where _ will be replaced with spaces
By default script tries to connect 127.0.0.1:6502 and query server id 1
2. ice profile configuration
This is not needed with ice 3.4.1
Scroll down in this file and change
$ice_profile = 'Murmur';
to the profile that is installed on the server, this is required if you have multiple Ice profiles for various applicaitions.
/////////////////////////////////////////////////////////////////////////////////////////////////////
Script returns:
mute number = number of users currently muted
deaf number = number of users currently deafened on server
suppress number = number of users supressed on server, that is server forced muting
selfmute number = number of users currently muted by themselves
selfdeaf number = number of users currently deafened by themselves
avgperchan number = number of average users per channel
error number = this is set to 1 when there is error with communicatind with server via ice
On any error script exits with status 1, otherwise it is 0.
///////////////////////////////////////////////////////////////////////////////////////////////////
Changelog:
- ver 0.2 2011.06.10, 15:44 stable
fix for ICE 3.4.1 that does not use Ice_loadprofile() function
extended description
fixed typos
fixed warning messages in logs
release
- ver 0.1 2011.04.2, 12:32 stable
ICE 3.4.1 fix
- ver 0.2 2010.02.16 beta
first private release
///////////////////////////////////////////////////////////////////////////////////////////////////
Todo:
- load iceprofile from env var
///////////////////////////////////////////////////////////////////////////////////////////////////
*/ //do not remove this line
$ice_profile = 'Murmur';
// Define STDIN in case if it is not already defined by PHP for some reason
if(!defined("STDIN"))
{
define("STDIN", fopen('php://stdin','r'));
}
if(!defined("STDERR"))
{
define("STDERR", fopen('php://stderr','w'));
}
list($dummy,$ip,$port,$serverid,$desc) = explode("_",$argv[0],5);
if(!$ip) $ip="127.0.0.1";
if(!$port) $port=6502;
if(!$serverid) $serverid=1;
/////////////////////////////////////////////////////////////////////////////////////////////////////
//autoconf test
if(isset($argv[1]) && $argv[1] == "autoconf")
{
if(FALSE)
{
}
else
{
fwrite(STDOUT, "No\n");
fwrite(STDERR, "symlink ".$argv[0]." to somethilg like ".$argv[0]."_127.0.0.1_6502_1_description_here \n");
}
return 0;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////
//config, set rrd files
if(isset($argv[1]) && $argv[1] == "config")
{
if(TRUE)
{
// yea dirty hack
echo "graph_title Mumble Average Users per chan ".($desc?" on ".str_replace("_"," ",$desc):"")."\n";
echo "graph_vlabel Number\n";
echo "graph_category VoIP\n";
echo "graph_info This graph shows the average number of users per channel on a murmur server, and other lower values\n";
echo "mute.label Muted\n";
echo "deaf.label Deafen\n";
echo "suppress.label Suppressed\n";
echo "selfmute.label Self Muted\n";
echo "selfdeaf.label Self Deafen\n";
echo "avgperchan.label Users per chan\n";
echo "error.label Server status error\n";
$arr=array("mute","deaf","suppress","selfmute","selfdeaf","avgperchan","error");
foreach($arr as $field){
echo "".$field.".draw LINE1\n";
echo "".$field.".type GAUGE\n";
}
return 0;
}else {
echo "RTFM\n";
return 1;
}
return 0;
}
$mute=0;
$deaf=0;
$suppress=0;
$selfmute=0;
$selfdeaf=0;
$avg_perchan = array();
$avg = 0;
//echo "Serverid:".$serverid."\n";
if (Ice_intversion() >= 30400) {
require 'Ice.php';
require 'Murmur.php';
} else {
Ice_loadProfile($ice_profile);
}
try {
if (Ice_intversion() >= 30400) {
$initData = new Ice_InitializationData;
$initData->properties = Ice_createProperties();
$initData->properties->setProperty("Ice.MessageSizeMax", "65536");
$ICE = Ice_initialize($initData);
}
$base = $ICE->stringToProxy("Meta:tcp -h ".$ip." -p ".$port);
$meta = $base->ice_checkedCast("::Murmur::Meta");
$servers = $meta->getBootedServers();
$default = $meta->getDefaultConf();
foreach($servers as $s) {
$name = $s->getConf("registername");
if (! $name) {
$name = $default["registername"];
}
if($s->id() !=$serverid) continue;
$chanlist = $s->getChannels();
$channels = count($chanlist);
foreach($chanlist as $chan=>$c){
$links+=count($c->links);
}
$players = $s->getUsers();
foreach($players as $id => $p) {
if($p->userid ==-1)
$online_noreg++;
else
$online_reg++;
if($p->mute) $mute++;
if($p->deaf) $deaf++;
if($p->suppress) $suppress++;
if($p->selfMute) $selfmute++;
if($p->selfDeaf) $selfdeaf++;
$avg_perchan[$p->channel]++;
}
}
$active_chans = count(array_keys($avg_perchan));
if($active_chans == 0 ) $avg = 0;
else $avg = round( count($players) / $active_chans);
} catch (Ice_LocalException $ex) {
fwrite(STDERR,"ERROR: IP=".$ip.", Port=".$port.", Id=".$serverid."\n");
fwrite(STDERR,$ex);
echo "mute.value 0\n";
echo "deaf.value 0\n";
echo "suppress.value 0\n";
echo "selfmute.value 0\n";
echo "selfdeaf.value 0\n";
echo "avgperchan.value 0\n";
echo "error.value 1\n";
return 1;
}
echo "mute.value ".$mute."\n";
echo "deaf.value ".$deaf."\n";
echo "suppress.value ".$suppress."\n";
echo "selfmute.value ".$selfmute."\n";
echo "selfdeaf.value ".$selfdeaf."\n";
echo "avgperchan.value ".$avg."\n";
echo "error.value 0\n";
return 0;
?>

52
plugins/voip/zapchans Executable file
View file

@ -0,0 +1,52 @@
#!/bin/sh
# -*- sh -*-
#
# Plugin to monitor voip statistics.
#
# Parameters:
#
# config (required)
# autoconf (optional - only used by munin-config)
#
# Bugs:
# At least one SuSE netstat appears to report
# "passive connections rejected because of time stamp"
# We have never seen that, patch requested.
#
# Magic markers (optional - used by munin-config and some installation
# scripts):
#%# family=auto
#%# capabilities=autoconf
if [ "$1" = "autoconf" ]; then
echo yes
exit 0
fi
if [ "$1" = "config" ]; then
echo 'graph_title PRI channels in use'
# Most T1s have 23 channels, with one control channel. If you have more than
# one T1, increase the limit here appropriately
echo 'graph_args --upper-limit 22 -l 0'
echo 'graph_scale no'
echo 'graph_vlabel active connections'
echo 'graph_category VOIP'
echo 'graph_period second'
echo 'graph_info This graph shows the number of PRI lines in use.'
echo 'calls.label calls'
echo 'calls.min 0'
echo 'calls.info The number of calls per second.'
exit 0
fi
# it would be wise to put the following in a separate shell script that runs as root in
# cron, and dumps its output to a separate file for this plugin to read later on. Letting
# Munin plugins run as root is a security hole.
zap=`asterisk -rx 'zap show channels' |grep -v "[[:digit:]]*[[:space:]] local" |grep -vc "Chan Extension"`
echo "calls.value $zap"