From cd4dd57e24be837150f29a6a31aac0ed7d51be68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Elio=20Petten=C3=B2?= Date: Sun, 30 Dec 2012 14:02:17 -0800 Subject: [PATCH] asterisk: replace the remaining two Asterisk plugins. The fourth graph (asterisk_codecs) replaces both asterisk_sipchannels and asterisk_codecs, as the latter already included the data from the first. If we want to get more details we could have sub-multigraphs for a breakdown of the codecs per channel type, but right now it feels unneeded. --- plugins/asterisk/asterisk | 121 +++++++++++++++++++++++++++++++++++++- 1 file changed, 119 insertions(+), 2 deletions(-) diff --git a/plugins/asterisk/asterisk b/plugins/asterisk/asterisk index f1949651..7a3c13ce 100755 --- a/plugins/asterisk/asterisk +++ b/plugins/asterisk/asterisk @@ -17,7 +17,10 @@ This plugin will produce multiple graphs showing: asterisk_voicemail); - the number of active MeetMe conferences and users connected to them - (replace asterisk_meetme and asterisk_meetmeusers, respectively). + (replace asterisk_meetme and asterisk_meetmeusers, respectively); + + - the number of active channels for a given codec, for both SIP and + IAX2 channels (replaces asterisk_sipchannels and asterisk_codecs). =head1 CONFIGURATION @@ -29,6 +32,8 @@ The following configuration parameters are used by this plugin env.username - username used for authentication env.secret - secret used for authentication env.channels - The channel types to look for + env.codecsx - List of codec IDs (hexadecimal values) + env.codecs - List of codecs names, matching codecsx order The "username" and "secret" parameters are mandatory, and have no defaults. @@ -39,6 +44,8 @@ defaults. env.host 127.0.0.1 env.port 5038 env.channels Zap IAX2 SIP + env.codecsx 0x2 0x4 0x8 + env.codecs gsm ulaw alaw =head2 WILDCARD CONFIGURATION @@ -52,7 +59,7 @@ underscore: =head1 AUTHOR -Copyright (C) 2005 Rodolphe Quiedeville +Copyright (C) 2005-2006 Rodolphe Quiedeville Copyright (C) 2012 Diego Elio Pettenò =head1 LICENSE @@ -107,6 +114,8 @@ my $username = $ENV{'username'}; my $secret = $ENV{'secret'}; my @CHANNELS = exists $ENV{'channels'} ? split ' ',$ENV{'channels'} : qw(Zap IAX2 SIP); +my @CODECS = exists $ENV{'codecs'} ? split ' ',$ENV{'codecs'} : qw(gsm ulaw alaw); +my @CODECSX = exists $ENV{'codecsx'} ? split ' ',$ENV{'codecsx'} : qw(0x2 0x4 0x8); my $line, my $error; my $socket = new IO::Socket::INET(PeerAddr => $peeraddr, @@ -176,6 +185,29 @@ graph_args --base 1000 -l 0 graph_category asterisk users.label Connected users conferences.label Active conferences +END + +print <close(); @@ -259,3 +301,78 @@ END print "conferences.value " . (scalar(@meetme_list)-1) . "\n"; } } + +print "\nmultigraph asterisk_codecs\n"; +if ( !$sipchannels_response and !$iaxchannels_response ) { + foreach my $codec (@CODECS) { + print "$codec.value U\n"; + } + print <