From c33bbb90e5708ebafce1ea26b01325add06f3360 Mon Sep 17 00:00:00 2001 From: Kenyon Ralph Date: Tue, 24 Apr 2012 01:43:47 -0700 Subject: [PATCH] organize asterisk plugins untar asterisk-fax and move asterisk-multigraph-munin-plugin --- .../asterisk-multigraph-munin-plugin | 0 plugins/asterisk/asterisk_14_fax_ffa/TEMPLATE | 65 ++++++++ .../asterisk_fax_cancelled | 130 ++++++++++++++++ .../asterisk_fax_current_sessions | 129 ++++++++++++++++ .../asterisk_fax_failed_completed | 134 +++++++++++++++++ .../asterisk_14_fax_ffa/asterisk_fax_iofail | 130 ++++++++++++++++ .../asterisk_fax_iopartial | 130 ++++++++++++++++ .../asterisk_fax_licensed_channels | 130 ++++++++++++++++ .../asterisk_fax_max_concurrent | 129 ++++++++++++++++ .../asterisk_fax_negotiations_failed | 130 ++++++++++++++++ .../asterisk_14_fax_ffa/asterisk_fax_nofax | 130 ++++++++++++++++ .../asterisk_14_fax_ffa/asterisk_fax_partial | 131 ++++++++++++++++ .../asterisk_fax_protocol_error | 131 ++++++++++++++++ .../asterisk_14_fax_ffa/asterisk_fax_success | 129 ++++++++++++++++ .../asterisk_fax_switched2t38 | 130 ++++++++++++++++ .../asterisk_fax_train_failure | 130 ++++++++++++++++ .../asterisk_fax_txrx_attempts | 134 +++++++++++++++++ .../asterisk_14_fax_ffa/can-install.pl | 41 +++++ .../asterisk_14_fax_ffa/fax_show_stats.txt | 49 ++++++ plugins/asterisk/asterisk_14_fax_ffa/fax_test | 42 ++++++ .../asterisk_14_fax_ffa/get_fax_stats.pl | 35 +++++ .../asterisk_fax_cancelled | 132 +++++++++++++++++ .../asterisk_16_fax_ffa/asterisk_fax_channels | 130 ++++++++++++++++ .../asterisk_fax_current_sessions | 129 ++++++++++++++++ .../asterisk_fax_failed_completed | 134 +++++++++++++++++ .../asterisk_16_fax_ffa/asterisk_fax_iofail | 132 +++++++++++++++++ .../asterisk_fax_iopartial | 132 +++++++++++++++++ .../asterisk_fax_licensed_channels | 132 +++++++++++++++++ .../asterisk_fax_max_concurrent | 132 +++++++++++++++++ .../asterisk_fax_negotiations_failed | 132 +++++++++++++++++ .../asterisk_16_fax_ffa/asterisk_fax_nofax | 132 +++++++++++++++++ .../asterisk_16_fax_ffa/asterisk_fax_partial | 132 +++++++++++++++++ .../asterisk_fax_protocol_error | 132 +++++++++++++++++ .../asterisk_16_fax_ffa/asterisk_fax_success | 132 +++++++++++++++++ .../asterisk_fax_switched2t38 | 130 ++++++++++++++++ .../asterisk_fax_train_failure | 140 ++++++++++++++++++ .../asterisk_fax_txrx_attempts | 134 +++++++++++++++++ .../asterisk_fax_call_dropped | 132 +++++++++++++++++ .../asterisk_fax_current_sessions | 129 ++++++++++++++++ .../asterisk_fax_failed_completed | 134 +++++++++++++++++ .../asterisk_fax_file_error | 132 +++++++++++++++++ .../asterisk_fax_memory_error | 132 +++++++++++++++++ .../asterisk_fax_negotiations_failed | 133 +++++++++++++++++ .../asterisk_fax_nofax | 132 +++++++++++++++++ .../asterisk_fax_protocol_error | 132 +++++++++++++++++ .../asterisk_fax_retries_exceeded | 132 +++++++++++++++++ .../asterisk_fax_rxtx_protocol_error | 138 +++++++++++++++++ .../asterisk_fax_success | 132 +++++++++++++++++ .../asterisk_fax_switched2t38 | 130 ++++++++++++++++ .../asterisk_fax_train_failure | 132 +++++++++++++++++ .../asterisk_fax_txrx_attempts | 134 +++++++++++++++++ .../asterisk_fax_unknown_error | 132 +++++++++++++++++ plugins/other/asterisk-fax | Bin 9221 -> 0 bytes 53 files changed, 6292 insertions(+) rename plugins/{other => asterisk}/asterisk-multigraph-munin-plugin (100%) create mode 100755 plugins/asterisk/asterisk_14_fax_ffa/TEMPLATE create mode 100755 plugins/asterisk/asterisk_14_fax_ffa/asterisk_fax_cancelled create mode 100755 plugins/asterisk/asterisk_14_fax_ffa/asterisk_fax_current_sessions create mode 100755 plugins/asterisk/asterisk_14_fax_ffa/asterisk_fax_failed_completed create mode 100755 plugins/asterisk/asterisk_14_fax_ffa/asterisk_fax_iofail create mode 100755 plugins/asterisk/asterisk_14_fax_ffa/asterisk_fax_iopartial create mode 100755 plugins/asterisk/asterisk_14_fax_ffa/asterisk_fax_licensed_channels create mode 100755 plugins/asterisk/asterisk_14_fax_ffa/asterisk_fax_max_concurrent create mode 100755 plugins/asterisk/asterisk_14_fax_ffa/asterisk_fax_negotiations_failed create mode 100755 plugins/asterisk/asterisk_14_fax_ffa/asterisk_fax_nofax create mode 100755 plugins/asterisk/asterisk_14_fax_ffa/asterisk_fax_partial create mode 100755 plugins/asterisk/asterisk_14_fax_ffa/asterisk_fax_protocol_error create mode 100755 plugins/asterisk/asterisk_14_fax_ffa/asterisk_fax_success create mode 100755 plugins/asterisk/asterisk_14_fax_ffa/asterisk_fax_switched2t38 create mode 100755 plugins/asterisk/asterisk_14_fax_ffa/asterisk_fax_train_failure create mode 100755 plugins/asterisk/asterisk_14_fax_ffa/asterisk_fax_txrx_attempts create mode 100755 plugins/asterisk/asterisk_14_fax_ffa/can-install.pl create mode 100644 plugins/asterisk/asterisk_14_fax_ffa/fax_show_stats.txt create mode 100755 plugins/asterisk/asterisk_14_fax_ffa/fax_test create mode 100755 plugins/asterisk/asterisk_14_fax_ffa/get_fax_stats.pl create mode 100755 plugins/asterisk/asterisk_16_fax_ffa/asterisk_fax_cancelled create mode 100755 plugins/asterisk/asterisk_16_fax_ffa/asterisk_fax_channels create mode 100755 plugins/asterisk/asterisk_16_fax_ffa/asterisk_fax_current_sessions create mode 100755 plugins/asterisk/asterisk_16_fax_ffa/asterisk_fax_failed_completed create mode 100755 plugins/asterisk/asterisk_16_fax_ffa/asterisk_fax_iofail create mode 100755 plugins/asterisk/asterisk_16_fax_ffa/asterisk_fax_iopartial create mode 100755 plugins/asterisk/asterisk_16_fax_ffa/asterisk_fax_licensed_channels create mode 100755 plugins/asterisk/asterisk_16_fax_ffa/asterisk_fax_max_concurrent create mode 100755 plugins/asterisk/asterisk_16_fax_ffa/asterisk_fax_negotiations_failed create mode 100755 plugins/asterisk/asterisk_16_fax_ffa/asterisk_fax_nofax create mode 100755 plugins/asterisk/asterisk_16_fax_ffa/asterisk_fax_partial create mode 100755 plugins/asterisk/asterisk_16_fax_ffa/asterisk_fax_protocol_error create mode 100755 plugins/asterisk/asterisk_16_fax_ffa/asterisk_fax_success create mode 100755 plugins/asterisk/asterisk_16_fax_ffa/asterisk_fax_switched2t38 create mode 100755 plugins/asterisk/asterisk_16_fax_ffa/asterisk_fax_train_failure create mode 100755 plugins/asterisk/asterisk_16_fax_ffa/asterisk_fax_txrx_attempts create mode 100755 plugins/asterisk/asterisk_18_fax_spandsp/asterisk_fax_call_dropped create mode 100755 plugins/asterisk/asterisk_18_fax_spandsp/asterisk_fax_current_sessions create mode 100755 plugins/asterisk/asterisk_18_fax_spandsp/asterisk_fax_failed_completed create mode 100755 plugins/asterisk/asterisk_18_fax_spandsp/asterisk_fax_file_error create mode 100755 plugins/asterisk/asterisk_18_fax_spandsp/asterisk_fax_memory_error create mode 100755 plugins/asterisk/asterisk_18_fax_spandsp/asterisk_fax_negotiations_failed create mode 100755 plugins/asterisk/asterisk_18_fax_spandsp/asterisk_fax_nofax create mode 100755 plugins/asterisk/asterisk_18_fax_spandsp/asterisk_fax_protocol_error create mode 100755 plugins/asterisk/asterisk_18_fax_spandsp/asterisk_fax_retries_exceeded create mode 100755 plugins/asterisk/asterisk_18_fax_spandsp/asterisk_fax_rxtx_protocol_error create mode 100755 plugins/asterisk/asterisk_18_fax_spandsp/asterisk_fax_success create mode 100755 plugins/asterisk/asterisk_18_fax_spandsp/asterisk_fax_switched2t38 create mode 100755 plugins/asterisk/asterisk_18_fax_spandsp/asterisk_fax_train_failure create mode 100755 plugins/asterisk/asterisk_18_fax_spandsp/asterisk_fax_txrx_attempts create mode 100755 plugins/asterisk/asterisk_18_fax_spandsp/asterisk_fax_unknown_error delete mode 100755 plugins/other/asterisk-fax diff --git a/plugins/other/asterisk-multigraph-munin-plugin b/plugins/asterisk/asterisk-multigraph-munin-plugin similarity index 100% rename from plugins/other/asterisk-multigraph-munin-plugin rename to plugins/asterisk/asterisk-multigraph-munin-plugin diff --git a/plugins/asterisk/asterisk_14_fax_ffa/TEMPLATE b/plugins/asterisk/asterisk_14_fax_ffa/TEMPLATE new file mode 100755 index 00000000..5034fc9f --- /dev/null +++ b/plugins/asterisk/asterisk_14_fax_ffa/TEMPLATE @@ -0,0 +1,65 @@ +#!/usr/bin/perl + + use Carp; + use strict; + use Asterisk::AMI; + + my $ret = undef; + if ( ! eval "require Asterisk::AMI;" ) { + $ret = "Asterisk::AMI not found"; + }; + + if ( $ARGV[ 0 ] and $ARGV[ 0 ] eq "config" ) { + print "graph_title Asterisk Fax - Cancelled Faxes (T.38 and G.711)\n"; + print "graph_args --base 1000 -l 0\n"; + print "graph_vlabel Number of Cancelled Faxes\n"; + print "graph_category asterisk\n"; + print "t38_cancelled.draw AREA\n"; + print "t38_cancelled.label Cancelled T.38 Faxes\n"; + print "g711_cancelled.draw AREA\n"; + print "g711_cancelled.label Cancelled G.711 Faxes\n"; + exit ( 0 ); + }; + + #my $host = exists $ENV{ 'host' } ? $ENV{ 'host' } : "127.0.0.1"; + #my $port = exists $ENV{ 'port' } ? $ENV{ 'port' } : "5038"; + #my $username = $ENV{ 'username' }; + #my $secret = $ENV{ 'secret' }; + + my $username = 'manager'; + my $host = '192.168.1.70'; + my $port = '5038'; + my $secret = 'insecure'; + my $timeout = '5'; + + my $astman = Asterisk::AMI->new(PeerAddr => "$host", + PeerPort => "$port", + Username => "$username", + Secret => "$secret" + ); + + croak "Unable to connect to asterisk" unless ( $astman ); + my $actionid = $astman->send_action({ Action => 'Command', + Command => 'fax show stats', + $timeout}); + my $response = $astman->get_response( $actionid ); + my $arrayref = $response->{CMD}; + my $null = qq{}; + my ( %faxstats, $section ); + foreach my $line ( @$arrayref ) { + next if ( ( ! $line ) || ( $line =~ /-----------/ ) ); + my ( $key, $value ) = split( ':', $line ); + $section = $key if ( $value eq $null ); + $key =~ s/\s+$//g; + $value =~ s/^\s+//g; + $faxstats{ "$section" }{ "$key" } = $value if ( $value ne $null ); + }; + $astman->disconnect; + + print "t38_cancelled.value $faxstats{'Digium T.38'}{'Canceled'}\n"; + print "g711_cancelled.value $faxstats{'Digium G.711'}{'Canceled'}\n"; + + exit( 0 ); + + + diff --git a/plugins/asterisk/asterisk_14_fax_ffa/asterisk_fax_cancelled b/plugins/asterisk/asterisk_14_fax_ffa/asterisk_fax_cancelled new file mode 100755 index 00000000..3258d261 --- /dev/null +++ b/plugins/asterisk/asterisk_14_fax_ffa/asterisk_fax_cancelled @@ -0,0 +1,130 @@ +#!/usr/bin/perl + +=head1 NAME + +asterisk_fax_* - Plugin to monitor Asterisk fax parameters. + +=head1 SUPPORTED VERSION + +This plugin supports Asterisk 1.4.* and Digiums Fax For Asterisk (FFA) modules. + +=head1 CONFIGURATION + +The following configuration parameters are used by this plugin + + [asterisk*] + env.host - hostname to connect to. Defaults to localhost. + env.port - port number to connect to. Defaults to 5038. + env.username - username used for authentication. No default value. + env.secret - secret used for authentication. No default value. + env.timeout - AMI timeout value in seconds. Defaults to 5. + +The "username" and "secret" parameters are mandatory, and have no +defaults. + +=head1 DEFAULT CONFIGURATION + + [asterisk*] + env.username manager + env.secret insecure + env.host 127.0.0.1 + env.port 5038 + env.timeout 5 + +=head1 REQUIRED PERL MODULES + +This plugin requires the Asterisk::AMI module and its dependencies. +Its dependencies can be found here: +http://deps.cpantesters.org/?module=Asterisk::AMI;perl=latest + + +=head1 AUTHOR + +Copyright (C) 2011 Frank DiGennaro + +=head1 LICENSE + +Gnu GPLv2 + +=begin comment + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; version 2 dated June, 1991. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, +USA. + +If you improve this script please send your version to my email +address with the copyright notice upgrade with your name. + +=end comment + +=head1 MAGIC MARKERS + + #%# family=contrib + +=cut + + use Carp; + use strict; + use Asterisk::AMI; + + eval "use Asterisk::AMI"; + print "Asterisk::AMI not found. Exiting...\n" if $@; + exit( 0 ) if $@; + + if ( $ARGV[ 0 ] and $ARGV[ 0 ] eq "config" ) { + print "graph_title Asterisk Fax - Cancelled Faxes\n"; + print "graph_args --base 1000 -l 0\n"; + print "graph_vlabel Number of Cancelled Faxes\n"; + print "graph_category asterisk\n"; + print "cancelled.draw AREA\n"; + print "cancelled.label Cancelled Faxes\n"; + exit 0; + }; + + my $host = exists $ENV{ 'host' } ? $ENV{ 'host' } : "127.0.0.1"; + my $port = exists $ENV{ 'port' } ? $ENV{ 'port' } : "5038"; + my $timeout = exists $ENV{ 'timeout' } ? $ENV{ 'timeout' } : "5"; + my $username = $ENV{ 'username' }; + my $secret = $ENV{ 'secret' }; + + my $astman = Asterisk::AMI->new(PeerAddr => "$host", + PeerPort => "$port", + Username => "$username", + Secret => "$secret" + ); + + croak "Unable to connect to asterisk" unless ( $astman ); + my $actionid = $astman->send_action({ Action => 'Command', + Command => 'fax show stats', + $timeout}); + my $response = $astman->get_response( $actionid ); + my $arrayref = $response->{CMD}; + my $null = qq{}; + my ( %faxstats, $section ); + foreach my $line ( @$arrayref ) { + next if ( ( ! $line ) || ( $line =~ /-----------/ ) ); + my ( $key, $value ) = split( ':', $line ); + $section = $key if ( $value eq $null ); + $key =~ s/\s+$//g; + $value =~ s/^\s+//g; + $faxstats{ "$section" }{ "$key" } = $value if ( $value ne $null ); + }; + $astman->disconnect; + + my $cancelled = $faxstats{'Digium G.711'}{'Canceled'}; + print "cancelled.value $cancelled\n"; + + exit( 0 ); + + + diff --git a/plugins/asterisk/asterisk_14_fax_ffa/asterisk_fax_current_sessions b/plugins/asterisk/asterisk_14_fax_ffa/asterisk_fax_current_sessions new file mode 100755 index 00000000..72de6193 --- /dev/null +++ b/plugins/asterisk/asterisk_14_fax_ffa/asterisk_fax_current_sessions @@ -0,0 +1,129 @@ +#!/usr/bin/perl + +=head1 NAME + +asterisk_fax_* - Plugin to monitor Asterisk fax parameters. + +=head1 SUPPORTED VERSION + +This plugin supports Asterisk 1.4.* and Digiums Fax For Asterisk (FFA) modules. + +=head1 CONFIGURATION + +The following configuration parameters are used by this plugin + + [asterisk*] + env.host - hostname to connect to. Defaults to localhost. + env.port - port number to connect to. Defaults to 5038. + env.username - username used for authentication. No default value. + env.secret - secret used for authentication. No default value. + env.timeout - AMI timeout value in seconds. Defaults to 5. + +The "username" and "secret" parameters are mandatory, and have no +defaults. + +=head1 DEFAULT CONFIGURATION + + [asterisk*] + env.username manager + env.secret insecure + env.host 127.0.0.1 + env.port 5038 + env.timeout 5 + +=head1 REQUIRED PERL MODULES + +This plugin requires the Asterisk::AMI module and its dependencies. +Its dependencies can be found here: +http://deps.cpantesters.org/?module=Asterisk::AMI;perl=latest + + +=head1 AUTHOR + +Copyright (C) 2011 Frank DiGennaro + +=head1 LICENSE + +Gnu GPLv2 + +=begin comment + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; version 2 dated June, 1991. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, +USA. + +If you improve this script please send your version to my email +address with the copyright notice upgrade with your name. + +=end comment + +=head1 MAGIC MARKERS + + #%# family=contrib + +=cut + + use Carp; + use strict; + use Asterisk::AMI; + + eval "use Asterisk::AMI"; + print "Asterisk::AMI not found. Exiting...\n" if $@; + exit( 0 ) if $@; + + if ( $ARGV[ 0 ] and $ARGV[ 0 ] eq "config" ) { + print "graph_title Asterisk Fax - Current Sessions\n"; + print "graph_args --base 1000 -l 0\n"; + print "graph_vlabel Current Sessions\n"; + print "graph_category asterisk\n"; + print "sessions.draw AREA\n"; + print "sessions.label Current Sessions\n"; + exit 0; + }; + + my $host = exists $ENV{ 'host' } ? $ENV{ 'host' } : "127.0.0.1"; + my $port = exists $ENV{ 'port' } ? $ENV{ 'port' } : "5038"; + my $timeout = exists $ENV{ 'timeout' } ? $ENV{ 'timeout' } : "5"; + my $username = $ENV{ 'username' }; + my $secret = $ENV{ 'secret' }; + + my $astman = Asterisk::AMI->new(PeerAddr => "$host", + PeerPort => "$port", + Username => "$username", + Secret => "$secret" + ); + + croak "Unable to connect to asterisk" unless ( $astman ); + my $actionid = $astman->send_action({ Action => 'Command', + Command => 'fax show stats', + $timeout}); + my $response = $astman->get_response( $actionid ); + my $arrayref = $response->{CMD}; + my $null = qq{}; + my ( %faxstats, $section ); + foreach my $line ( @$arrayref ) { + next if ( ( ! $line ) || ( $line =~ /-----------/ ) ); + my ( $key, $value ) = split( ':', $line ); + $section = $key if ( $value eq $null ); + $key =~ s/\s+$//g; + $value =~ s/^\s+//g; + $faxstats{ "$section" }{ "$key" } = $value if ( $value ne $null ); + }; + $astman->disconnect; + + my $sessions = $faxstats{'FAX Statistics'}{'Current Sessions'}; + print "sessions.value $sessions\n"; + + exit( 0 ); + + diff --git a/plugins/asterisk/asterisk_14_fax_ffa/asterisk_fax_failed_completed b/plugins/asterisk/asterisk_14_fax_ffa/asterisk_fax_failed_completed new file mode 100755 index 00000000..1a443cef --- /dev/null +++ b/plugins/asterisk/asterisk_14_fax_ffa/asterisk_fax_failed_completed @@ -0,0 +1,134 @@ +#!/usr/bin/perl + +=head1 NAME + +asterisk_fax_* - Plugin to monitor Asterisk fax parameters. + +=head1 SUPPORTED VERSION + +This plugin supports Asterisk 1.4.* and Digiums Fax For Asterisk (FFA) modules. + +=head1 CONFIGURATION + +The following configuration parameters are used by this plugin + + [asterisk*] + env.host - hostname to connect to. Defaults to localhost. + env.port - port number to connect to. Defaults to 5038. + env.username - username used for authentication. No default value. + env.secret - secret used for authentication. No default value. + env.timeout - AMI timeout value in seconds. Defaults to 5. + +The "username" and "secret" parameters are mandatory, and have no +defaults. + +=head1 DEFAULT CONFIGURATION + + [asterisk*] + env.username manager + env.secret insecure + env.host 127.0.0.1 + env.port 5038 + env.timeout 5 + +=head1 REQUIRED PERL MODULES + +This plugin requires the Asterisk::AMI module and its dependencies. +Its dependencies can be found here: +http://deps.cpantesters.org/?module=Asterisk::AMI;perl=latest + + +=head1 AUTHOR + +Copyright (C) 2011 Frank DiGennaro + +=head1 LICENSE + +Gnu GPLv2 + +=begin comment + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; version 2 dated June, 1991. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, +USA. + +If you improve this script please send your version to my email +address with the copyright notice upgrade with your name. + +=end comment + +=head1 MAGIC MARKERS + + #%# family=contrib + +=cut + + use Carp; + use strict; + use Asterisk::AMI; + + eval "use Asterisk::AMI"; + print "Asterisk::AMI not found. Exiting...\n" if $@; + exit( 0 ) if $@; + + if ( $ARGV[ 0 ] and $ARGV[ 0 ] eq "config" ) { + print "graph_title Asterisk Fax - Failed and Completed Faxes\n"; + print "graph_args --base 1000 -l 0\n"; + print "graph_vlabel Failed and Completed Faxes\n"; + print "graph_category asterisk\n"; + print "failed.draw AREA\n"; + print "failed.label Failed faxes\n"; + print "completed.draw AREA\n"; + print "completed.label Completed faxes\n"; + exit 0; + }; + + my $host = exists $ENV{ 'host' } ? $ENV{ 'host' } : "127.0.0.1"; + my $port = exists $ENV{ 'port' } ? $ENV{ 'port' } : "5038"; + my $timeout = exists $ENV{ 'timeout' } ? $ENV{ 'timeout' } : "5"; + my $username = $ENV{ 'username' }; + my $secret = $ENV{ 'secret' }; + + my $astman = Asterisk::AMI->new(PeerAddr => "$host", + PeerPort => "$port", + Username => "$username", + Secret => "$secret" + ); + + croak "Unable to connect to asterisk" unless ( $astman ); + my $actionid = $astman->send_action({ Action => 'Command', + Command => 'fax show stats', + $timeout}); + my $response = $astman->get_response( $actionid ); + my $arrayref = $response->{CMD}; + my $null = qq{}; + my ( %faxstats, $section ); + foreach my $line ( @$arrayref ) { + next if ( ( ! $line ) || ( $line =~ /-----------/ ) ); + my ( $key, $value ) = split( ':', $line ); + $section = $key if ( $value eq $null ); + $key =~ s/\s+$//g; + $value =~ s/^\s+//g; + $faxstats{ "$section" }{ "$key" } = $value if ( $value ne $null ); + }; + $astman->disconnect; + + my $failed = $faxstats{'FAX Statistics'}{'Failed FAXes'}; + my $completed = $faxstats{'FAX Statistics'}{'Completed FAXes'}; + print "failed.value $failed\n"; + print "completed.value $completed\n"; + + exit( 0 ); + + + diff --git a/plugins/asterisk/asterisk_14_fax_ffa/asterisk_fax_iofail b/plugins/asterisk/asterisk_14_fax_ffa/asterisk_fax_iofail new file mode 100755 index 00000000..83ad26bf --- /dev/null +++ b/plugins/asterisk/asterisk_14_fax_ffa/asterisk_fax_iofail @@ -0,0 +1,130 @@ +#!/usr/bin/perl + +=head1 NAME + +asterisk_fax_* - Plugin to monitor Asterisk fax parameters. + +=head1 SUPPORTED VERSION + +This plugin supports Asterisk 1.4.* and Digiums Fax For Asterisk (FFA) modules. + +=head1 CONFIGURATION + +The following configuration parameters are used by this plugin + + [asterisk*] + env.host - hostname to connect to. Defaults to localhost. + env.port - port number to connect to. Defaults to 5038. + env.username - username used for authentication. No default value. + env.secret - secret used for authentication. No default value. + env.timeout - AMI timeout value in seconds. Defaults to 5. + +The "username" and "secret" parameters are mandatory, and have no +defaults. + +=head1 DEFAULT CONFIGURATION + + [asterisk*] + env.username manager + env.secret insecure + env.host 127.0.0.1 + env.port 5038 + env.timeout 5 + +=head1 REQUIRED PERL MODULES + +This plugin requires the Asterisk::AMI module and its dependencies. +Its dependencies can be found here: +http://deps.cpantesters.org/?module=Asterisk::AMI;perl=latest + + +=head1 AUTHOR + +Copyright (C) 2011 Frank DiGennaro + +=head1 LICENSE + +Gnu GPLv2 + +=begin comment + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; version 2 dated June, 1991. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, +USA. + +If you improve this script please send your version to my email +address with the copyright notice upgrade with your name. + +=end comment + +=head1 MAGIC MARKERS + + #%# family=contrib + +=cut + + use Carp; + use strict; + use Asterisk::AMI; + + eval "use Asterisk::AMI"; + print "Asterisk::AMI not found. Exiting...\n" if $@; + exit( 0 ) if $@; + + if ( $ARGV[ 0 ] and $ARGV[ 0 ] eq "config" ) { + print "graph_title Asterisk Fax - IO Fail\n"; + print "graph_args --base 1000 -l 0\n"; + print "graph_vlabel Number of IO Failures\n"; + print "graph_category asterisk\n"; + print "iofail.draw AREA\n"; + print "iofail.label IO Failures\n"; + exit 0; + }; + + my $host = exists $ENV{ 'host' } ? $ENV{ 'host' } : "127.0.0.1"; + my $port = exists $ENV{ 'port' } ? $ENV{ 'port' } : "5038"; + my $timeout = exists $ENV{ 'timeout' } ? $ENV{ 'timeout' } : "5"; + my $username = $ENV{ 'username' }; + my $secret = $ENV{ 'secret' }; + + my $astman = Asterisk::AMI->new(PeerAddr => "$host", + PeerPort => "$port", + Username => "$username", + Secret => "$secret" + ); + + croak "Unable to connect to asterisk" unless ( $astman ); + my $actionid = $astman->send_action({ Action => 'Command', + Command => 'fax show stats', + $timeout}); + my $response = $astman->get_response( $actionid ); + my $arrayref = $response->{CMD}; + my $null = qq{}; + my ( %faxstats, $section ); + foreach my $line ( @$arrayref ) { + next if ( ( ! $line ) || ( $line =~ /-----------/ ) ); + my ( $key, $value ) = split( ':', $line ); + $section = $key if ( $value eq $null ); + $key =~ s/\s+$//g; + $value =~ s/^\s+//g; + $faxstats{ "$section" }{ "$key" } = $value if ( $value ne $null ); + }; + $astman->disconnect; + + my $iofail = $faxstats{'Digium G.711'}{'IO Fail'}; + print "iofail.value $iofail\n"; + + exit( 0 ); + + + diff --git a/plugins/asterisk/asterisk_14_fax_ffa/asterisk_fax_iopartial b/plugins/asterisk/asterisk_14_fax_ffa/asterisk_fax_iopartial new file mode 100755 index 00000000..64adca01 --- /dev/null +++ b/plugins/asterisk/asterisk_14_fax_ffa/asterisk_fax_iopartial @@ -0,0 +1,130 @@ +#!/usr/bin/perl + +=head1 NAME + +asterisk_fax_* - Plugin to monitor Asterisk fax parameters. + +=head1 SUPPORTED VERSION + +This plugin supports Asterisk 1.4.* and Digiums Fax For Asterisk (FFA) modules. + +=head1 CONFIGURATION + +The following configuration parameters are used by this plugin + + [asterisk*] + env.host - hostname to connect to. Defaults to localhost. + env.port - port number to connect to. Defaults to 5038. + env.username - username used for authentication. No default value. + env.secret - secret used for authentication. No default value. + env.timeout - AMI timeout value in seconds. Defaults to 5. + +The "username" and "secret" parameters are mandatory, and have no +defaults. + +=head1 DEFAULT CONFIGURATION + + [asterisk*] + env.username manager + env.secret insecure + env.host 127.0.0.1 + env.port 5038 + env.timeout 5 + +=head1 REQUIRED PERL MODULES + +This plugin requires the Asterisk::AMI module and its dependencies. +Its dependencies can be found here: +http://deps.cpantesters.org/?module=Asterisk::AMI;perl=latest + + +=head1 AUTHOR + +Copyright (C) 2011 Frank DiGennaro + +=head1 LICENSE + +Gnu GPLv2 + +=begin comment + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; version 2 dated June, 1991. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, +USA. + +If you improve this script please send your version to my email +address with the copyright notice upgrade with your name. + +=end comment + +=head1 MAGIC MARKERS + + #%# family=contrib + +=cut + + use Carp; + use strict; + use Asterisk::AMI; + + eval "use Asterisk::AMI"; + print "Asterisk::AMI not found. Exiting...\n" if $@; + exit( 0 ) if $@; + + if ( $ARGV[ 0 ] and $ARGV[ 0 ] eq "config" ) { + print "graph_title Asterisk Fax - IO Partial\n"; + print "graph_args --base 1000 -l 0\n"; + print "graph_vlabel Number of IO Partials\n"; + print "graph_category asterisk\n"; + print "iopartial.draw AREA\n"; + print "iopartial.label IO Partial\n"; + exit 0; + }; + + my $host = exists $ENV{ 'host' } ? $ENV{ 'host' } : "127.0.0.1"; + my $port = exists $ENV{ 'port' } ? $ENV{ 'port' } : "5038"; + my $timeout = exists $ENV{ 'timeout' } ? $ENV{ 'timeout' } : "5"; + my $username = $ENV{ 'username' }; + my $secret = $ENV{ 'secret' }; + + my $astman = Asterisk::AMI->new(PeerAddr => "$host", + PeerPort => "$port", + Username => "$username", + Secret => "$secret" + ); + + croak "Unable to connect to asterisk" unless ( $astman ); + my $actionid = $astman->send_action({ Action => 'Command', + Command => 'fax show stats', + $timeout}); + my $response = $astman->get_response( $actionid ); + my $arrayref = $response->{CMD}; + my $null = qq{}; + my ( %faxstats, $section ); + foreach my $line ( @$arrayref ) { + next if ( ( ! $line ) || ( $line =~ /-----------/ ) ); + my ( $key, $value ) = split( ':', $line ); + $section = $key if ( $value eq $null ); + $key =~ s/\s+$//g; + $value =~ s/^\s+//g; + $faxstats{ "$section" }{ "$key" } = $value if ( $value ne $null ); + }; + $astman->disconnect; + + my $iopartial = $faxstats{'Digium G.711'}{'IO Partial'}; + print "iopartial.value $iopartial\n"; + + exit( 0 ); + + + diff --git a/plugins/asterisk/asterisk_14_fax_ffa/asterisk_fax_licensed_channels b/plugins/asterisk/asterisk_14_fax_ffa/asterisk_fax_licensed_channels new file mode 100755 index 00000000..49673565 --- /dev/null +++ b/plugins/asterisk/asterisk_14_fax_ffa/asterisk_fax_licensed_channels @@ -0,0 +1,130 @@ +#!/usr/bin/perl + +=head1 NAME + +asterisk_fax_* - Plugin to monitor Asterisk fax parameters. + +=head1 SUPPORTED VERSION + +This plugin supports Asterisk 1.4.* and Digiums Fax For Asterisk (FFA) modules. + +=head1 CONFIGURATION + +The following configuration parameters are used by this plugin + + [asterisk*] + env.host - hostname to connect to. Defaults to localhost. + env.port - port number to connect to. Defaults to 5038. + env.username - username used for authentication. No default value. + env.secret - secret used for authentication. No default value. + env.timeout - AMI timeout value in seconds. Defaults to 5. + +The "username" and "secret" parameters are mandatory, and have no +defaults. + +=head1 DEFAULT CONFIGURATION + + [asterisk*] + env.username manager + env.secret insecure + env.host 127.0.0.1 + env.port 5038 + env.timeout 5 + +=head1 REQUIRED PERL MODULES + +This plugin requires the Asterisk::AMI module and its dependencies. +Its dependencies can be found here: +http://deps.cpantesters.org/?module=Asterisk::AMI;perl=latest + + +=head1 AUTHOR + +Copyright (C) 2011 Frank DiGennaro + +=head1 LICENSE + +Gnu GPLv2 + +=begin comment + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; version 2 dated June, 1991. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, +USA. + +If you improve this script please send your version to my email +address with the copyright notice upgrade with your name. + +=end comment + +=head1 MAGIC MARKERS + + #%# family=contrib + +=cut + + use Carp; + use strict; + use Asterisk::AMI; + + eval "use Asterisk::AMI"; + print "Asterisk::AMI not found. Exiting...\n" if $@; + exit( 0 ) if $@; + + if ( $ARGV[ 0 ] and $ARGV[ 0 ] eq "config" ) { + print "graph_title Asterisk Fax - Licensed Channels\n"; + print "graph_args --base 1000 -l 0\n"; + print "graph_vlabel Licensed Channels\n"; + print "graph_category asterisk\n"; + print "channels.draw AREA\n"; + print "channels.label Licensed Channels\n"; + exit 0; + }; + + my $host = exists $ENV{ 'host' } ? $ENV{ 'host' } : "127.0.0.1"; + my $port = exists $ENV{ 'port' } ? $ENV{ 'port' } : "5038"; + my $timeout = exists $ENV{ 'timeout' } ? $ENV{ 'timeout' } : "5"; + my $username = $ENV{ 'username' }; + my $secret = $ENV{ 'secret' }; + + my $astman = Asterisk::AMI->new(PeerAddr => "$host", + PeerPort => "$port", + Username => "$username", + Secret => "$secret" + ); + + croak "Unable to connect to asterisk" unless ( $astman ); + my $actionid = $astman->send_action({ Action => 'Command', + Command => 'fax show stats', + $timeout}); + my $response = $astman->get_response( $actionid ); + my $arrayref = $response->{CMD}; + my $null = qq{}; + my ( %faxstats, $section ); + foreach my $line ( @$arrayref ) { + next if ( ( ! $line ) || ( $line =~ /-----------/ ) ); + my ( $key, $value ) = split( ':', $line ); + $section = $key if ( $value eq $null ); + $key =~ s/\s+$//g; + $value =~ s/^\s+//g; + $faxstats{ "$section" }{ "$key" } = $value if ( $value ne $null ); + }; + $astman->disconnect; + + my $channels = $faxstats{'Digium G.711'}{'Licensed Channels'}; + print "channels.value $channels\n"; + + exit( 0 ); + + + diff --git a/plugins/asterisk/asterisk_14_fax_ffa/asterisk_fax_max_concurrent b/plugins/asterisk/asterisk_14_fax_ffa/asterisk_fax_max_concurrent new file mode 100755 index 00000000..247e28a1 --- /dev/null +++ b/plugins/asterisk/asterisk_14_fax_ffa/asterisk_fax_max_concurrent @@ -0,0 +1,129 @@ +#!/usr/bin/perl + +=head1 NAME + +asterisk_fax_* - Plugin to monitor Asterisk fax parameters. + +=head1 SUPPORTED VERSION + +This plugin supports Asterisk 1.4.* and Digiums Fax For Asterisk (FFA) modules. + +=head1 CONFIGURATION + +The following configuration parameters are used by this plugin + + [asterisk*] + env.host - hostname to connect to. Defaults to localhost. + env.port - port number to connect to. Defaults to 5038. + env.username - username used for authentication. No default value. + env.secret - secret used for authentication. No default value. + env.timeout - AMI timeout value in seconds. Defaults to 5. + +The "username" and "secret" parameters are mandatory, and have no +defaults. + +=head1 DEFAULT CONFIGURATION + + [asterisk*] + env.username manager + env.secret insecure + env.host 127.0.0.1 + env.port 5038 + env.timeout 5 + +=head1 REQUIRED PERL MODULES + +This plugin requires the Asterisk::AMI module and its dependencies. +Its dependencies can be found here: +http://deps.cpantesters.org/?module=Asterisk::AMI;perl=latest + + +=head1 AUTHOR + +Copyright (C) 2011 Frank DiGennaro + +=head1 LICENSE + +Gnu GPLv2 + +=begin comment + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; version 2 dated June, 1991. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, +USA. + +If you improve this script please send your version to my email +address with the copyright notice upgrade with your name. + +=end comment + +=head1 MAGIC MARKERS + + #%# family=contrib + +=cut + + use Carp; + use strict; + use Asterisk::AMI; + + eval "use Asterisk::AMI"; + print "Asterisk::AMI not found. Exiting...\n" if $@; + exit( 0 ) if $@; + + if ( $ARGV[ 0 ] and $ARGV[ 0 ] eq "config" ) { + print "graph_title Asterisk Fax - Max Concurrent Sessions\n"; + print "graph_args --base 1000 -l 0\n"; + print "graph_vlabel Max Concurrent Sessions\n"; + print "graph_category asterisk\n"; + print "maxsessions.draw AREA\n"; + print "maxsessions.label Sessions\n"; + exit 0; + }; + + my $host = exists $ENV{ 'host' } ? $ENV{ 'host' } : "127.0.0.1"; + my $port = exists $ENV{ 'port' } ? $ENV{ 'port' } : "5038"; + my $timeout = exists $ENV{ 'timeout' } ? $ENV{ 'timeout' } : "5"; + my $username = $ENV{ 'username' }; + my $secret = $ENV{ 'secret' }; + + my $astman = Asterisk::AMI->new(PeerAddr => "$host", + PeerPort => "$port", + Username => "$username", + Secret => "$secret" + ); + + croak "Unable to connect to asterisk" unless ( $astman ); + my $actionid = $astman->send_action({ Action => 'Command', + Command => 'fax show stats', + $timeout}); + my $response = $astman->get_response( $actionid ); + my $arrayref = $response->{CMD}; + my $null = qq{}; + my ( %faxstats, $section ); + foreach my $line ( @$arrayref ) { + next if ( ( ! $line ) || ( $line =~ /-----------/ ) ); + my ( $key, $value ) = split( ':', $line ); + $section = $key if ( $value eq $null ); + $key =~ s/\s+$//g; + $value =~ s/^\s+//g; + $faxstats{ "$section" }{ "$key" } = $value if ( $value ne $null ); + }; + $astman->disconnect; + + my $maxsessions = $faxstats{'Digium G.711'}{'Max Concurrent'}; + print "maxsessions.value $maxsessions\n"; + + exit( 0 ); + + diff --git a/plugins/asterisk/asterisk_14_fax_ffa/asterisk_fax_negotiations_failed b/plugins/asterisk/asterisk_14_fax_ffa/asterisk_fax_negotiations_failed new file mode 100755 index 00000000..ca7757ff --- /dev/null +++ b/plugins/asterisk/asterisk_14_fax_ffa/asterisk_fax_negotiations_failed @@ -0,0 +1,130 @@ +#!/usr/bin/perl + +=head1 NAME + +asterisk_fax_* - Plugin to monitor Asterisk fax parameters. + +=head1 SUPPORTED VERSION + +This plugin supports Asterisk 1.4.* and Digiums Fax For Asterisk (FFA) modules. + +=head1 CONFIGURATION + +The following configuration parameters are used by this plugin + + [asterisk*] + env.host - hostname to connect to. Defaults to localhost. + env.port - port number to connect to. Defaults to 5038. + env.username - username used for authentication. No default value. + env.secret - secret used for authentication. No default value. + env.timeout - AMI timeout value in seconds. Defaults to 5. + +The "username" and "secret" parameters are mandatory, and have no +defaults. + +=head1 DEFAULT CONFIGURATION + + [asterisk*] + env.username manager + env.secret insecure + env.host 127.0.0.1 + env.port 5038 + env.timeout 5 + +=head1 REQUIRED PERL MODULES + +This plugin requires the Asterisk::AMI module and its dependencies. +Its dependencies can be found here: +http://deps.cpantesters.org/?module=Asterisk::AMI;perl=latest + + +=head1 AUTHOR + +Copyright (C) 2011 Frank DiGennaro + +=head1 LICENSE + +Gnu GPLv2 + +=begin comment + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; version 2 dated June, 1991. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, +USA. + +If you improve this script please send your version to my email +address with the copyright notice upgrade with your name. + +=end comment + +=head1 MAGIC MARKERS + + #%# family=contrib + +=cut + + use Carp; + use strict; + use Asterisk::AMI; + + eval "use Asterisk::AMI"; + print "Asterisk::AMI not found. Exiting...\n" if $@; + exit( 0 ) if $@; + + if ( $ARGV[ 0 ] and $ARGV[ 0 ] eq "config" ) { + print "graph_title Asterisk Fax - Negotiations Failed\n"; + print "graph_args --base 1000 -l 0\n"; + print "graph_vlabel Number of Negotiations Failed\n"; + print "graph_category asterisk\n"; + print "failed.draw AREA\n"; + print "failed.label Negotiations Failed\n"; + exit 0; + }; + + my $host = exists $ENV{ 'host' } ? $ENV{ 'host' } : "127.0.0.1"; + my $port = exists $ENV{ 'port' } ? $ENV{ 'port' } : "5038"; + my $timeout = exists $ENV{ 'timeout' } ? $ENV{ 'timeout' } : "5"; + my $username = $ENV{ 'username' }; + my $secret = $ENV{ 'secret' }; + + my $astman = Asterisk::AMI->new(PeerAddr => "$host", + PeerPort => "$port", + Username => "$username", + Secret => "$secret" + ); + + croak "Unable to connect to asterisk" unless ( $astman ); + my $actionid = $astman->send_action({ Action => 'Command', + Command => 'fax show stats', + $timeout}); + my $response = $astman->get_response( $actionid ); + my $arrayref = $response->{CMD}; + my $null = qq{}; + my ( %faxstats, $section ); + foreach my $line ( @$arrayref ) { + next if ( ( ! $line ) || ( $line =~ /-----------/ ) ); + my ( $key, $value ) = split( ':', $line ); + $section = $key if ( $value eq $null ); + $key =~ s/\s+$//g; + $value =~ s/^\s+//g; + $faxstats{ "$section" }{ "$key" } = $value if ( $value ne $null ); + }; + $astman->disconnect; + + my $failed = $faxstats{'Digium G.711'}{'Negotiation Failed'}; + print "failed.value $failed\n"; + + exit( 0 ); + + + diff --git a/plugins/asterisk/asterisk_14_fax_ffa/asterisk_fax_nofax b/plugins/asterisk/asterisk_14_fax_ffa/asterisk_fax_nofax new file mode 100755 index 00000000..645199b8 --- /dev/null +++ b/plugins/asterisk/asterisk_14_fax_ffa/asterisk_fax_nofax @@ -0,0 +1,130 @@ +#!/usr/bin/perl + +=head1 NAME + +asterisk_fax_* - Plugin to monitor Asterisk fax parameters. + +=head1 SUPPORTED VERSION + +This plugin supports Asterisk 1.4.* and Digiums Fax For Asterisk (FFA) modules. + +=head1 CONFIGURATION + +The following configuration parameters are used by this plugin + + [asterisk*] + env.host - hostname to connect to. Defaults to localhost. + env.port - port number to connect to. Defaults to 5038. + env.username - username used for authentication. No default value. + env.secret - secret used for authentication. No default value. + env.timeout - AMI timeout value in seconds. Defaults to 5. + +The "username" and "secret" parameters are mandatory, and have no +defaults. + +=head1 DEFAULT CONFIGURATION + + [asterisk*] + env.username manager + env.secret insecure + env.host 127.0.0.1 + env.port 5038 + env.timeout 5 + +=head1 REQUIRED PERL MODULES + +This plugin requires the Asterisk::AMI module and its dependencies. +Its dependencies can be found here: +http://deps.cpantesters.org/?module=Asterisk::AMI;perl=latest + + +=head1 AUTHOR + +Copyright (C) 2011 Frank DiGennaro + +=head1 LICENSE + +Gnu GPLv2 + +=begin comment + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; version 2 dated June, 1991. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, +USA. + +If you improve this script please send your version to my email +address with the copyright notice upgrade with your name. + +=end comment + +=head1 MAGIC MARKERS + + #%# family=contrib + +=cut + + use Carp; + use strict; + use Asterisk::AMI; + + eval "use Asterisk::AMI"; + print "Asterisk::AMI not found. Exiting...\n" if $@; + exit( 0 ) if $@; + + if ( $ARGV[ 0 ] and $ARGV[ 0 ] eq "config" ) { + print "graph_title Asterisk Fax - No Fax\n"; + print "graph_args --base 1000 -l 0\n"; + print "graph_vlabel Number of No Faxes\n"; + print "graph_category asterisk\n"; + print "nofax.draw AREA\n"; + print "nofax.label Number of No Faxes\n"; + exit 0; + }; + + my $host = exists $ENV{ 'host' } ? $ENV{ 'host' } : "127.0.0.1"; + my $port = exists $ENV{ 'port' } ? $ENV{ 'port' } : "5038"; + my $timeout = exists $ENV{ 'timeout' } ? $ENV{ 'timeout' } : "5"; + my $username = $ENV{ 'username' }; + my $secret = $ENV{ 'secret' }; + + my $astman = Asterisk::AMI->new(PeerAddr => "$host", + PeerPort => "$port", + Username => "$username", + Secret => "$secret" + ); + + croak "Unable to connect to asterisk" unless ( $astman ); + my $actionid = $astman->send_action({ Action => 'Command', + Command => 'fax show stats', + $timeout}); + my $response = $astman->get_response( $actionid ); + my $arrayref = $response->{CMD}; + my $null = qq{}; + my ( %faxstats, $section ); + foreach my $line ( @$arrayref ) { + next if ( ( ! $line ) || ( $line =~ /-----------/ ) ); + my ( $key, $value ) = split( ':', $line ); + $section = $key if ( $value eq $null ); + $key =~ s/\s+$//g; + $value =~ s/^\s+//g; + $faxstats{ "$section" }{ "$key" } = $value if ( $value ne $null ); + }; + $astman->disconnect; + + my $nofax = $faxstats{'Digium G.711'}{'No FAX'}; + print "nofax.value $nofax\n"; + + exit( 0 ); + + + diff --git a/plugins/asterisk/asterisk_14_fax_ffa/asterisk_fax_partial b/plugins/asterisk/asterisk_14_fax_ffa/asterisk_fax_partial new file mode 100755 index 00000000..faa7bab1 --- /dev/null +++ b/plugins/asterisk/asterisk_14_fax_ffa/asterisk_fax_partial @@ -0,0 +1,131 @@ +#!/usr/bin/perl + +=head1 NAME + +asterisk_fax_* - Plugin to monitor Asterisk fax parameters. + +=head1 SUPPORTED VERSION + +This plugin supports Asterisk 1.4.* and Digiums Fax For Asterisk (FFA) modules. + +=head1 CONFIGURATION + +The following configuration parameters are used by this plugin + + [asterisk*] + env.host - hostname to connect to. Defaults to localhost. + env.port - port number to connect to. Defaults to 5038. + env.username - username used for authentication. No default value. + env.secret - secret used for authentication. No default value. + env.timeout - AMI timeout value in seconds. Defaults to 5. + +The "username" and "secret" parameters are mandatory, and have no +defaults. + +=head1 DEFAULT CONFIGURATION + + [asterisk*] + env.username manager + env.secret insecure + env.host 127.0.0.1 + env.port 5038 + env.timeout 5 + +=head1 REQUIRED PERL MODULES + +This plugin requires the Asterisk::AMI module and its dependencies. +Its dependencies can be found here: +http://deps.cpantesters.org/?module=Asterisk::AMI;perl=latest + + +=head1 AUTHOR + +Copyright (C) 2011 Frank DiGennaro + +=head1 LICENSE + +Gnu GPLv2 + +=begin comment + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; version 2 dated June, 1991. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, +USA. + +If you improve this script please send your version to my email +address with the copyright notice upgrade with your name. + +=end comment + +=head1 MAGIC MARKERS + + #%# family=contrib + +=cut + + use Carp; + use strict; + use Asterisk::AMI; + + eval "use Asterisk::AMI"; + print "Asterisk::AMI not found. Exiting...\n" if $@; + exit( 0 ) if $@; + + + if ( $ARGV[ 0 ] and $ARGV[ 0 ] eq "config" ) { + print "graph_title Asterisk Fax - Partial Faxes\n"; + print "graph_args --base 1000 -l 0\n"; + print "graph_vlabel Number of Partial Faxes\n"; + print "graph_category asterisk\n"; + print "partial.draw AREA\n"; + print "partial.label Partial Faxes\n"; + exit 0; + }; + + my $host = exists $ENV{ 'host' } ? $ENV{ 'host' } : "127.0.0.1"; + my $port = exists $ENV{ 'port' } ? $ENV{ 'port' } : "5038"; + my $timeout = exists $ENV{ 'timeout' } ? $ENV{ 'timeout' } : "5"; + my $username = $ENV{ 'username' }; + my $secret = $ENV{ 'secret' }; + + my $astman = Asterisk::AMI->new(PeerAddr => "$host", + PeerPort => "$port", + Username => "$username", + Secret => "$secret" + ); + + croak "Unable to connect to asterisk" unless ( $astman ); + my $actionid = $astman->send_action({ Action => 'Command', + Command => 'fax show stats', + $timeout}); + my $response = $astman->get_response( $actionid ); + my $arrayref = $response->{CMD}; + my $null = qq{}; + my ( %faxstats, $section ); + foreach my $line ( @$arrayref ) { + next if ( ( ! $line ) || ( $line =~ /-----------/ ) ); + my ( $key, $value ) = split( ':', $line ); + $section = $key if ( $value eq $null ); + $key =~ s/\s+$//g; + $value =~ s/^\s+//g; + $faxstats{ "$section" }{ "$key" } = $value if ( $value ne $null ); + }; + $astman->disconnect; + + my $partial = $faxstats{'Digium G.711'}{'Partial'}; + print "partial.value $partial\n"; + + exit( 0 ); + + + diff --git a/plugins/asterisk/asterisk_14_fax_ffa/asterisk_fax_protocol_error b/plugins/asterisk/asterisk_14_fax_ffa/asterisk_fax_protocol_error new file mode 100755 index 00000000..a18f8bf0 --- /dev/null +++ b/plugins/asterisk/asterisk_14_fax_ffa/asterisk_fax_protocol_error @@ -0,0 +1,131 @@ +#!/usr/bin/perl + +=head1 NAME + +asterisk_fax_* - Plugin to monitor Asterisk fax parameters. + +=head1 SUPPORTED VERSION + +This plugin supports Asterisk 1.4.* and Digiums Fax For Asterisk (FFA) modules. + +=head1 CONFIGURATION + +The following configuration parameters are used by this plugin + + [asterisk*] + env.host - hostname to connect to. Defaults to localhost. + env.port - port number to connect to. Defaults to 5038. + env.username - username used for authentication. No default value. + env.secret - secret used for authentication. No default value. + env.timeout - AMI timeout value in seconds. Defaults to 5. + +The "username" and "secret" parameters are mandatory, and have no +defaults. + +=head1 DEFAULT CONFIGURATION + + [asterisk*] + env.username manager + env.secret insecure + env.host 127.0.0.1 + env.port 5038 + env.timeout 5 + +=head1 REQUIRED PERL MODULES + +This plugin requires the Asterisk::AMI module and its dependencies. +Its dependencies can be found here: +http://deps.cpantesters.org/?module=Asterisk::AMI;perl=latest + + +=head1 AUTHOR + +Copyright (C) 2011 Frank DiGennaro + +=head1 LICENSE + +Gnu GPLv2 + +=begin comment + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; version 2 dated June, 1991. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, +USA. + +If you improve this script please send your version to my email +address with the copyright notice upgrade with your name. + +=end comment + +=head1 MAGIC MARKERS + + #%# family=contrib + +=cut + + use Carp; + use strict; + use Asterisk::AMI; + + eval "use Asterisk::AMI"; + print "Asterisk::AMI not found. Exiting...\n" if $@; + exit( 0 ) if $@; + + + if ( $ARGV[ 0 ] and $ARGV[ 0 ] eq "config" ) { + print "graph_title Asterisk Fax - Protocol Error\n"; + print "graph_args --base 1000 -l 0\n"; + print "graph_vlabel Number of Protocol Errors\n"; + print "graph_category asterisk\n"; + print "proterror.draw AREA\n"; + print "proterror.label Protocol Errors\n"; + exit 0; + }; + + my $host = exists $ENV{ 'host' } ? $ENV{ 'host' } : "127.0.0.1"; + my $port = exists $ENV{ 'port' } ? $ENV{ 'port' } : "5038"; + my $timeout = exists $ENV{ 'timeout' } ? $ENV{ 'timeout' } : "5"; + my $username = $ENV{ 'username' }; + my $secret = $ENV{ 'secret' }; + + my $astman = Asterisk::AMI->new(PeerAddr => "$host", + PeerPort => "$port", + Username => "$username", + Secret => "$secret" + ); + + croak "Unable to connect to asterisk" unless ( $astman ); + my $actionid = $astman->send_action({ Action => 'Command', + Command => 'fax show stats', + $timeout}); + my $response = $astman->get_response( $actionid ); + my $arrayref = $response->{CMD}; + my $null = qq{}; + my ( %faxstats, $section ); + foreach my $line ( @$arrayref ) { + next if ( ( ! $line ) || ( $line =~ /-----------/ ) ); + my ( $key, $value ) = split( ':', $line ); + $section = $key if ( $value eq $null ); + $key =~ s/\s+$//g; + $value =~ s/^\s+//g; + $faxstats{ "$section" }{ "$key" } = $value if ( $value ne $null ); + }; + $astman->disconnect; + + my $proterror = $faxstats{'Digium G.711'}{'Protocol Error'}; + print "proterror.value $proterror\n"; + + exit( 0 ); + + + diff --git a/plugins/asterisk/asterisk_14_fax_ffa/asterisk_fax_success b/plugins/asterisk/asterisk_14_fax_ffa/asterisk_fax_success new file mode 100755 index 00000000..b10476ab --- /dev/null +++ b/plugins/asterisk/asterisk_14_fax_ffa/asterisk_fax_success @@ -0,0 +1,129 @@ +#!/usr/bin/perl + +=head1 NAME + +asterisk_fax_* - Plugin to monitor Asterisk fax parameters. + +=head1 SUPPORTED VERSION + +This plugin supports Asterisk 1.4.* and Digiums Fax For Asterisk (FFA) modules. + +=head1 CONFIGURATION + +The following configuration parameters are used by this plugin + + [asterisk*] + env.host - hostname to connect to. Defaults to localhost. + env.port - port number to connect to. Defaults to 5038. + env.username - username used for authentication. No default value. + env.secret - secret used for authentication. No default value. + env.timeout - AMI timeout value in seconds. Defaults to 5. + +The "username" and "secret" parameters are mandatory, and have no +defaults. + +=head1 DEFAULT CONFIGURATION + + [asterisk*] + env.username manager + env.secret insecure + env.host 127.0.0.1 + env.port 5038 + env.timeout 5 + +=head1 REQUIRED PERL MODULES + +This plugin requires the Asterisk::AMI module and its dependencies. +Its dependencies can be found here: +http://deps.cpantesters.org/?module=Asterisk::AMI;perl=latest + + +=head1 AUTHOR + +Copyright (C) 2011 Frank DiGennaro + +=head1 LICENSE + +Gnu GPLv2 + +=begin comment + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; version 2 dated June, 1991. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, +USA. + +If you improve this script please send your version to my email +address with the copyright notice upgrade with your name. + +=end comment + +=head1 MAGIC MARKERS + + #%# family=contrib + +=cut + + use Carp; + use strict; + use Asterisk::AMI; + + eval "use Asterisk::AMI"; + print "Asterisk::AMI not found. Exiting...\n" if $@; + exit( 0 ) if $@; + + if ( $ARGV[ 0 ] and $ARGV[ 0 ] eq "config" ) { + print "graph_title Asterisk Fax - Successful Tx\n"; + print "graph_args --base 1000 -l 0\n"; + print "graph_vlabel Successful Tx's\n"; + print "graph_category asterisk\n"; + print "success.draw AREA\n"; + print "success.label successful tx\n"; + exit 0; + }; + + my $host = exists $ENV{ 'host' } ? $ENV{ 'host' } : "127.0.0.1"; + my $port = exists $ENV{ 'port' } ? $ENV{ 'port' } : "5038"; + my $timeout = exists $ENV{ 'timeout' } ? $ENV{ 'timeout' } : "5"; + my $username = $ENV{ 'username' }; + my $secret = $ENV{ 'secret' }; + + my $astman = Asterisk::AMI->new(PeerAddr => "$host", + PeerPort => "$port", + Username => "$username", + Secret => "$secret" + ); + + croak "Unable to connect to asterisk" unless ( $astman ); + my $actionid = $astman->send_action({ Action => 'Command', + Command => 'fax show stats', + $timeout}); + my $response = $astman->get_response( $actionid ); + my $arrayref = $response->{CMD}; + my $null = qq{}; + my ( %faxstats, $section ); + foreach my $line ( @$arrayref ) { + next if ( ( ! $line ) || ( $line =~ /-----------/ ) ); + my ( $key, $value ) = split( ':', $line ); + $section = $key if ( $value eq $null ); + $key =~ s/\s+$//g; + $value =~ s/^\s+//g; + $faxstats{ "$section" }{ "$key" } = $value if ( $value ne $null ); + }; + $astman->disconnect; + + my $success = $faxstats{'Digium G.711'}{'Success'}; + print "success.value $success\n"; + + exit( 0 ); + + diff --git a/plugins/asterisk/asterisk_14_fax_ffa/asterisk_fax_switched2t38 b/plugins/asterisk/asterisk_14_fax_ffa/asterisk_fax_switched2t38 new file mode 100755 index 00000000..46f310d8 --- /dev/null +++ b/plugins/asterisk/asterisk_14_fax_ffa/asterisk_fax_switched2t38 @@ -0,0 +1,130 @@ +#!/usr/bin/perl + +=head1 NAME + +asterisk_fax_* - Plugin to monitor Asterisk fax parameters. + +=head1 SUPPORTED VERSION + +This plugin supports Asterisk 1.4.* and Digiums Fax For Asterisk (FFA) modules. + +=head1 CONFIGURATION + +The following configuration parameters are used by this plugin + + [asterisk*] + env.host - hostname to connect to. Defaults to localhost. + env.port - port number to connect to. Defaults to 5038. + env.username - username used for authentication. No default value. + env.secret - secret used for authentication. No default value. + env.timeout - AMI timeout value in seconds. Defaults to 5. + +The "username" and "secret" parameters are mandatory, and have no +defaults. + +=head1 DEFAULT CONFIGURATION + + [asterisk*] + env.username manager + env.secret insecure + env.host 127.0.0.1 + env.port 5038 + env.timeout 5 + +=head1 REQUIRED PERL MODULES + +This plugin requires the Asterisk::AMI module and its dependencies. +Its dependencies can be found here: +http://deps.cpantesters.org/?module=Asterisk::AMI;perl=latest + + +=head1 AUTHOR + +Copyright (C) 2011 Frank DiGennaro + +=head1 LICENSE + +Gnu GPLv2 + +=begin comment + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; version 2 dated June, 1991. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, +USA. + +If you improve this script please send your version to my email +address with the copyright notice upgrade with your name. + +=end comment + +=head1 MAGIC MARKERS + + #%# family=contrib + +=cut + + use Carp; + use strict; + use Asterisk::AMI; + + eval "use Asterisk::AMI"; + print "Asterisk::AMI not found. Exiting...\n" if $@; + exit( 0 ) if $@; + + if ( $ARGV[ 0 ] and $ARGV[ 0 ] eq "config" ) { + print "graph_title Asterisk Fax - Switched to T.38\n"; + print "graph_args --base 1000 -l 0\n"; + print "graph_vlabel Number of Switches to T.38\n"; + print "graph_category asterisk\n"; + print "switched.draw AREA\n"; + print "switched.label Switches to T.38\n"; + exit 0; + }; + + my $host = exists $ENV{ 'host' } ? $ENV{ 'host' } : "127.0.0.1"; + my $port = exists $ENV{ 'port' } ? $ENV{ 'port' } : "5038"; + my $timeout = exists $ENV{ 'timeout' } ? $ENV{ 'timeout' } : "5"; + my $username = $ENV{ 'username' }; + my $secret = $ENV{ 'secret' }; + + my $astman = Asterisk::AMI->new(PeerAddr => "$host", + PeerPort => "$port", + Username => "$username", + Secret => "$secret" + ); + + croak "Unable to connect to asterisk" unless ( $astman ); + my $actionid = $astman->send_action({ Action => 'Command', + Command => 'fax show stats', + $timeout}); + my $response = $astman->get_response( $actionid ); + my $arrayref = $response->{CMD}; + my $null = qq{}; + my ( %faxstats, $section ); + foreach my $line ( @$arrayref ) { + next if ( ( ! $line ) || ( $line =~ /-----------/ ) ); + my ( $key, $value ) = split( ':', $line ); + $section = $key if ( $value eq $null ); + $key =~ s/\s+$//g; + $value =~ s/^\s+//g; + $faxstats{ "$section" }{ "$key" } = $value if ( $value ne $null ); + }; + $astman->disconnect; + + my $switched = $faxstats{'Digium G.711'}{'Switched to T.38'}; + print "switched.value $switched\n"; + + exit( 0 ); + + + diff --git a/plugins/asterisk/asterisk_14_fax_ffa/asterisk_fax_train_failure b/plugins/asterisk/asterisk_14_fax_ffa/asterisk_fax_train_failure new file mode 100755 index 00000000..bddfd350 --- /dev/null +++ b/plugins/asterisk/asterisk_14_fax_ffa/asterisk_fax_train_failure @@ -0,0 +1,130 @@ +#!/usr/bin/perl + +=head1 NAME + +asterisk_fax_* - Plugin to monitor Asterisk fax parameters. + +=head1 SUPPORTED VERSION + +This plugin supports Asterisk 1.4.* and Digiums Fax For Asterisk (FFA) modules. + +=head1 CONFIGURATION + +The following configuration parameters are used by this plugin + + [asterisk*] + env.host - hostname to connect to. Defaults to localhost. + env.port - port number to connect to. Defaults to 5038. + env.username - username used for authentication. No default value. + env.secret - secret used for authentication. No default value. + env.timeout - AMI timeout value in seconds. Defaults to 5. + +The "username" and "secret" parameters are mandatory, and have no +defaults. + +=head1 DEFAULT CONFIGURATION + + [asterisk*] + env.username manager + env.secret insecure + env.host 127.0.0.1 + env.port 5038 + env.timeout 5 + +=head1 REQUIRED PERL MODULES + +This plugin requires the Asterisk::AMI module and its dependencies. +Its dependencies can be found here: +http://deps.cpantesters.org/?module=Asterisk::AMI;perl=latest + + +=head1 AUTHOR + +Copyright (C) 2011 Frank DiGennaro + +=head1 LICENSE + +Gnu GPLv2 + +=begin comment + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; version 2 dated June, 1991. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, +USA. + +If you improve this script please send your version to my email +address with the copyright notice upgrade with your name. + +=end comment + +=head1 MAGIC MARKERS + + #%# family=contrib + +=cut + + use Carp; + use strict; + use Asterisk::AMI; + + eval "use Asterisk::AMI"; + print "Asterisk::AMI not found. Exiting...\n" if $@; + exit( 0 ) if $@; + + if ( $ARGV[ 0 ] and $ARGV[ 0 ] eq "config" ) { + print "graph_title Asterisk Fax - Train Failure\n"; + print "graph_args --base 1000 -l 0\n"; + print "graph_vlabel Number of Train Failures\n"; + print "graph_category asterisk\n"; + print "failure.draw AREA\n"; + print "failure.label Train Failures\n"; + exit 0; + }; + + my $host = exists $ENV{ 'host' } ? $ENV{ 'host' } : "127.0.0.1"; + my $port = exists $ENV{ 'port' } ? $ENV{ 'port' } : "5038"; + my $timeout = exists $ENV{ 'timeout' } ? $ENV{ 'timeout' } : "5"; + my $username = $ENV{ 'username' }; + my $secret = $ENV{ 'secret' }; + + my $astman = Asterisk::AMI->new(PeerAddr => "$host", + PeerPort => "$port", + Username => "$username", + Secret => "$secret" + ); + + croak "Unable to connect to asterisk" unless ( $astman ); + my $actionid = $astman->send_action({ Action => 'Command', + Command => 'fax show stats', + $timeout}); + my $response = $astman->get_response( $actionid ); + my $arrayref = $response->{CMD}; + my $null = qq{}; + my ( %faxstats, $section ); + foreach my $line ( @$arrayref ) { + next if ( ( ! $line ) || ( $line =~ /-----------/ ) ); + my ( $key, $value ) = split( ':', $line ); + $section = $key if ( $value eq $null ); + $key =~ s/\s+$//g; + $value =~ s/^\s+//g; + $faxstats{ "$section" }{ "$key" } = $value if ( $value ne $null ); + }; + $astman->disconnect; + + my $failure = $faxstats{'Digium G.711'}{'Train Failure'}; + print "failure.value $failure\n"; + + exit( 0 ); + + + diff --git a/plugins/asterisk/asterisk_14_fax_ffa/asterisk_fax_txrx_attempts b/plugins/asterisk/asterisk_14_fax_ffa/asterisk_fax_txrx_attempts new file mode 100755 index 00000000..2bd6ddf2 --- /dev/null +++ b/plugins/asterisk/asterisk_14_fax_ffa/asterisk_fax_txrx_attempts @@ -0,0 +1,134 @@ +#!/usr/bin/perl + +=head1 NAME + +asterisk_fax_* - Plugin to monitor Asterisk fax parameters. + +=head1 SUPPORTED VERSION + +This plugin supports Asterisk 1.4.* and Digiums Fax For Asterisk (FFA) modules. + +=head1 CONFIGURATION + +The following configuration parameters are used by this plugin + + [asterisk*] + env.host - hostname to connect to. Defaults to localhost. + env.port - port number to connect to. Defaults to 5038. + env.username - username used for authentication. No default value. + env.secret - secret used for authentication. No default value. + env.timeout - AMI timeout value in seconds. Defaults to 5. + +The "username" and "secret" parameters are mandatory, and have no +defaults. + +=head1 DEFAULT CONFIGURATION + + [asterisk*] + env.username manager + env.secret insecure + env.host 127.0.0.1 + env.port 5038 + env.timeout 5 + +=head1 REQUIRED PERL MODULES + +This plugin requires the Asterisk::AMI module and its dependencies. +Its dependencies can be found here: +http://deps.cpantesters.org/?module=Asterisk::AMI;perl=latest + + +=head1 AUTHOR + +Copyright (C) 2011 Frank DiGennaro + +=head1 LICENSE + +Gnu GPLv2 + +=begin comment + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; version 2 dated June, 1991. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, +USA. + +If you improve this script please send your version to my email +address with the copyright notice upgrade with your name. + +=end comment + +=head1 MAGIC MARKERS + + #%# family=contrib + +=cut + + use Carp; + use strict; + use Asterisk::AMI; + + eval "use Asterisk::AMI"; + print "Asterisk::AMI not found. Exiting...\n" if $@; + exit( 0 ) if $@; + + if ( $ARGV[ 0 ] and $ARGV[ 0 ] eq "config" ) { + print "graph_title Asterisk Fax - Tx/Rx Attempts\n"; + print "graph_args --base 1000 -l 0\n"; + print "graph_vlabel Number of Tx and Rx Attempts\n"; + print "graph_category asterisk\n"; + print "transmit.draw AREA\n"; + print "transmit.label Tx Attempts\n"; + print "receive.draw AREA\n"; + print "receive.label Rx Attempts\n"; + exit 0; + }; + + my $host = exists $ENV{ 'host' } ? $ENV{ 'host' } : "127.0.0.1"; + my $port = exists $ENV{ 'port' } ? $ENV{ 'port' } : "5038"; + my $timeout = exists $ENV{ 'timeout' } ? $ENV{ 'timeout' } : "5"; + my $username = $ENV{ 'username' }; + my $secret = $ENV{ 'secret' }; + + my $astman = Asterisk::AMI->new(PeerAddr => "$host", + PeerPort => "$port", + Username => "$username", + Secret => "$secret" + ); + + croak "Unable to connect to asterisk" unless ( $astman ); + my $actionid = $astman->send_action({ Action => 'Command', + Command => 'fax show stats', + $timeout}); + my $response = $astman->get_response( $actionid ); + my $arrayref = $response->{CMD}; + my $null = qq{}; + my ( %faxstats, $section ); + foreach my $line ( @$arrayref ) { + next if ( ( ! $line ) || ( $line =~ /-----------/ ) ); + my ( $key, $value ) = split( ':', $line ); + $section = $key if ( $value eq $null ); + $key =~ s/\s+$//g; + $value =~ s/^\s+//g; + $faxstats{ "$section" }{ "$key" } = $value if ( $value ne $null ); + }; + $astman->disconnect; + + my $txstats = $faxstats{'FAX Statistics'}{'Transmit Attempts'}; + my $rxstats = $faxstats{'FAX Statistics'}{'Receive Attempts'}; + print "transmit.value $txstats\n"; + print "receive.value $rxstats\n"; + + exit( 0 ); + + + diff --git a/plugins/asterisk/asterisk_14_fax_ffa/can-install.pl b/plugins/asterisk/asterisk_14_fax_ffa/can-install.pl new file mode 100755 index 00000000..fb22b853 --- /dev/null +++ b/plugins/asterisk/asterisk_14_fax_ffa/can-install.pl @@ -0,0 +1,41 @@ +#!/usr/bin/perl + +# +# can-install.pl - Can we install this set of Munin plugins? +# + + use Carp; + use strict; + + # Step(1) - Is Asterisk installed? + my $system; + my $asterisk = `$system which asterisk`; + chomp( $asterisk ); + print "no - Cannot find program 'asterisk' \n" if !$asterisk; + exit( 0 ) if !$asterisk; + + # Step(2) - Are we running the correct version of Asterisk? + my $command = 'core show version'; + my $string = `$asterisk -rx \"$command\"`; + my @string = split( / /, "$string" ); + my $version = $string[ 1 ]; + my @vals = split( '\.', "$version" ); + my $short_version = $vals[ 0 ] . '.' . $vals[ 1 ]; + print "no - Running wrong version of Asterisk. Need 1.4\n" if $short_version ne '1.4'; + exit( 0 ) if $short_version ne '1.4'; + + # Are the Digium FFA modules installed? + my $command = 'module show like res_fax_digium.so'; + my $string = `$asterisk -rx \"$command\"`; + my @string = split( /\n/, "$string" ); + my @vals = split( / /, $string[ 2 ] ); + my $module = $vals[ 0 ]; + print "no - Digium FFA module not installed" if ! $module; + exit( 0 ) if ! $module; + + # Step(4) - Is Asterisk::AMI installed? + eval "use Asterisk::AMI"; + print "PERL module Asterisk::AMI not found. Exiting...\n" if $@; + exit( 0 ) if $@; + + print "yes\n"; diff --git a/plugins/asterisk/asterisk_14_fax_ffa/fax_show_stats.txt b/plugins/asterisk/asterisk_14_fax_ffa/fax_show_stats.txt new file mode 100644 index 00000000..a85a9ffe --- /dev/null +++ b/plugins/asterisk/asterisk_14_fax_ffa/fax_show_stats.txt @@ -0,0 +1,49 @@ + +######################################################################## +# For Asterisk 1.4 and FFA + +faxstats{FAX Statistics}{Transmit Attempts} = 0 +faxstats{FAX Statistics}{Receive Attempts} = 0 +faxstats{FAX Statistics}{Current Sessions} = 0 +faxstats{FAX Statistics}{Failed FAXes} = 0 +faxstats{FAX Statistics}{Completed FAXes} = 0 +faxstats{Digium G.711}{IO Partial} = 0 +faxstats{Digium G.711}{Switched to T.38} = 0 +faxstats{Digium G.711}{Negotiation Failed} = 0 +faxstats{Digium G.711}{Partial} = 0 +faxstats{Digium G.711}{No FAX} = 0 +faxstats{Digium G.711}{Protocol Error} = 0 +faxstats{Digium G.711}{Canceled} = 0 +faxstats{Digium G.711}{Train Failure} = 0 +faxstats{Digium G.711}{Licensed Channels} = 1 +faxstats{Digium G.711}{Max Concurrent} = 0 +faxstats{Digium G.711}{IO Fail} = 0 +faxstats{Digium G.711}{Success} = 0 + +pbx-75*CLI> fax show stats + +FAX Statistics: +--------------- + +Current Sessions : 0 +Transmit Attempts : 0 +Receive Attempts : 0 +Completed FAXes : 0 +Failed FAXes : 0 + +Digium G.711 +Licensed Channels : 1 +Max Concurrent : 0 +Success : 0 +Switched to T.38 : 0 +Canceled : 0 +No FAX : 0 +Partial : 0 +Negotiation Failed : 0 +Train Failure : 0 +Protocol Error : 0 +IO Partial : 0 +IO Fail : 0 + + + diff --git a/plugins/asterisk/asterisk_14_fax_ffa/fax_test b/plugins/asterisk/asterisk_14_fax_ffa/fax_test new file mode 100755 index 00000000..b67c9b05 --- /dev/null +++ b/plugins/asterisk/asterisk_14_fax_ffa/fax_test @@ -0,0 +1,42 @@ +#!/usr/bin/perl + + use Carp; + use strict; + use Asterisk::AMI; + do './get_fax_stats.pl'; + + my $ret = undef; + if ( ! eval "require Asterisk::AMI;" ) { + $ret = "Asterisk::AMI not found"; + }; + + if ( $ARGV[ 0 ] and $ARGV[ 0 ] eq "config" ) { + print "graph_title Asterisk active fax channels\n"; + print "graph_args --base 1000 -l 0\n"; + print "graph_vlabel channels\n"; + print "graph_category asterisk\n"; + print "channels.draw AREA\n"; + print "channels.label channels\n"; + exit 0; + }; + + #my $host = exists $ENV{ 'host' } ? $ENV{ 'host' } : "127.0.0.1"; + #my $port = exists $ENV{ 'port' } ? $ENV{ 'port' } : "5038"; + #my $username = $ENV{ 'username' }; + #my $secret = $ENV{ 'secret' }; + + our $username = 'manager'; + our $host = '127.0.0.1'; + our $port = '5038'; + our $secret = 'insecure'; + our $timeout = '5'; + + my %faxstats = get_fax_stats(); + + my $channels = $faxstats{'Digium G.711'}{'Licensed Channels'}; + print "channels.value $channels\n"; + + exit( 0 ); + + + diff --git a/plugins/asterisk/asterisk_14_fax_ffa/get_fax_stats.pl b/plugins/asterisk/asterisk_14_fax_ffa/get_fax_stats.pl new file mode 100755 index 00000000..cbfa36c4 --- /dev/null +++ b/plugins/asterisk/asterisk_14_fax_ffa/get_fax_stats.pl @@ -0,0 +1,35 @@ + + + + sub get_fax_stats { + + my $astman = Asterisk::AMI->new(PeerAddr => "$host", + PeerPort => "$port", + Username => "$username", + Secret => "$secret" + ); + + croak "Unable to connect to asterisk" unless ( $astman ); + my $actionid = $astman->send_action({ Action => 'Command', + Command => 'fax show stats', + $amiparams{ timeout } }); + my $response = $astman->get_response( $actionid ); + my $arrayref = $response->{CMD}; + my @array = @$arrayref; + my $null = qq{}; + my ( %faxstats, $section); + foreach my $line ( @array ) { + next if ( ( ! $line ) || ( $line =~ /-----------/ ) ); + my ( $key, $value ) = split( ':', $line ); + $section = $key if ( $value eq $null ); + $key =~ s/\s+$//g; + $value =~ s/^\s+//g; + #$faxstats{ "$key" } = $value if ( $value ne $null ); + $faxstats{ "$section" }{ "$key" } = $value if ( $value ne $null ); + }; + $astman->disconnect; + + return( %faxstats ); + + }; + diff --git a/plugins/asterisk/asterisk_16_fax_ffa/asterisk_fax_cancelled b/plugins/asterisk/asterisk_16_fax_ffa/asterisk_fax_cancelled new file mode 100755 index 00000000..61dbac09 --- /dev/null +++ b/plugins/asterisk/asterisk_16_fax_ffa/asterisk_fax_cancelled @@ -0,0 +1,132 @@ +#!/usr/bin/perl + +=head1 NAME + +asterisk_fax_* - Plugin to monitor Asterisk fax parameters. + +=head1 SUPPORTED VERSION + +This plugin supports Asterisk 1.6.* and Digiums Fax For Asterisk (FFA) modules. + +=head1 CONFIGURATION + +The following configuration parameters are used by this plugin + + [asterisk*] + env.host - hostname to connect to. Defaults to localhost. + env.port - port number to connect to. Defaults to 5038. + env.username - username used for authentication. No default value. + env.secret - secret used for authentication. No default value. + env.timeout - AMI timeout value in seconds. Defaults to 5. + +The "username" and "secret" parameters are mandatory, and have no +defaults. + +=head1 DEFAULT CONFIGURATION + + [asterisk*] + env.username manager + env.secret insecure + env.host 127.0.0.1 + env.port 5038 + env.timeout 5 + +=head1 REQUIRED PERL MODULES + +This plugin requires the Asterisk::AMI module and its dependencies. +Its dependencies can be found here: +http://deps.cpantesters.org/?module=Asterisk::AMI;perl=latest + + +=head1 AUTHOR + +Copyright (C) 2011 Frank DiGennaro + +=head1 LICENSE + +Gnu GPLv2 + +=begin comment + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; version 2 dated June, 1991. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, +USA. + +If you improve this script please send your version to my email +address with the copyright notice upgrade with your name. + +=end comment + +=head1 MAGIC MARKERS + + #%# family=contrib + +=cut + + use Carp; + use strict; + use Asterisk::AMI; + + eval "use Asterisk::AMI"; + print "Asterisk::AMI not found. Exiting...\n" if $@; + exit( 0 ) if $@; + + if ( $ARGV[ 0 ] and $ARGV[ 0 ] eq "config" ) { + print "graph_title Asterisk Fax - Cancelled Faxes (T.38 and G.711)\n"; + print "graph_args --base 1000 -l 0\n"; + print "graph_vlabel Number of Cancelled Faxes\n"; + print "graph_category asterisk\n"; + print "t38_cancelled.draw AREA\n"; + print "t38_cancelled.label Cancelled T.38 Faxes\n"; + print "g711_cancelled.draw AREA\n"; + print "g711_cancelled.label Cancelled G.711 Faxes\n"; + exit ( 0 ); + }; + + my $host = exists $ENV{ 'host' } ? $ENV{ 'host' } : "127.0.0.1"; + my $port = exists $ENV{ 'port' } ? $ENV{ 'port' } : "5038"; + my $timeout = exists $ENV{ 'timeout' } ? $ENV{ 'timeout' } : "5"; + my $username = $ENV{ 'username' }; + my $secret = $ENV{ 'secret' }; + + my $astman = Asterisk::AMI->new(PeerAddr => "$host", + PeerPort => "$port", + Username => "$username", + Secret => "$secret" + ); + + croak "Unable to connect to asterisk" unless ( $astman ); + my $actionid = $astman->send_action({ Action => 'Command', + Command => 'fax show stats', + $timeout}); + my $response = $astman->get_response( $actionid ); + my $arrayref = $response->{CMD}; + my $null = qq{}; + my ( %faxstats, $section ); + foreach my $line ( @$arrayref ) { + next if ( ( ! $line ) || ( $line =~ /-----------/ ) ); + my ( $key, $value ) = split( ':', $line ); + $section = $key if ( $value eq $null ); + $key =~ s/\s+$//g; + $value =~ s/^\s+//g; + $faxstats{ "$section" }{ "$key" } = $value if ( $value ne $null ); + }; + $astman->disconnect; + + print "t38_cancelled.value $faxstats{'Digium T.38'}{'Canceled'}\n"; + print "g711_cancelled.value $faxstats{'Digium G.711'}{'Canceled'}\n"; + + exit( 0 ); + + + diff --git a/plugins/asterisk/asterisk_16_fax_ffa/asterisk_fax_channels b/plugins/asterisk/asterisk_16_fax_ffa/asterisk_fax_channels new file mode 100755 index 00000000..8f02a5e3 --- /dev/null +++ b/plugins/asterisk/asterisk_16_fax_ffa/asterisk_fax_channels @@ -0,0 +1,130 @@ +#!/usr/bin/perl + +=head1 NAME + +asterisk_fax_* - Plugin to monitor Asterisk fax parameters. + +=head1 SUPPORTED VERSION + +This plugin supports Asterisk 1.6.* and Digiums Fax For Asterisk (FFA) modules. + +=head1 CONFIGURATION + +The following configuration parameters are used by this plugin + + [asterisk*] + env.host - hostname to connect to. Defaults to localhost. + env.port - port number to connect to. Defaults to 5038. + env.username - username used for authentication. No default value. + env.secret - secret used for authentication. No default value. + env.timeout - AMI timeout value in seconds. Defaults to 5. + +The "username" and "secret" parameters are mandatory, and have no +defaults. + +=head1 DEFAULT CONFIGURATION + + [asterisk*] + env.username manager + env.secret insecure + env.host 127.0.0.1 + env.port 5038 + env.timeout 5 + +=head1 REQUIRED PERL MODULES + +This plugin requires the Asterisk::AMI module and its dependencies. +Its dependencies can be found here: +http://deps.cpantesters.org/?module=Asterisk::AMI;perl=latest + + +=head1 AUTHOR + +Copyright (C) 2011 Frank DiGennaro + +=head1 LICENSE + +Gnu GPLv2 + +=begin comment + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; version 2 dated June, 1991. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, +USA. + +If you improve this script please send your version to my email +address with the copyright notice upgrade with your name. + +=end comment + +=head1 MAGIC MARKERS + + #%# family=contrib + +=cut + + use Carp; + use strict; + use Asterisk::AMI; + + eval "use Asterisk::AMI"; + print "Asterisk::AMI not found. Exiting...\n" if $@; + exit( 0 ) if $@; + + if ( $ARGV[ 0 ] and $ARGV[ 0 ] eq "config" ) { + print "graph_title Asterisk Fax - Licensed Channels\n"; + print "graph_args --base 1000 -l 0\n"; + print "graph_vlabel channels\n"; + print "graph_category asterisk\n"; + print "channels.draw AREA\n"; + print "channels.label channels\n"; + exit 0; + }; + + my $host = exists $ENV{ 'host' } ? $ENV{ 'host' } : "127.0.0.1"; + my $port = exists $ENV{ 'port' } ? $ENV{ 'port' } : "5038"; + my $timeout = exists $ENV{ 'timeout' } ? $ENV{ 'timeout' } : "5"; + my $username = $ENV{ 'username' }; + my $secret = $ENV{ 'secret' }; + + my $astman = Asterisk::AMI->new(PeerAddr => "$host", + PeerPort => "$port", + Username => "$username", + Secret => "$secret" + ); + + croak "Unable to connect to asterisk" unless ( $astman ); + my $actionid = $astman->send_action({ Action => 'Command', + Command => 'fax show stats', + $timeout}); + my $response = $astman->get_response( $actionid ); + my $arrayref = $response->{CMD}; + my $null = qq{}; + my ( %faxstats, $section); + foreach my $line ( @$arrayref ) { + next if ( ( ! $line ) || ( $line =~ /-----------/ ) ); + my ( $key, $value ) = split( ':', $line ); + $section = $key if ( $value eq $null ); + $key =~ s/\s+$//g; + $value =~ s/^\s+//g; + $faxstats{ "$section" }{ "$key" } = $value if ( $value ne $null ); + }; + $astman->disconnect; + + my $channels = $faxstats{'T.38'}{'Licensed Channels'}; + print "channels.value $channels\n"; + + exit( 0 ); + + + diff --git a/plugins/asterisk/asterisk_16_fax_ffa/asterisk_fax_current_sessions b/plugins/asterisk/asterisk_16_fax_ffa/asterisk_fax_current_sessions new file mode 100755 index 00000000..329c4061 --- /dev/null +++ b/plugins/asterisk/asterisk_16_fax_ffa/asterisk_fax_current_sessions @@ -0,0 +1,129 @@ +#!/usr/bin/perl + +=head1 NAME + +asterisk_fax_* - Plugin to monitor Asterisk fax parameters. + +=head1 SUPPORTED VERSION + +This plugin supports Asterisk 1.6.* and Digiums Fax For Asterisk (FFA) modules. + +=head1 CONFIGURATION + +The following configuration parameters are used by this plugin + + [asterisk*] + env.host - hostname to connect to. Defaults to localhost. + env.port - port number to connect to. Defaults to 5038. + env.username - username used for authentication. No default value. + env.secret - secret used for authentication. No default value. + env.timeout - AMI timeout value in seconds. Defaults to 5. + +The "username" and "secret" parameters are mandatory, and have no +defaults. + +=head1 DEFAULT CONFIGURATION + + [asterisk*] + env.username manager + env.secret insecure + env.host 127.0.0.1 + env.port 5038 + env.timeout 5 + +=head1 REQUIRED PERL MODULES + +This plugin requires the Asterisk::AMI module and its dependencies. +Its dependencies can be found here: +http://deps.cpantesters.org/?module=Asterisk::AMI;perl=latest + + +=head1 AUTHOR + +Copyright (C) 2011 Frank DiGennaro + +=head1 LICENSE + +Gnu GPLv2 + +=begin comment + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; version 2 dated June, 1991. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, +USA. + +If you improve this script please send your version to my email +address with the copyright notice upgrade with your name. + +=end comment + +=head1 MAGIC MARKERS + + #%# family=contrib + +=cut + + use Carp; + use strict; + use Asterisk::AMI; + + eval "use Asterisk::AMI"; + print "Asterisk::AMI not found. Exiting...\n" if $@; + exit( 0 ) if $@; + + if ( $ARGV[ 0 ] and $ARGV[ 0 ] eq "config" ) { + print "graph_title Asterisk Fax - Current Sessions\n"; + print "graph_args --base 1000 -l 0\n"; + print "graph_vlabel Current Sessions\n"; + print "graph_category asterisk\n"; + print "sessions.draw AREA\n"; + print "sessions.label Current Sessions\n"; + exit 0; + }; + + my $host = exists $ENV{ 'host' } ? $ENV{ 'host' } : "127.0.0.1"; + my $port = exists $ENV{ 'port' } ? $ENV{ 'port' } : "5038"; + my $timeout = exists $ENV{ 'timeout' } ? $ENV{ 'timeout' } : "5"; + my $username = $ENV{ 'username' }; + my $secret = $ENV{ 'secret' }; + + my $astman = Asterisk::AMI->new(PeerAddr => "$host", + PeerPort => "$port", + Username => "$username", + Secret => "$secret" + ); + + croak "Unable to connect to asterisk" unless ( $astman ); + my $actionid = $astman->send_action({ Action => 'Command', + Command => 'fax show stats', + $timeout}); + my $response = $astman->get_response( $actionid ); + my $arrayref = $response->{CMD}; + my $null = qq{}; + my ( %faxstats, $section ); + foreach my $line ( @$arrayref ) { + next if ( ( ! $line ) || ( $line =~ /-----------/ ) ); + my ( $key, $value ) = split( ':', $line ); + $section = $key if ( $value eq $null ); + $key =~ s/\s+$//g; + $value =~ s/^\s+//g; + $faxstats{ "$section" }{ "$key" } = $value if ( $value ne $null ); + }; + $astman->disconnect; + + my $sessions = $faxstats{'FAX Statistics'}{'Current Sessions'}; + print "sessions.value $sessions\n"; + + exit( 0 ); + + diff --git a/plugins/asterisk/asterisk_16_fax_ffa/asterisk_fax_failed_completed b/plugins/asterisk/asterisk_16_fax_ffa/asterisk_fax_failed_completed new file mode 100755 index 00000000..af579e65 --- /dev/null +++ b/plugins/asterisk/asterisk_16_fax_ffa/asterisk_fax_failed_completed @@ -0,0 +1,134 @@ +#!/usr/bin/perl + +=head1 NAME + +asterisk_fax_* - Plugin to monitor Asterisk fax parameters. + +=head1 SUPPORTED VERSION + +This plugin supports Asterisk 1.6.* and Digiums Fax For Asterisk (FFA) modules. + +=head1 CONFIGURATION + +The following configuration parameters are used by this plugin + + [asterisk*] + env.host - hostname to connect to. Defaults to localhost. + env.port - port number to connect to. Defaults to 5038. + env.username - username used for authentication. No default value. + env.secret - secret used for authentication. No default value. + env.timeout - AMI timeout value in seconds. Defaults to 5. + +The "username" and "secret" parameters are mandatory, and have no +defaults. + +=head1 DEFAULT CONFIGURATION + + [asterisk*] + env.username manager + env.secret insecure + env.host 127.0.0.1 + env.port 5038 + env.timeout 5 + +=head1 REQUIRED PERL MODULES + +This plugin requires the Asterisk::AMI module and its dependencies. +Its dependencies can be found here: +http://deps.cpantesters.org/?module=Asterisk::AMI;perl=latest + + +=head1 AUTHOR + +Copyright (C) 2011 Frank DiGennaro + +=head1 LICENSE + +Gnu GPLv2 + +=begin comment + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; version 2 dated June, 1991. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, +USA. + +If you improve this script please send your version to my email +address with the copyright notice upgrade with your name. + +=end comment + +=head1 MAGIC MARKERS + + #%# family=contrib + +=cut + + use Carp; + use strict; + use Asterisk::AMI; + + eval "use Asterisk::AMI"; + print "Asterisk::AMI not found. Exiting...\n" if $@; + exit( 0 ) if $@; + + if ( $ARGV[ 0 ] and $ARGV[ 0 ] eq "config" ) { + print "graph_title Asterisk Fax - Failed and Completed Faxes\n"; + print "graph_args --base 1000 -l 0\n"; + print "graph_vlabel Failed and Completed Faxes\n"; + print "graph_category asterisk\n"; + print "failed.draw AREA\n"; + print "failed.label Failed faxes\n"; + print "completed.draw AREA\n"; + print "completed.label Completed faxes\n"; + exit 0; + }; + + my $host = exists $ENV{ 'host' } ? $ENV{ 'host' } : "127.0.0.1"; + my $port = exists $ENV{ 'port' } ? $ENV{ 'port' } : "5038"; + my $timeout = exists $ENV{ 'timeout' } ? $ENV{ 'timeout' } : "5"; + my $username = $ENV{ 'username' }; + my $secret = $ENV{ 'secret' }; + + my $astman = Asterisk::AMI->new(PeerAddr => "$host", + PeerPort => "$port", + Username => "$username", + Secret => "$secret" + ); + + croak "Unable to connect to asterisk" unless ( $astman ); + my $actionid = $astman->send_action({ Action => 'Command', + Command => 'fax show stats', + $timeout}); + my $response = $astman->get_response( $actionid ); + my $arrayref = $response->{CMD}; + my $null = qq{}; + my ( %faxstats, $section ); + foreach my $line ( @$arrayref ) { + next if ( ( ! $line ) || ( $line =~ /-----------/ ) ); + my ( $key, $value ) = split( ':', $line ); + $section = $key if ( $value eq $null ); + $key =~ s/\s+$//g; + $value =~ s/^\s+//g; + $faxstats{ "$section" }{ "$key" } = $value if ( $value ne $null ); + }; + $astman->disconnect; + + my $failed = $faxstats{'FAX Statistics'}{'Failed FAXes'}; + my $completed = $faxstats{'FAX Statistics'}{'Completed FAXes'}; + print "failed.value $failed\n"; + print "completed.value $completed\n"; + + exit( 0 ); + + + diff --git a/plugins/asterisk/asterisk_16_fax_ffa/asterisk_fax_iofail b/plugins/asterisk/asterisk_16_fax_ffa/asterisk_fax_iofail new file mode 100755 index 00000000..3655f6f8 --- /dev/null +++ b/plugins/asterisk/asterisk_16_fax_ffa/asterisk_fax_iofail @@ -0,0 +1,132 @@ +#!/usr/bin/perl + +=head1 NAME + +asterisk_fax_* - Plugin to monitor Asterisk fax parameters. + +=head1 SUPPORTED VERSION + +This plugin supports Asterisk 1.6.* and Digiums Fax For Asterisk (FFA) modules. + +=head1 CONFIGURATION + +The following configuration parameters are used by this plugin + + [asterisk*] + env.host - hostname to connect to. Defaults to localhost. + env.port - port number to connect to. Defaults to 5038. + env.username - username used for authentication. No default value. + env.secret - secret used for authentication. No default value. + env.timeout - AMI timeout value in seconds. Defaults to 5. + +The "username" and "secret" parameters are mandatory, and have no +defaults. + +=head1 DEFAULT CONFIGURATION + + [asterisk*] + env.username manager + env.secret insecure + env.host 127.0.0.1 + env.port 5038 + env.timeout 5 + +=head1 REQUIRED PERL MODULES + +This plugin requires the Asterisk::AMI module and its dependencies. +Its dependencies can be found here: +http://deps.cpantesters.org/?module=Asterisk::AMI;perl=latest + + +=head1 AUTHOR + +Copyright (C) 2011 Frank DiGennaro + +=head1 LICENSE + +Gnu GPLv2 + +=begin comment + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; version 2 dated June, 1991. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, +USA. + +If you improve this script please send your version to my email +address with the copyright notice upgrade with your name. + +=end comment + +=head1 MAGIC MARKERS + + #%# family=contrib + +=cut + + use Carp; + use strict; + use Asterisk::AMI; + + eval "use Asterisk::AMI"; + print "Asterisk::AMI not found. Exiting...\n" if $@; + exit( 0 ) if $@; + + if ( $ARGV[ 0 ] and $ARGV[ 0 ] eq "config" ) { + print "graph_title Asterisk Fax - IO Failures (T.38 and G.711)\n"; + print "graph_args --base 1000 -l 0\n"; + print "graph_vlabel Number of IO Failures\n"; + print "graph_category asterisk\n"; + print "t38_iofail.draw AREA\n"; + print "t38_iofail.label T.38 IO Failures\n"; + print "g711_iofail.draw AREA\n"; + print "g711_iofail.label G.711 IO Failures\n"; + exit ( 0 ); + }; + + my $host = exists $ENV{ 'host' } ? $ENV{ 'host' } : "127.0.0.1"; + my $port = exists $ENV{ 'port' } ? $ENV{ 'port' } : "5038"; + my $timeout = exists $ENV{ 'timeout' } ? $ENV{ 'timeout' } : "5"; + my $username = $ENV{ 'username' }; + my $secret = $ENV{ 'secret' }; + + my $astman = Asterisk::AMI->new(PeerAddr => "$host", + PeerPort => "$port", + Username => "$username", + Secret => "$secret" + ); + + croak "Unable to connect to asterisk" unless ( $astman ); + my $actionid = $astman->send_action({ Action => 'Command', + Command => 'fax show stats', + $timeout}); + my $response = $astman->get_response( $actionid ); + my $arrayref = $response->{CMD}; + my $null = qq{}; + my ( %faxstats, $section ); + foreach my $line ( @$arrayref ) { + next if ( ( ! $line ) || ( $line =~ /-----------/ ) ); + my ( $key, $value ) = split( ':', $line ); + $section = $key if ( $value eq $null ); + $key =~ s/\s+$//g; + $value =~ s/^\s+//g; + $faxstats{ "$section" }{ "$key" } = $value if ( $value ne $null ); + }; + $astman->disconnect; + + print "t38_iofail.value $faxstats{'Digium T.38'}{'IO Fail'}\n"; + print "g711_iofail.value $faxstats{'Digium G.711'}{'IO Fail'}\n"; + + exit( 0 ); + + + diff --git a/plugins/asterisk/asterisk_16_fax_ffa/asterisk_fax_iopartial b/plugins/asterisk/asterisk_16_fax_ffa/asterisk_fax_iopartial new file mode 100755 index 00000000..6d8c28aa --- /dev/null +++ b/plugins/asterisk/asterisk_16_fax_ffa/asterisk_fax_iopartial @@ -0,0 +1,132 @@ +#!/usr/bin/perl + +=head1 NAME + +asterisk_fax_* - Plugin to monitor Asterisk fax parameters. + +=head1 SUPPORTED VERSION + +This plugin supports Asterisk 1.6.* and Digiums Fax For Asterisk (FFA) modules. + +=head1 CONFIGURATION + +The following configuration parameters are used by this plugin + + [asterisk*] + env.host - hostname to connect to. Defaults to localhost. + env.port - port number to connect to. Defaults to 5038. + env.username - username used for authentication. No default value. + env.secret - secret used for authentication. No default value. + env.timeout - AMI timeout value in seconds. Defaults to 5. + +The "username" and "secret" parameters are mandatory, and have no +defaults. + +=head1 DEFAULT CONFIGURATION + + [asterisk*] + env.username manager + env.secret insecure + env.host 127.0.0.1 + env.port 5038 + env.timeout 5 + +=head1 REQUIRED PERL MODULES + +This plugin requires the Asterisk::AMI module and its dependencies. +Its dependencies can be found here: +http://deps.cpantesters.org/?module=Asterisk::AMI;perl=latest + + +=head1 AUTHOR + +Copyright (C) 2011 Frank DiGennaro + +=head1 LICENSE + +Gnu GPLv2 + +=begin comment + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; version 2 dated June, 1991. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, +USA. + +If you improve this script please send your version to my email +address with the copyright notice upgrade with your name. + +=end comment + +=head1 MAGIC MARKERS + + #%# family=contrib + +=cut + + use Carp; + use strict; + use Asterisk::AMI; + + eval "use Asterisk::AMI"; + print "Asterisk::AMI not found. Exiting...\n" if $@; + exit( 0 ) if $@; + + if ( $ARGV[ 0 ] and $ARGV[ 0 ] eq "config" ) { + print "graph_title Asterisk Fax - IO Partial (T.38 and G.711)\n"; + print "graph_args --base 1000 -l 0\n"; + print "graph_vlabel Number of Number of IO Partials\n"; + print "graph_category asterisk\n"; + print "t38_iopartial.draw AREA\n"; + print "t38_iopartial.label Partial T.38 Faxes\n"; + print "g711_iopartial.draw AREA\n"; + print "g711_iopartial.label Partial G.711 Faxes\n"; + exit ( 0 ); + }; + + my $host = exists $ENV{ 'host' } ? $ENV{ 'host' } : "127.0.0.1"; + my $port = exists $ENV{ 'port' } ? $ENV{ 'port' } : "5038"; + my $timeout = exists $ENV{ 'timeout' } ? $ENV{ 'timeout' } : "5"; + my $username = $ENV{ 'username' }; + my $secret = $ENV{ 'secret' }; + + my $astman = Asterisk::AMI->new(PeerAddr => "$host", + PeerPort => "$port", + Username => "$username", + Secret => "$secret" + ); + + croak "Unable to connect to asterisk" unless ( $astman ); + my $actionid = $astman->send_action({ Action => 'Command', + Command => 'fax show stats', + $timeout}); + my $response = $astman->get_response( $actionid ); + my $arrayref = $response->{CMD}; + my $null = qq{}; + my ( %faxstats, $section ); + foreach my $line ( @$arrayref ) { + next if ( ( ! $line ) || ( $line =~ /-----------/ ) ); + my ( $key, $value ) = split( ':', $line ); + $section = $key if ( $value eq $null ); + $key =~ s/\s+$//g; + $value =~ s/^\s+//g; + $faxstats{ "$section" }{ "$key" } = $value if ( $value ne $null ); + }; + $astman->disconnect; + + print "t38_iopartial.value $faxstats{'Digium T.38'}{'IO Partial'}\n"; + print "g711_iopartial.value $faxstats{'Digium G.711'}{'IO Partial'}\n"; + + exit( 0 ); + + + diff --git a/plugins/asterisk/asterisk_16_fax_ffa/asterisk_fax_licensed_channels b/plugins/asterisk/asterisk_16_fax_ffa/asterisk_fax_licensed_channels new file mode 100755 index 00000000..66f91c05 --- /dev/null +++ b/plugins/asterisk/asterisk_16_fax_ffa/asterisk_fax_licensed_channels @@ -0,0 +1,132 @@ +#!/usr/bin/perl + +=head1 NAME + +asterisk_fax_* - Plugin to monitor Asterisk fax parameters. + +=head1 SUPPORTED VERSION + +This plugin supports Asterisk 1.6.* and Digiums Fax For Asterisk (FFA) modules. + +=head1 CONFIGURATION + +The following configuration parameters are used by this plugin + + [asterisk*] + env.host - hostname to connect to. Defaults to localhost. + env.port - port number to connect to. Defaults to 5038. + env.username - username used for authentication. No default value. + env.secret - secret used for authentication. No default value. + env.timeout - AMI timeout value in seconds. Defaults to 5. + +The "username" and "secret" parameters are mandatory, and have no +defaults. + +=head1 DEFAULT CONFIGURATION + + [asterisk*] + env.username manager + env.secret insecure + env.host 127.0.0.1 + env.port 5038 + env.timeout 5 + +=head1 REQUIRED PERL MODULES + +This plugin requires the Asterisk::AMI module and its dependencies. +Its dependencies can be found here: +http://deps.cpantesters.org/?module=Asterisk::AMI;perl=latest + + +=head1 AUTHOR + +Copyright (C) 2011 Frank DiGennaro + +=head1 LICENSE + +Gnu GPLv2 + +=begin comment + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; version 2 dated June, 1991. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, +USA. + +If you improve this script please send your version to my email +address with the copyright notice upgrade with your name. + +=end comment + +=head1 MAGIC MARKERS + + #%# family=contrib + +=cut + + use Carp; + use strict; + use Asterisk::AMI; + + eval "use Asterisk::AMI"; + print "Asterisk::AMI not found. Exiting...\n" if $@; + exit( 0 ) if $@; + + if ( $ARGV[ 0 ] and $ARGV[ 0 ] eq "config" ) { + print "graph_title Asterisk Fax - Licensed Channels (T.38 and G.711)\n"; + print "graph_args --base 1000 -l 0\n"; + print "graph_vlabel Number of Licensed Channels\n"; + print "graph_category asterisk\n"; + print "t38_channels.draw AREA\n"; + print "t38_channels.label T.38 Licensed Channels\n"; + print "g711_channels.draw AREA\n"; + print "g711_channels.label G.711 Licensed Channels\n"; + exit ( 0 ); + }; + + my $host = exists $ENV{ 'host' } ? $ENV{ 'host' } : "127.0.0.1"; + my $port = exists $ENV{ 'port' } ? $ENV{ 'port' } : "5038"; + my $timeout = exists $ENV{ 'timeout' } ? $ENV{ 'timeout' } : "5"; + my $username = $ENV{ 'username' }; + my $secret = $ENV{ 'secret' }; + + my $astman = Asterisk::AMI->new(PeerAddr => "$host", + PeerPort => "$port", + Username => "$username", + Secret => "$secret" + ); + + croak "Unable to connect to asterisk" unless ( $astman ); + my $actionid = $astman->send_action({ Action => 'Command', + Command => 'fax show stats', + $timeout}); + my $response = $astman->get_response( $actionid ); + my $arrayref = $response->{CMD}; + my $null = qq{}; + my ( %faxstats, $section ); + foreach my $line ( @$arrayref ) { + next if ( ( ! $line ) || ( $line =~ /-----------/ ) ); + my ( $key, $value ) = split( ':', $line ); + $section = $key if ( $value eq $null ); + $key =~ s/\s+$//g; + $value =~ s/^\s+//g; + $faxstats{ "$section" }{ "$key" } = $value if ( $value ne $null ); + }; + $astman->disconnect; + + print "t38_channels.value $faxstats{'Digium T.38'}{'Licensed Channels'}\n"; + print "g711_channels.value $faxstats{'Digium G.711'}{'Licensed Channels'}\n"; + + exit( 0 ); + + + diff --git a/plugins/asterisk/asterisk_16_fax_ffa/asterisk_fax_max_concurrent b/plugins/asterisk/asterisk_16_fax_ffa/asterisk_fax_max_concurrent new file mode 100755 index 00000000..e5311af1 --- /dev/null +++ b/plugins/asterisk/asterisk_16_fax_ffa/asterisk_fax_max_concurrent @@ -0,0 +1,132 @@ +#!/usr/bin/perl + +=head1 NAME + +asterisk_fax_* - Plugin to monitor Asterisk fax parameters. + +=head1 SUPPORTED VERSION + +This plugin supports Asterisk 1.6.* and Digiums Fax For Asterisk (FFA) modules. + +=head1 CONFIGURATION + +The following configuration parameters are used by this plugin + + [asterisk*] + env.host - hostname to connect to. Defaults to localhost. + env.port - port number to connect to. Defaults to 5038. + env.username - username used for authentication. No default value. + env.secret - secret used for authentication. No default value. + env.timeout - AMI timeout value in seconds. Defaults to 5. + +The "username" and "secret" parameters are mandatory, and have no +defaults. + +=head1 DEFAULT CONFIGURATION + + [asterisk*] + env.username manager + env.secret insecure + env.host 127.0.0.1 + env.port 5038 + env.timeout 5 + +=head1 REQUIRED PERL MODULES + +This plugin requires the Asterisk::AMI module and its dependencies. +Its dependencies can be found here: +http://deps.cpantesters.org/?module=Asterisk::AMI;perl=latest + + +=head1 AUTHOR + +Copyright (C) 2011 Frank DiGennaro + +=head1 LICENSE + +Gnu GPLv2 + +=begin comment + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; version 2 dated June, 1991. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, +USA. + +If you improve this script please send your version to my email +address with the copyright notice upgrade with your name. + +=end comment + +=head1 MAGIC MARKERS + + #%# family=contrib + +=cut + + use Carp; + use strict; + use Asterisk::AMI; + + eval "use Asterisk::AMI"; + print "Asterisk::AMI not found. Exiting...\n" if $@; + exit( 0 ) if $@; + + if ( $ARGV[ 0 ] and $ARGV[ 0 ] eq "config" ) { + print "graph_title Asterisk Fax - Max Concurrent Sessions (T.38 and G.711)\n"; + print "graph_args --base 1000 -l 0\n"; + print "graph_vlabel Number of Max Concurrent Sessions\n"; + print "graph_category asterisk\n"; + print "t38_maxsessions.draw AREA\n"; + print "t38_maxsessions.label Max Concurrent T.38 Sessions\n"; + print "g711_maxsessions.draw AREA\n"; + print "g711_maxsessions.label Max Concurrent G.711 Sessions\n"; + exit ( 0 ); + }; + + my $host = exists $ENV{ 'host' } ? $ENV{ 'host' } : "127.0.0.1"; + my $port = exists $ENV{ 'port' } ? $ENV{ 'port' } : "5038"; + my $timeout = exists $ENV{ 'timeout' } ? $ENV{ 'timeout' } : "5"; + my $username = $ENV{ 'username' }; + my $secret = $ENV{ 'secret' }; + + my $astman = Asterisk::AMI->new(PeerAddr => "$host", + PeerPort => "$port", + Username => "$username", + Secret => "$secret" + ); + + croak "Unable to connect to asterisk" unless ( $astman ); + my $actionid = $astman->send_action({ Action => 'Command', + Command => 'fax show stats', + $timeout}); + my $response = $astman->get_response( $actionid ); + my $arrayref = $response->{CMD}; + my $null = qq{}; + my ( %faxstats, $section ); + foreach my $line ( @$arrayref ) { + next if ( ( ! $line ) || ( $line =~ /-----------/ ) ); + my ( $key, $value ) = split( ':', $line ); + $section = $key if ( $value eq $null ); + $key =~ s/\s+$//g; + $value =~ s/^\s+//g; + $faxstats{ "$section" }{ "$key" } = $value if ( $value ne $null ); + }; + $astman->disconnect; + + print "t38_maxsessions.value $faxstats{'Digium T.38'}{'Max Concurrent'}\n"; + print "g711_maxsessions.value $faxstats{'Digium G.711'}{'Max Concurrent'}\n"; + + exit( 0 ); + + + diff --git a/plugins/asterisk/asterisk_16_fax_ffa/asterisk_fax_negotiations_failed b/plugins/asterisk/asterisk_16_fax_ffa/asterisk_fax_negotiations_failed new file mode 100755 index 00000000..57c24233 --- /dev/null +++ b/plugins/asterisk/asterisk_16_fax_ffa/asterisk_fax_negotiations_failed @@ -0,0 +1,132 @@ +#!/usr/bin/perl + +=head1 NAME + +asterisk_fax_* - Plugin to monitor Asterisk fax parameters. + +=head1 SUPPORTED VERSION + +This plugin supports Asterisk 1.6.* and Digiums Fax For Asterisk (FFA) modules. + +=head1 CONFIGURATION + +The following configuration parameters are used by this plugin + + [asterisk*] + env.host - hostname to connect to. Defaults to localhost. + env.port - port number to connect to. Defaults to 5038. + env.username - username used for authentication. No default value. + env.secret - secret used for authentication. No default value. + env.timeout - AMI timeout value in seconds. Defaults to 5. + +The "username" and "secret" parameters are mandatory, and have no +defaults. + +=head1 DEFAULT CONFIGURATION + + [asterisk*] + env.username manager + env.secret insecure + env.host 127.0.0.1 + env.port 5038 + env.timeout 5 + +=head1 REQUIRED PERL MODULES + +This plugin requires the Asterisk::AMI module and its dependencies. +Its dependencies can be found here: +http://deps.cpantesters.org/?module=Asterisk::AMI;perl=latest + + +=head1 AUTHOR + +Copyright (C) 2011 Frank DiGennaro + +=head1 LICENSE + +Gnu GPLv2 + +=begin comment + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; version 2 dated June, 1991. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, +USA. + +If you improve this script please send your version to my email +address with the copyright notice upgrade with your name. + +=end comment + +=head1 MAGIC MARKERS + + #%# family=contrib + +=cut + + use Carp; + use strict; + use Asterisk::AMI; + + eval "use Asterisk::AMI"; + print "Asterisk::AMI not found. Exiting...\n" if $@; + exit( 0 ) if $@; + + if ( $ARGV[ 0 ] and $ARGV[ 0 ] eq "config" ) { + print "graph_title Asterisk Fax - Negotiations Failed (T.38 and G.711)\n"; + print "graph_args --base 1000 -l 0\n"; + print "graph_vlabel Number of Negotiations Failed\n"; + print "graph_category asterisk\n"; + print "t38_failed.draw AREA\n"; + print "t38_failed.label T.38 Negotiations Failed\n"; + print "g711_failed.draw AREA\n"; + print "g711_failed.label G.711 Negotiations Failed\n"; + exit ( 0 ); + }; + + my $host = exists $ENV{ 'host' } ? $ENV{ 'host' } : "127.0.0.1"; + my $port = exists $ENV{ 'port' } ? $ENV{ 'port' } : "5038"; + my $timeout = exists $ENV{ 'timeout' } ? $ENV{ 'timeout' } : "5"; + my $username = $ENV{ 'username' }; + my $secret = $ENV{ 'secret' }; + + my $astman = Asterisk::AMI->new(PeerAddr => "$host", + PeerPort => "$port", + Username => "$username", + Secret => "$secret" + ); + + croak "Unable to connect to asterisk" unless ( $astman ); + my $actionid = $astman->send_action({ Action => 'Command', + Command => 'fax show stats', + $timeout}); + my $response = $astman->get_response( $actionid ); + my $arrayref = $response->{CMD}; + my $null = qq{}; + my ( %faxstats, $section ); + foreach my $line ( @$arrayref ) { + next if ( ( ! $line ) || ( $line =~ /-----------/ ) ); + my ( $key, $value ) = split( ':', $line ); + $section = $key if ( $value eq $null ); + $key =~ s/\s+$//g; + $value =~ s/^\s+//g; + $faxstats{ "$section" }{ "$key" } = $value if ( $value ne $null ); + }; + $astman->disconnect; + + print "t38_failed.value $faxstats{'Digium T.38'}{'Negotiation Failed'}\n"; + print "g711_failed.value $faxstats{'Digium G.711'}{'Negotiation Failed'}\n"; + + exit( 0 ); + + + diff --git a/plugins/asterisk/asterisk_16_fax_ffa/asterisk_fax_nofax b/plugins/asterisk/asterisk_16_fax_ffa/asterisk_fax_nofax new file mode 100755 index 00000000..8b6485a8 --- /dev/null +++ b/plugins/asterisk/asterisk_16_fax_ffa/asterisk_fax_nofax @@ -0,0 +1,132 @@ +#!/usr/bin/perl + +=head1 NAME + +asterisk_fax_* - Plugin to monitor Asterisk fax parameters. + +=head1 SUPPORTED VERSION + +This plugin supports Asterisk 1.6.* and Digiums Fax For Asterisk (FFA) modules. + +=head1 CONFIGURATION + +The following configuration parameters are used by this plugin + + [asterisk*] + env.host - hostname to connect to. Defaults to localhost. + env.port - port number to connect to. Defaults to 5038. + env.username - username used for authentication. No default value. + env.secret - secret used for authentication. No default value. + env.timeout - AMI timeout value in seconds. Defaults to 5. + +The "username" and "secret" parameters are mandatory, and have no +defaults. + +=head1 DEFAULT CONFIGURATION + + [asterisk*] + env.username manager + env.secret insecure + env.host 127.0.0.1 + env.port 5038 + env.timeout 5 + +=head1 REQUIRED PERL MODULES + +This plugin requires the Asterisk::AMI module and its dependencies. +Its dependencies can be found here: +http://deps.cpantesters.org/?module=Asterisk::AMI;perl=latest + + +=head1 AUTHOR + +Copyright (C) 2011 Frank DiGennaro + +=head1 LICENSE + +Gnu GPLv2 + +=begin comment + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; version 2 dated June, 1991. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, +USA. + +If you improve this script please send your version to my email +address with the copyright notice upgrade with your name. + +=end comment + +=head1 MAGIC MARKERS + + #%# family=contrib + +=cut + + use Carp; + use strict; + use Asterisk::AMI; + + eval "use Asterisk::AMI"; + print "Asterisk::AMI not found. Exiting...\n" if $@; + exit( 0 ) if $@; + + if ( $ARGV[ 0 ] and $ARGV[ 0 ] eq "config" ) { + print "graph_title Asterisk Fax - No Faxes (T.38 and G.711)\n"; + print "graph_args --base 1000 -l 0\n"; + print "graph_vlabel Number of No Faxes\n"; + print "graph_category asterisk\n"; + print "t38_nofax.draw AREA\n"; + print "t38_nofax.label No T.38 Faxes\n"; + print "g711_nofax.draw AREA\n"; + print "g711_nofax.label No G.711 Faxes\n"; + exit ( 0 ); + }; + + my $host = exists $ENV{ 'host' } ? $ENV{ 'host' } : "127.0.0.1"; + my $port = exists $ENV{ 'port' } ? $ENV{ 'port' } : "5038"; + my $timeout = exists $ENV{ 'timeout' } ? $ENV{ 'timeout' } : "5"; + my $username = $ENV{ 'username' }; + my $secret = $ENV{ 'secret' }; + + my $astman = Asterisk::AMI->new(PeerAddr => "$host", + PeerPort => "$port", + Username => "$username", + Secret => "$secret" + ); + + croak "Unable to connect to asterisk" unless ( $astman ); + my $actionid = $astman->send_action({ Action => 'Command', + Command => 'fax show stats', + $timeout}); + my $response = $astman->get_response( $actionid ); + my $arrayref = $response->{CMD}; + my $null = qq{}; + my ( %faxstats, $section ); + foreach my $line ( @$arrayref ) { + next if ( ( ! $line ) || ( $line =~ /-----------/ ) ); + my ( $key, $value ) = split( ':', $line ); + $section = $key if ( $value eq $null ); + $key =~ s/\s+$//g; + $value =~ s/^\s+//g; + $faxstats{ "$section" }{ "$key" } = $value if ( $value ne $null ); + }; + $astman->disconnect; + + print "t38_nofax.value $faxstats{'Digium T.38'}{'No FAX'}\n"; + print "g711_nofax.value $faxstats{'Digium G.711'}{'No FAX'}\n"; + + exit( 0 ); + + + diff --git a/plugins/asterisk/asterisk_16_fax_ffa/asterisk_fax_partial b/plugins/asterisk/asterisk_16_fax_ffa/asterisk_fax_partial new file mode 100755 index 00000000..e573f071 --- /dev/null +++ b/plugins/asterisk/asterisk_16_fax_ffa/asterisk_fax_partial @@ -0,0 +1,132 @@ +#!/usr/bin/perl + +=head1 NAME + +asterisk_fax_* - Plugin to monitor Asterisk fax parameters. + +=head1 SUPPORTED VERSION + +This plugin supports Asterisk 1.6.* and Digiums Fax For Asterisk (FFA) modules. + +=head1 CONFIGURATION + +The following configuration parameters are used by this plugin + + [asterisk*] + env.host - hostname to connect to. Defaults to localhost. + env.port - port number to connect to. Defaults to 5038. + env.username - username used for authentication. No default value. + env.secret - secret used for authentication. No default value. + env.timeout - AMI timeout value in seconds. Defaults to 5. + +The "username" and "secret" parameters are mandatory, and have no +defaults. + +=head1 DEFAULT CONFIGURATION + + [asterisk*] + env.username manager + env.secret insecure + env.host 127.0.0.1 + env.port 5038 + env.timeout 5 + +=head1 REQUIRED PERL MODULES + +This plugin requires the Asterisk::AMI module and its dependencies. +Its dependencies can be found here: +http://deps.cpantesters.org/?module=Asterisk::AMI;perl=latest + + +=head1 AUTHOR + +Copyright (C) 2011 Frank DiGennaro + +=head1 LICENSE + +Gnu GPLv2 + +=begin comment + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; version 2 dated June, 1991. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, +USA. + +If you improve this script please send your version to my email +address with the copyright notice upgrade with your name. + +=end comment + +=head1 MAGIC MARKERS + + #%# family=contrib + +=cut + + use Carp; + use strict; + use Asterisk::AMI; + + eval "use Asterisk::AMI"; + print "Asterisk::AMI not found. Exiting...\n" if $@; + exit( 0 ) if $@; + + if ( $ARGV[ 0 ] and $ARGV[ 0 ] eq "config" ) { + print "graph_title Asterisk Fax - Partial Faxes (T.38 and G.711)\n"; + print "graph_args --base 1000 -l 0\n"; + print "graph_vlabel Number of Partial Faxes\n"; + print "graph_category asterisk\n"; + print "t38_partial.draw AREA\n"; + print "t38_partial.label Partial T.38 Faxes\n"; + print "g711_partial.draw AREA\n"; + print "g711_partial.label Partial G.711 Faxes\n"; + exit ( 0 ); + }; + + my $host = exists $ENV{ 'host' } ? $ENV{ 'host' } : "127.0.0.1"; + my $port = exists $ENV{ 'port' } ? $ENV{ 'port' } : "5038"; + my $timeout = exists $ENV{ 'timeout' } ? $ENV{ 'timeout' } : "5"; + my $username = $ENV{ 'username' }; + my $secret = $ENV{ 'secret' }; + + my $astman = Asterisk::AMI->new(PeerAddr => "$host", + PeerPort => "$port", + Username => "$username", + Secret => "$secret" + ); + + croak "Unable to connect to asterisk" unless ( $astman ); + my $actionid = $astman->send_action({ Action => 'Command', + Command => 'fax show stats', + $timeout}); + my $response = $astman->get_response( $actionid ); + my $arrayref = $response->{CMD}; + my $null = qq{}; + my ( %faxstats, $section ); + foreach my $line ( @$arrayref ) { + next if ( ( ! $line ) || ( $line =~ /-----------/ ) ); + my ( $key, $value ) = split( ':', $line ); + $section = $key if ( $value eq $null ); + $key =~ s/\s+$//g; + $value =~ s/^\s+//g; + $faxstats{ "$section" }{ "$key" } = $value if ( $value ne $null ); + }; + $astman->disconnect; + + print "t38_partial.value $faxstats{'Digium T.38'}{'Partial'}\n"; + print "g711_partial.value $faxstats{'Digium G.711'}{'Partial'}\n"; + + exit( 0 ); + + + diff --git a/plugins/asterisk/asterisk_16_fax_ffa/asterisk_fax_protocol_error b/plugins/asterisk/asterisk_16_fax_ffa/asterisk_fax_protocol_error new file mode 100755 index 00000000..3fa8a6af --- /dev/null +++ b/plugins/asterisk/asterisk_16_fax_ffa/asterisk_fax_protocol_error @@ -0,0 +1,132 @@ +#!/usr/bin/perl + +=head1 NAME + +asterisk_fax_* - Plugin to monitor Asterisk fax parameters. + +=head1 SUPPORTED VERSION + +This plugin supports Asterisk 1.6.* and Digiums Fax For Asterisk (FFA) modules. + +=head1 CONFIGURATION + +The following configuration parameters are used by this plugin + + [asterisk*] + env.host - hostname to connect to. Defaults to localhost. + env.port - port number to connect to. Defaults to 5038. + env.username - username used for authentication. No default value. + env.secret - secret used for authentication. No default value. + env.timeout - AMI timeout value in seconds. Defaults to 5. + +The "username" and "secret" parameters are mandatory, and have no +defaults. + +=head1 DEFAULT CONFIGURATION + + [asterisk*] + env.username manager + env.secret insecure + env.host 127.0.0.1 + env.port 5038 + env.timeout 5 + +=head1 REQUIRED PERL MODULES + +This plugin requires the Asterisk::AMI module and its dependencies. +Its dependencies can be found here: +http://deps.cpantesters.org/?module=Asterisk::AMI;perl=latest + + +=head1 AUTHOR + +Copyright (C) 2011 Frank DiGennaro + +=head1 LICENSE + +Gnu GPLv2 + +=begin comment + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; version 2 dated June, 1991. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, +USA. + +If you improve this script please send your version to my email +address with the copyright notice upgrade with your name. + +=end comment + +=head1 MAGIC MARKERS + + #%# family=contrib + +=cut + + use Carp; + use strict; + use Asterisk::AMI; + + eval "use Asterisk::AMI"; + print "Asterisk::AMI not found. Exiting...\n" if $@; + exit( 0 ) if $@; + + if ( $ARGV[ 0 ] and $ARGV[ 0 ] eq "config" ) { + print "graph_title Asterisk Fax - Protocol Errors (T.38 and G.711)\n"; + print "graph_args --base 1000 -l 0\n"; + print "graph_vlabel Number of Protocol Errors\n"; + print "graph_category asterisk\n"; + print "t38_proterror.draw AREA\n"; + print "t38_proterror.label T.38 Protocol Errors\n"; + print "g711_proterror.draw AREA\n"; + print "g711_proterror.label G.711 Protocol Errors\n"; + exit ( 0 ); + }; + + my $host = exists $ENV{ 'host' } ? $ENV{ 'host' } : "127.0.0.1"; + my $port = exists $ENV{ 'port' } ? $ENV{ 'port' } : "5038"; + my $timeout = exists $ENV{ 'timeout' } ? $ENV{ 'timeout' } : "5"; + my $username = $ENV{ 'username' }; + my $secret = $ENV{ 'secret' }; + + my $astman = Asterisk::AMI->new(PeerAddr => "$host", + PeerPort => "$port", + Username => "$username", + Secret => "$secret" + ); + + croak "Unable to connect to asterisk" unless ( $astman ); + my $actionid = $astman->send_action({ Action => 'Command', + Command => 'fax show stats', + $timeout}); + my $response = $astman->get_response( $actionid ); + my $arrayref = $response->{CMD}; + my $null = qq{}; + my ( %faxstats, $section ); + foreach my $line ( @$arrayref ) { + next if ( ( ! $line ) || ( $line =~ /-----------/ ) ); + my ( $key, $value ) = split( ':', $line ); + $section = $key if ( $value eq $null ); + $key =~ s/\s+$//g; + $value =~ s/^\s+//g; + $faxstats{ "$section" }{ "$key" } = $value if ( $value ne $null ); + }; + $astman->disconnect; + + print "t38_proterror.value $faxstats{'Digium T.38'}{'Protocol Error'}\n"; + print "g711_proterror.value $faxstats{'Digium G.711'}{'Protocol Error'}\n"; + + exit( 0 ); + + + diff --git a/plugins/asterisk/asterisk_16_fax_ffa/asterisk_fax_success b/plugins/asterisk/asterisk_16_fax_ffa/asterisk_fax_success new file mode 100755 index 00000000..9d1dfd13 --- /dev/null +++ b/plugins/asterisk/asterisk_16_fax_ffa/asterisk_fax_success @@ -0,0 +1,132 @@ +#!/usr/bin/perl + +=head1 NAME + +asterisk_fax_* - Plugin to monitor Asterisk fax parameters. + +=head1 SUPPORTED VERSION + +This plugin supports Asterisk 1.6.* and Digiums Fax For Asterisk (FFA) modules. + +=head1 CONFIGURATION + +The following configuration parameters are used by this plugin + + [asterisk*] + env.host - hostname to connect to. Defaults to localhost. + env.port - port number to connect to. Defaults to 5038. + env.username - username used for authentication. No default value. + env.secret - secret used for authentication. No default value. + env.timeout - AMI timeout value in seconds. Defaults to 5. + +The "username" and "secret" parameters are mandatory, and have no +defaults. + +=head1 DEFAULT CONFIGURATION + + [asterisk*] + env.username manager + env.secret insecure + env.host 127.0.0.1 + env.port 5038 + env.timeout 5 + +=head1 REQUIRED PERL MODULES + +This plugin requires the Asterisk::AMI module and its dependencies. +Its dependencies can be found here: +http://deps.cpantesters.org/?module=Asterisk::AMI;perl=latest + + +=head1 AUTHOR + +Copyright (C) 2011 Frank DiGennaro + +=head1 LICENSE + +Gnu GPLv2 + +=begin comment + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; version 2 dated June, 1991. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, +USA. + +If you improve this script please send your version to my email +address with the copyright notice upgrade with your name. + +=end comment + +=head1 MAGIC MARKERS + + #%# family=contrib + +=cut + + use Carp; + use strict; + use Asterisk::AMI; + + eval "use Asterisk::AMI"; + print "Asterisk::AMI not found. Exiting...\n" if $@; + exit( 0 ) if $@; + + if ( $ARGV[ 0 ] and $ARGV[ 0 ] eq "config" ) { + print "graph_title Asterisk Fax - Successful Faxes (T.38 and G.711)\n"; + print "graph_args --base 1000 -l 0\n"; + print "graph_vlabel Number of Successful Faxes\n"; + print "graph_category asterisk\n"; + print "t38_success.draw AREA\n"; + print "t38_success.label Successful T.38 Faxes\n"; + print "g711_success.draw AREA\n"; + print "g711_success.label Successful G.711 Faxes\n"; + exit ( 0 ); + }; + + my $host = exists $ENV{ 'host' } ? $ENV{ 'host' } : "127.0.0.1"; + my $port = exists $ENV{ 'port' } ? $ENV{ 'port' } : "5038"; + my $timeout = exists $ENV{ 'timeout' } ? $ENV{ 'timeout' } : "5"; + my $username = $ENV{ 'username' }; + my $secret = $ENV{ 'secret' }; + + my $astman = Asterisk::AMI->new(PeerAddr => "$host", + PeerPort => "$port", + Username => "$username", + Secret => "$secret" + ); + + croak "Unable to connect to asterisk" unless ( $astman ); + my $actionid = $astman->send_action({ Action => 'Command', + Command => 'fax show stats', + $timeout}); + my $response = $astman->get_response( $actionid ); + my $arrayref = $response->{CMD}; + my $null = qq{}; + my ( %faxstats, $section ); + foreach my $line ( @$arrayref ) { + next if ( ( ! $line ) || ( $line =~ /-----------/ ) ); + my ( $key, $value ) = split( ':', $line ); + $section = $key if ( $value eq $null ); + $key =~ s/\s+$//g; + $value =~ s/^\s+//g; + $faxstats{ "$section" }{ "$key" } = $value if ( $value ne $null ); + }; + $astman->disconnect; + + print "t38_success.value $faxstats{'Digium T.38'}{'Success'}\n"; + print "g711_success.value $faxstats{'Digium G.711'}{'Success'}\n"; + + exit( 0 ); + + + diff --git a/plugins/asterisk/asterisk_16_fax_ffa/asterisk_fax_switched2t38 b/plugins/asterisk/asterisk_16_fax_ffa/asterisk_fax_switched2t38 new file mode 100755 index 00000000..f67baaaf --- /dev/null +++ b/plugins/asterisk/asterisk_16_fax_ffa/asterisk_fax_switched2t38 @@ -0,0 +1,130 @@ +#!/usr/bin/perl + +=head1 NAME + +asterisk_fax_* - Plugin to monitor Asterisk fax parameters. + +=head1 SUPPORTED VERSION + +This plugin supports Asterisk 1.6.* and Digiums Fax For Asterisk (FFA) modules. + +=head1 CONFIGURATION + +The following configuration parameters are used by this plugin + + [asterisk*] + env.host - hostname to connect to. Defaults to localhost. + env.port - port number to connect to. Defaults to 5038. + env.username - username used for authentication. No default value. + env.secret - secret used for authentication. No default value. + env.timeout - AMI timeout value in seconds. Defaults to 5. + +The "username" and "secret" parameters are mandatory, and have no +defaults. + +=head1 DEFAULT CONFIGURATION + + [asterisk*] + env.username manager + env.secret insecure + env.host 127.0.0.1 + env.port 5038 + env.timeout 5 + +=head1 REQUIRED PERL MODULES + +This plugin requires the Asterisk::AMI module and its dependencies. +Its dependencies can be found here: +http://deps.cpantesters.org/?module=Asterisk::AMI;perl=latest + + +=head1 AUTHOR + +Copyright (C) 2011 Frank DiGennaro + +=head1 LICENSE + +Gnu GPLv2 + +=begin comment + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; version 2 dated June, 1991. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, +USA. + +If you improve this script please send your version to my email +address with the copyright notice upgrade with your name. + +=end comment + +=head1 MAGIC MARKERS + + #%# family=contrib + +=cut + + use Carp; + use strict; + use Asterisk::AMI; + + eval "use Asterisk::AMI"; + print "Asterisk::AMI not found. Exiting...\n" if $@; + exit( 0 ) if $@; + + if ( $ARGV[ 0 ] and $ARGV[ 0 ] eq "config" ) { + print "graph_title Asterisk Fax - Switched to T.38\n"; + print "graph_args --base 1000 -l 0\n"; + print "graph_vlabel Number of Switches to T.38\n"; + print "graph_category asterisk\n"; + print "switched.draw AREA\n"; + print "switched.label Switched to T.38\n"; + exit 0; + }; + + my $host = exists $ENV{ 'host' } ? $ENV{ 'host' } : "127.0.0.1"; + my $port = exists $ENV{ 'port' } ? $ENV{ 'port' } : "5038"; + my $timeout = exists $ENV{ 'timeout' } ? $ENV{ 'timeout' } : "5"; + my $username = $ENV{ 'username' }; + my $secret = $ENV{ 'secret' }; + + my $astman = Asterisk::AMI->new(PeerAddr => "$host", + PeerPort => "$port", + Username => "$username", + Secret => "$secret" + ); + + croak "Unable to connect to asterisk" unless ( $astman ); + my $actionid = $astman->send_action({ Action => 'Command', + Command => 'fax show stats', + $timeout}); + my $response = $astman->get_response( $actionid ); + my $arrayref = $response->{CMD}; + my $null = qq{}; + my ( %faxstats, $section ); + foreach my $line ( @$arrayref ) { + next if ( ( ! $line ) || ( $line =~ /-----------/ ) ); + my ( $key, $value ) = split( ':', $line ); + $section = $key if ( $value eq $null ); + $key =~ s/\s+$//g; + $value =~ s/^\s+//g; + $faxstats{ "$section" }{ "$key" } = $value if ( $value ne $null ); + }; + $astman->disconnect; + + my $switched = $faxstats{'Digium G.711'}{'Switched to T.38'}; + print "switched.value $switched\n"; + + exit( 0 ); + + + diff --git a/plugins/asterisk/asterisk_16_fax_ffa/asterisk_fax_train_failure b/plugins/asterisk/asterisk_16_fax_ffa/asterisk_fax_train_failure new file mode 100755 index 00000000..8ff83de0 --- /dev/null +++ b/plugins/asterisk/asterisk_16_fax_ffa/asterisk_fax_train_failure @@ -0,0 +1,140 @@ +#!/usr/bin/perl + +=head1 NAME + +asterisk_fax_* - Plugin to monitor Asterisk fax parameters. + +=head1 SUPPORTED VERSION + +This plugin supports Asterisk 1.6.* and Digiums Fax For Asterisk (FFA) modules. + +=head1 CONFIGURATION + +The following configuration parameters are used by this plugin + + [asterisk*] + env.host - hostname to connect to. Defaults to localhost. + env.port - port number to connect to. Defaults to 5038. + env.username - username used for authentication. No default value. + env.secret - secret used for authentication. No default value. + env.timeout - AMI timeout value in seconds. Defaults to 5. + +The "username" and "secret" parameters are mandatory, and have no +defaults. + +=head1 DEFAULT CONFIGURATION + + [asterisk*] + env.username manager + env.secret insecure + env.host 127.0.0.1 + env.port 5038 + env.timeout 5 + +=head1 REQUIRED PERL MODULES + +This plugin requires the Asterisk::AMI module and its dependencies. +Its dependencies can be found here: +http://deps.cpantesters.org/?module=Asterisk::AMI;perl=latest + + +=head1 AUTHOR + +Copyright (C) 2011 Frank DiGennaro + +=head1 LICENSE + +Gnu GPLv2 + +=begin comment + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; version 2 dated June, 1991. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, +USA. + +If you improve this script please send your version to my email +address with the copyright notice upgrade with your name. + +=end comment + +=head1 MAGIC MARKERS + + #%# family=contrib + +=cut + + use Carp; + use strict; + use Asterisk::AMI; + + eval "use Asterisk::AMI"; + print "Asterisk::AMI not found. Exiting...\n" if $@; + exit( 0 ) if $@; + + if ( $ARGV[ 0 ] and $ARGV[ 0 ] eq "config" ) { + print "graph_title Asterisk Fax - Train Failures (T.38 and G.711)\n"; + print "graph_args --base 1000 -l 0\n"; + print "graph_vlabel Number of Train Failures\n"; + print "graph_category asterisk\n"; + print "t38_failure.draw AREA\n"; + print "t38_failure.label T.38 Train Failures\n"; + print "g711_failure.draw AREA\n"; + print "g711_failure.label G.711 Train Failures\n"; + exit ( 0 ); + }; + + my $host = exists $ENV{ 'host' } ? $ENV{ 'host' } : "127.0.0.1"; + my $port = exists $ENV{ 'port' } ? $ENV{ 'port' } : "5038"; + my $timeout = exists $ENV{ 'timeout' } ? $ENV{ 'timeout' } : "5"; + my $username = $ENV{ 'username' }; + my $secret = $ENV{ 'secret' }; + + my $astman = Asterisk::AMI->new(PeerAddr => "$host", + PeerPort => "$port", + Username => "$username", + Secret => "$secret" + ); + + croak "Unable to connect to asterisk" unless ( $astman ); + my $actionid = $astman->send_action({ Action => 'Command', + Command => 'fax show stats', + $timeout}); + my $response = $astman->get_response( $actionid ); + my $arrayref = $response->{CMD}; + my $null = qq{}; + my ( %faxstats, $section ); + foreach my $line ( @$arrayref ) { + next if ( ( ! $line ) || ( $line =~ /-----------/ ) ); + my ( $key, $value ) = split( ':', $line ); + $section = $key if ( $value eq $null ); + $key =~ s/\s+$//g; + $value =~ s/^\s+//g; + $faxstats{ "$section" }{ "$key" } = $value if ( $value ne $null ); + }; + $astman->disconnect; + + foreach my $section ( keys %faxstats ) { + for my $key ( keys %{ $faxstats{ $section } } ) { + print "faxstats{$section}{$key} = $faxstats{$section}{$key}\n"; + }; + }; + + + + print "t38_failure.value $faxstats{'Digium T.38'}{'Train Failure'}\n"; + print "g711_failure.value $faxstats{'Digium G.711'}{'Train Failure'}\n"; + + exit( 0 ); + + + diff --git a/plugins/asterisk/asterisk_16_fax_ffa/asterisk_fax_txrx_attempts b/plugins/asterisk/asterisk_16_fax_ffa/asterisk_fax_txrx_attempts new file mode 100755 index 00000000..b8229ac8 --- /dev/null +++ b/plugins/asterisk/asterisk_16_fax_ffa/asterisk_fax_txrx_attempts @@ -0,0 +1,134 @@ +#!/usr/bin/perl + +=head1 NAME + +asterisk_fax_* - Plugin to monitor Asterisk fax parameters. + +=head1 SUPPORTED VERSION + +This plugin supports Asterisk 1.6.* and Digiums Fax For Asterisk (FFA) modules. + +=head1 CONFIGURATION + +The following configuration parameters are used by this plugin + + [asterisk*] + env.host - hostname to connect to. Defaults to localhost. + env.port - port number to connect to. Defaults to 5038. + env.username - username used for authentication. No default value. + env.secret - secret used for authentication. No default value. + env.timeout - AMI timeout value in seconds. Defaults to 5. + +The "username" and "secret" parameters are mandatory, and have no +defaults. + +=head1 DEFAULT CONFIGURATION + + [asterisk*] + env.username manager + env.secret insecure + env.host 127.0.0.1 + env.port 5038 + env.timeout 5 + +=head1 REQUIRED PERL MODULES + +This plugin requires the Asterisk::AMI module and its dependencies. +Its dependencies can be found here: +http://deps.cpantesters.org/?module=Asterisk::AMI;perl=latest + + +=head1 AUTHOR + +Copyright (C) 2011 Frank DiGennaro + +=head1 LICENSE + +Gnu GPLv2 + +=begin comment + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; version 2 dated June, 1991. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, +USA. + +If you improve this script please send your version to my email +address with the copyright notice upgrade with your name. + +=end comment + +=head1 MAGIC MARKERS + + #%# family=contrib + +=cut + + use Carp; + use strict; + use Asterisk::AMI; + + eval "use Asterisk::AMI"; + print "Asterisk::AMI not found. Exiting...\n" if $@; + exit( 0 ) if $@; + + if ( $ARGV[ 0 ] and $ARGV[ 0 ] eq "config" ) { + print "graph_title Asterisk Fax - Tx/Rx Attempts\n"; + print "graph_args --base 1000 -l 0\n"; + print "graph_vlabel Number of Tx and Rx Attempts\n"; + print "graph_category asterisk\n"; + print "transmit.draw AREA\n"; + print "transmit.label Tx Attempts\n"; + print "receive.draw AREA\n"; + print "receive.label Rx Attempts\n"; + exit 0; + }; + + my $host = exists $ENV{ 'host' } ? $ENV{ 'host' } : "127.0.0.1"; + my $port = exists $ENV{ 'port' } ? $ENV{ 'port' } : "5038"; + my $timeout = exists $ENV{ 'timeout' } ? $ENV{ 'timeout' } : "5"; + my $username = $ENV{ 'username' }; + my $secret = $ENV{ 'secret' }; + + my $astman = Asterisk::AMI->new(PeerAddr => "$host", + PeerPort => "$port", + Username => "$username", + Secret => "$secret" + ); + + croak "Unable to connect to asterisk" unless ( $astman ); + my $actionid = $astman->send_action({ Action => 'Command', + Command => 'fax show stats', + $timeout}); + my $response = $astman->get_response( $actionid ); + my $arrayref = $response->{CMD}; + my $null = qq{}; + my ( %faxstats, $section ); + foreach my $line ( @$arrayref ) { + next if ( ( ! $line ) || ( $line =~ /-----------/ ) ); + my ( $key, $value ) = split( ':', $line ); + $section = $key if ( $value eq $null ); + $key =~ s/\s+$//g; + $value =~ s/^\s+//g; + $faxstats{ "$section" }{ "$key" } = $value if ( $value ne $null ); + }; + $astman->disconnect; + + my $txstats = $faxstats{'FAX Statistics'}{'Transmit Attempts'}; + my $rxstats = $faxstats{'FAX Statistics'}{'Receive Attempts'}; + print "transmit.value $txstats\n"; + print "receive.value $rxstats\n"; + + exit( 0 ); + + + diff --git a/plugins/asterisk/asterisk_18_fax_spandsp/asterisk_fax_call_dropped b/plugins/asterisk/asterisk_18_fax_spandsp/asterisk_fax_call_dropped new file mode 100755 index 00000000..c6ba3fd8 --- /dev/null +++ b/plugins/asterisk/asterisk_18_fax_spandsp/asterisk_fax_call_dropped @@ -0,0 +1,132 @@ +#!/usr/bin/perl + +=head1 NAME + +asterisk_fax_* - Plugin to monitor Asterisk fax parameters. + +=head1 SUPPORTED VERSION + +This plugin supports Asterisk 1.8.* and the SpanDSP fax modules. + +=head1 CONFIGURATION + +The following configuration parameters are used by this plugin + + [asterisk*] + env.host - hostname to connect to. Defaults to localhost. + env.port - port number to connect to. Defaults to 5038. + env.username - username used for authentication. No default value. + env.secret - secret used for authentication. No default value. + env.timeout - AMI timeout value in seconds. Defaults to 5. + +The "username" and "secret" parameters are mandatory, and have no +defaults. + +=head1 DEFAULT CONFIGURATION + + [asterisk*] + env.username manager + env.secret insecure + env.host 127.0.0.1 + env.port 5038 + env.timeout 5 + +=head1 REQUIRED PERL MODULES + +This plugin requires the Asterisk::AMI module and its dependencies. +Its dependencies can be found here: +http://deps.cpantesters.org/?module=Asterisk::AMI;perl=latest + + +=head1 AUTHOR + +Copyright (C) 2011 Frank DiGennaro + +=head1 LICENSE + +Gnu GPLv2 + +=begin comment + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; version 2 dated June, 1991. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, +USA. + +If you improve this script please send your version to my email +address with the copyright notice upgrade with your name. + +=end comment + +=head1 MAGIC MARKERS + + #%# family=contrib + +=cut + + use Carp; + use strict; + use Asterisk::AMI; + + eval "use Asterisk::AMI"; + print "Asterisk::AMI not found. Exiting...\n" if $@; + exit( 0 ) if $@; + + if ( $ARGV[ 0 ] and $ARGV[ 0 ] eq "config" ) { + print "graph_title Asterisk Fax - Dropped Calls (T.38 and G.711)\n"; + print "graph_args --base 1000 -l 0\n"; + print "graph_vlabel Number of Dropped Calls\n"; + print "graph_category asterisk\n"; + print "t38_dropped.draw AREA\n"; + print "t38_dropped.label T.38 Dropped Calls\n"; + print "g711_dropped.draw AREA\n"; + print "g711_dropped.label G.711 Dropped Calls\n"; + exit ( 0 ); + }; + + my $host = exists $ENV{ 'host' } ? $ENV{ 'host' } : "127.0.0.1"; + my $port = exists $ENV{ 'port' } ? $ENV{ 'port' } : "5038"; + my $timeout = exists $ENV{ 'timeout' } ? $ENV{ 'timeout' } : "5"; + my $username = $ENV{ 'username' }; + my $secret = $ENV{ 'secret' }; + + my $astman = Asterisk::AMI->new(PeerAddr => "$host", + PeerPort => "$port", + Username => "$username", + Secret => "$secret" + ); + + croak "Unable to connect to asterisk" unless ( $astman ); + my $actionid = $astman->send_action({ Action => 'Command', + Command => 'fax show stats', + $timeout}); + my $response = $astman->get_response( $actionid ); + my $arrayref = $response->{CMD}; + my $null = qq{}; + my ( %faxstats, $section ); + foreach my $line ( @$arrayref ) { + next if ( ( ! $line ) || ( $line =~ /-----------/ ) ); + my ( $key, $value ) = split( ':', $line ); + $section = $key if ( $value eq $null ); + $key =~ s/\s+$//g; + $value =~ s/^\s+//g; + $faxstats{ "$section" }{ "$key" } = $value if ( $value ne $null ); + }; + $astman->disconnect; + + print "t38_dropped.value $faxstats{'Spandsp T.38'}{'Call Dropped'}\n"; + print "g711_dropped.value $faxstats{'Spandsp G.711'}{'Call Dropped'}\n"; + + exit( 0 ); + + + diff --git a/plugins/asterisk/asterisk_18_fax_spandsp/asterisk_fax_current_sessions b/plugins/asterisk/asterisk_18_fax_spandsp/asterisk_fax_current_sessions new file mode 100755 index 00000000..4b35be54 --- /dev/null +++ b/plugins/asterisk/asterisk_18_fax_spandsp/asterisk_fax_current_sessions @@ -0,0 +1,129 @@ +#!/usr/bin/perl + +=head1 NAME + +asterisk_fax_* - Plugin to monitor Asterisk fax parameters. + +=head1 SUPPORTED VERSION + +This plugin supports Asterisk 1.8.* and the SpanDSP fax modules. + +=head1 CONFIGURATION + +The following configuration parameters are used by this plugin + + [asterisk*] + env.host - hostname to connect to. Defaults to localhost. + env.port - port number to connect to. Defaults to 5038. + env.username - username used for authentication. No default value. + env.secret - secret used for authentication. No default value. + env.timeout - AMI timeout value in seconds. Defaults to 5. + +The "username" and "secret" parameters are mandatory, and have no +defaults. + +=head1 DEFAULT CONFIGURATION + + [asterisk*] + env.username manager + env.secret insecure + env.host 127.0.0.1 + env.port 5038 + env.timeout 5 + +=head1 REQUIRED PERL MODULES + +This plugin requires the Asterisk::AMI module and its dependencies. +Its dependencies can be found here: +http://deps.cpantesters.org/?module=Asterisk::AMI;perl=latest + + +=head1 AUTHOR + +Copyright (C) 2011 Frank DiGennaro + +=head1 LICENSE + +Gnu GPLv2 + +=begin comment + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; version 2 dated June, 1991. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, +USA. + +If you improve this script please send your version to my email +address with the copyright notice upgrade with your name. + +=end comment + +=head1 MAGIC MARKERS + + #%# family=contrib + +=cut + + use Carp; + use strict; + use Asterisk::AMI; + + eval "use Asterisk::AMI"; + print "Asterisk::AMI not found. Exiting...\n" if $@; + exit( 0 ) if $@; + + if ( $ARGV[ 0 ] and $ARGV[ 0 ] eq "config" ) { + print "graph_title Asterisk Fax - Current Sessions\n"; + print "graph_args --base 1000 -l 0\n"; + print "graph_vlabel Current Sessions\n"; + print "graph_category asterisk\n"; + print "sessions.draw AREA\n"; + print "sessions.label Current Sessions\n"; + exit 0; + }; + + my $host = exists $ENV{ 'host' } ? $ENV{ 'host' } : "127.0.0.1"; + my $port = exists $ENV{ 'port' } ? $ENV{ 'port' } : "5038"; + my $timeout = exists $ENV{ 'timeout' } ? $ENV{ 'timeout' } : "5"; + my $username = $ENV{ 'username' }; + my $secret = $ENV{ 'secret' }; + + my $astman = Asterisk::AMI->new(PeerAddr => "$host", + PeerPort => "$port", + Username => "$username", + Secret => "$secret" + ); + + croak "Unable to connect to asterisk" unless ( $astman ); + my $actionid = $astman->send_action({ Action => 'Command', + Command => 'fax show stats', + $timeout}); + my $response = $astman->get_response( $actionid ); + my $arrayref = $response->{CMD}; + my $null = qq{}; + my ( %faxstats, $section ); + foreach my $line ( @$arrayref ) { + next if ( ( ! $line ) || ( $line =~ /-----------/ ) ); + my ( $key, $value ) = split( ':', $line ); + $section = $key if ( $value eq $null ); + $key =~ s/\s+$//g; + $value =~ s/^\s+//g; + $faxstats{ "$section" }{ "$key" } = $value if ( $value ne $null ); + }; + $astman->disconnect; + + my $sessions = $faxstats{'FAX Statistics'}{'Current Sessions'}; + print "sessions.value $sessions\n"; + + exit( 0 ); + + diff --git a/plugins/asterisk/asterisk_18_fax_spandsp/asterisk_fax_failed_completed b/plugins/asterisk/asterisk_18_fax_spandsp/asterisk_fax_failed_completed new file mode 100755 index 00000000..671146c5 --- /dev/null +++ b/plugins/asterisk/asterisk_18_fax_spandsp/asterisk_fax_failed_completed @@ -0,0 +1,134 @@ +#!/usr/bin/perl + +=head1 NAME + +asterisk_fax_* - Plugin to monitor Asterisk fax parameters. + +=head1 SUPPORTED VERSION + +This plugin supports Asterisk 1.8.* and the SpanDSP fax modules. + +=head1 CONFIGURATION + +The following configuration parameters are used by this plugin + + [asterisk*] + env.host - hostname to connect to. Defaults to localhost. + env.port - port number to connect to. Defaults to 5038. + env.username - username used for authentication. No default value. + env.secret - secret used for authentication. No default value. + env.timeout - AMI timeout value in seconds. Defaults to 5. + +The "username" and "secret" parameters are mandatory, and have no +defaults. + +=head1 DEFAULT CONFIGURATION + + [asterisk*] + env.username manager + env.secret insecure + env.host 127.0.0.1 + env.port 5038 + env.timeout 5 + +=head1 REQUIRED PERL MODULES + +This plugin requires the Asterisk::AMI module and its dependencies. +Its dependencies can be found here: +http://deps.cpantesters.org/?module=Asterisk::AMI;perl=latest + + +=head1 AUTHOR + +Copyright (C) 2011 Frank DiGennaro + +=head1 LICENSE + +Gnu GPLv2 + +=begin comment + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; version 2 dated June, 1991. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, +USA. + +If you improve this script please send your version to my email +address with the copyright notice upgrade with your name. + +=end comment + +=head1 MAGIC MARKERS + + #%# family=contrib + +=cut + + use Carp; + use strict; + use Asterisk::AMI; + + eval "use Asterisk::AMI"; + print "Asterisk::AMI not found. Exiting...\n" if $@; + exit( 0 ) if $@; + + if ( $ARGV[ 0 ] and $ARGV[ 0 ] eq "config" ) { + print "graph_title Asterisk Fax - Failed and Completed Faxes\n"; + print "graph_args --base 1000 -l 0\n"; + print "graph_vlabel Failed and Completed Faxes\n"; + print "graph_category asterisk\n"; + print "failed.draw AREA\n"; + print "failed.label Failed faxes\n"; + print "completed.draw AREA\n"; + print "completed.label Completed faxes\n"; + exit 0; + }; + + my $host = exists $ENV{ 'host' } ? $ENV{ 'host' } : "127.0.0.1"; + my $port = exists $ENV{ 'port' } ? $ENV{ 'port' } : "5038"; + my $timeout = exists $ENV{ 'timeout' } ? $ENV{ 'timeout' } : "5"; + my $username = $ENV{ 'username' }; + my $secret = $ENV{ 'secret' }; + + my $astman = Asterisk::AMI->new(PeerAddr => "$host", + PeerPort => "$port", + Username => "$username", + Secret => "$secret" + ); + + croak "Unable to connect to asterisk" unless ( $astman ); + my $actionid = $astman->send_action({ Action => 'Command', + Command => 'fax show stats', + $timeout}); + my $response = $astman->get_response( $actionid ); + my $arrayref = $response->{CMD}; + my $null = qq{}; + my ( %faxstats, $section ); + foreach my $line ( @$arrayref ) { + next if ( ( ! $line ) || ( $line =~ /-----------/ ) ); + my ( $key, $value ) = split( ':', $line ); + $section = $key if ( $value eq $null ); + $key =~ s/\s+$//g; + $value =~ s/^\s+//g; + $faxstats{ "$section" }{ "$key" } = $value if ( $value ne $null ); + }; + $astman->disconnect; + + my $failed = $faxstats{'FAX Statistics'}{'Failed FAXes'}; + my $completed = $faxstats{'FAX Statistics'}{'Completed FAXes'}; + print "failed.value $failed\n"; + print "completed.value $completed\n"; + + exit( 0 ); + + + diff --git a/plugins/asterisk/asterisk_18_fax_spandsp/asterisk_fax_file_error b/plugins/asterisk/asterisk_18_fax_spandsp/asterisk_fax_file_error new file mode 100755 index 00000000..f5d5431d --- /dev/null +++ b/plugins/asterisk/asterisk_18_fax_spandsp/asterisk_fax_file_error @@ -0,0 +1,132 @@ +#!/usr/bin/perl + +=head1 NAME + +asterisk_fax_* - Plugin to monitor Asterisk fax parameters. + +=head1 SUPPORTED VERSION + +This plugin supports Asterisk 1.8.* and the SpanDSP fax modules. + +=head1 CONFIGURATION + +The following configuration parameters are used by this plugin + + [asterisk*] + env.host - hostname to connect to. Defaults to localhost. + env.port - port number to connect to. Defaults to 5038. + env.username - username used for authentication. No default value. + env.secret - secret used for authentication. No default value. + env.timeout - AMI timeout value in seconds. Defaults to 5. + +The "username" and "secret" parameters are mandatory, and have no +defaults. + +=head1 DEFAULT CONFIGURATION + + [asterisk*] + env.username manager + env.secret insecure + env.host 127.0.0.1 + env.port 5038 + env.timeout 5 + +=head1 REQUIRED PERL MODULES + +This plugin requires the Asterisk::AMI module and its dependencies. +Its dependencies can be found here: +http://deps.cpantesters.org/?module=Asterisk::AMI;perl=latest + + +=head1 AUTHOR + +Copyright (C) 2011 Frank DiGennaro + +=head1 LICENSE + +Gnu GPLv2 + +=begin comment + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; version 2 dated June, 1991. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, +USA. + +If you improve this script please send your version to my email +address with the copyright notice upgrade with your name. + +=end comment + +=head1 MAGIC MARKERS + + #%# family=contrib + +=cut + + use Carp; + use strict; + use Asterisk::AMI; + + eval "use Asterisk::AMI"; + print "Asterisk::AMI not found. Exiting...\n" if $@; + exit( 0 ) if $@; + + if ( $ARGV[ 0 ] and $ARGV[ 0 ] eq "config" ) { + print "graph_title Asterisk Fax - File Errors (T.38 and G.711)\n"; + print "graph_args --base 1000 -l 0\n"; + print "graph_vlabel Number of File Errors\n"; + print "graph_category asterisk\n"; + print "t38_file_error.draw AREA\n"; + print "t38_file_error.label T.38 File Errors\n"; + print "g711_file_error.draw AREA\n"; + print "g711_file_error.label G.711 File Errors\n"; + exit ( 0 ); + }; + + my $host = exists $ENV{ 'host' } ? $ENV{ 'host' } : "127.0.0.1"; + my $port = exists $ENV{ 'port' } ? $ENV{ 'port' } : "5038"; + my $timeout = exists $ENV{ 'timeout' } ? $ENV{ 'timeout' } : "5"; + my $username = $ENV{ 'username' }; + my $secret = $ENV{ 'secret' }; + + my $astman = Asterisk::AMI->new(PeerAddr => "$host", + PeerPort => "$port", + Username => "$username", + Secret => "$secret" + ); + + croak "Unable to connect to asterisk" unless ( $astman ); + my $actionid = $astman->send_action({ Action => 'Command', + Command => 'fax show stats', + $timeout}); + my $response = $astman->get_response( $actionid ); + my $arrayref = $response->{CMD}; + my $null = qq{}; + my ( %faxstats, $section ); + foreach my $line ( @$arrayref ) { + next if ( ( ! $line ) || ( $line =~ /-----------/ ) ); + my ( $key, $value ) = split( ':', $line ); + $section = $key if ( $value eq $null ); + $key =~ s/\s+$//g; + $value =~ s/^\s+//g; + $faxstats{ "$section" }{ "$key" } = $value if ( $value ne $null ); + }; + $astman->disconnect; + + print "t38_file_error.value $faxstats{'Spandsp T.38'}{'File Error'}\n"; + print "g711_file_error.value $faxstats{'Spandsp G.711'}{'File Error'}\n"; + + exit( 0 ); + + + diff --git a/plugins/asterisk/asterisk_18_fax_spandsp/asterisk_fax_memory_error b/plugins/asterisk/asterisk_18_fax_spandsp/asterisk_fax_memory_error new file mode 100755 index 00000000..5786dad1 --- /dev/null +++ b/plugins/asterisk/asterisk_18_fax_spandsp/asterisk_fax_memory_error @@ -0,0 +1,132 @@ +#!/usr/bin/perl + +=head1 NAME + +asterisk_fax_* - Plugin to monitor Asterisk fax parameters. + +=head1 SUPPORTED VERSION + +This plugin supports Asterisk 1.8.* and the SpanDSP fax modules. + +=head1 CONFIGURATION + +The following configuration parameters are used by this plugin + + [asterisk*] + env.host - hostname to connect to. Defaults to localhost. + env.port - port number to connect to. Defaults to 5038. + env.username - username used for authentication. No default value. + env.secret - secret used for authentication. No default value. + env.timeout - AMI timeout value in seconds. Defaults to 5. + +The "username" and "secret" parameters are mandatory, and have no +defaults. + +=head1 DEFAULT CONFIGURATION + + [asterisk*] + env.username manager + env.secret insecure + env.host 127.0.0.1 + env.port 5038 + env.timeout 5 + +=head1 REQUIRED PERL MODULES + +This plugin requires the Asterisk::AMI module and its dependencies. +Its dependencies can be found here: +http://deps.cpantesters.org/?module=Asterisk::AMI;perl=latest + + +=head1 AUTHOR + +Copyright (C) 2011 Frank DiGennaro + +=head1 LICENSE + +Gnu GPLv2 + +=begin comment + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; version 2 dated June, 1991. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, +USA. + +If you improve this script please send your version to my email +address with the copyright notice upgrade with your name. + +=end comment + +=head1 MAGIC MARKERS + + #%# family=contrib + +=cut + + use Carp; + use strict; + use Asterisk::AMI; + + eval "use Asterisk::AMI"; + print "Asterisk::AMI not found. Exiting...\n" if $@; + exit( 0 ) if $@; + + if ( $ARGV[ 0 ] and $ARGV[ 0 ] eq "config" ) { + print "graph_title Asterisk Fax - Memory Errors (T.38 and G.711)\n"; + print "graph_args --base 1000 -l 0\n"; + print "graph_vlabel Number of Memory Errors\n"; + print "graph_category asterisk\n"; + print "t38_errors.draw AREA\n"; + print "t38_errors.label T.38 Memory Errors\n"; + print "g711_errors.draw AREA\n"; + print "g711_errors.label G.711 Memory Errors\n"; + exit ( 0 ); + }; + + my $host = exists $ENV{ 'host' } ? $ENV{ 'host' } : "127.0.0.1"; + my $port = exists $ENV{ 'port' } ? $ENV{ 'port' } : "5038"; + my $timeout = exists $ENV{ 'timeout' } ? $ENV{ 'timeout' } : "5"; + my $username = $ENV{ 'username' }; + my $secret = $ENV{ 'secret' }; + + my $astman = Asterisk::AMI->new(PeerAddr => "$host", + PeerPort => "$port", + Username => "$username", + Secret => "$secret" + ); + + croak "Unable to connect to asterisk" unless ( $astman ); + my $actionid = $astman->send_action({ Action => 'Command', + Command => 'fax show stats', + $timeout}); + my $response = $astman->get_response( $actionid ); + my $arrayref = $response->{CMD}; + my $null = qq{}; + my ( %faxstats, $section ); + foreach my $line ( @$arrayref ) { + next if ( ( ! $line ) || ( $line =~ /-----------/ ) ); + my ( $key, $value ) = split( ':', $line ); + $section = $key if ( $value eq $null ); + $key =~ s/\s+$//g; + $value =~ s/^\s+//g; + $faxstats{ "$section" }{ "$key" } = $value if ( $value ne $null ); + }; + $astman->disconnect; + + print "t38_errors.value $faxstats{'Spandsp T.38'}{'Memory Error'}\n"; + print "g711_errors.value $faxstats{'Spandsp G.711'}{'Memory Error'}\n"; + + exit( 0 ); + + + diff --git a/plugins/asterisk/asterisk_18_fax_spandsp/asterisk_fax_negotiations_failed b/plugins/asterisk/asterisk_18_fax_spandsp/asterisk_fax_negotiations_failed new file mode 100755 index 00000000..f50d2922 --- /dev/null +++ b/plugins/asterisk/asterisk_18_fax_spandsp/asterisk_fax_negotiations_failed @@ -0,0 +1,133 @@ +#!/usr/bin/perl + +=head1 NAME + +asterisk_fax_* - Plugin to monitor Asterisk fax parameters. + +=head1 SUPPORTED VERSION + +This plugin supports Asterisk 1.8.* and the SpanDSP fax modules. + +=head1 CONFIGURATION + +The following configuration parameters are used by this plugin + + [asterisk*] + env.host - hostname to connect to. Defaults to localhost. + env.port - port number to connect to. Defaults to 5038. + env.username - username used for authentication. No default value. + env.secret - secret used for authentication. No default value. + env.timeout - AMI timeout value in seconds. Defaults to 5. + +The "username" and "secret" parameters are mandatory, and have no +defaults. + +=head1 DEFAULT CONFIGURATION + + [asterisk*] + env.username manager + env.secret insecure + env.host 127.0.0.1 + env.port 5038 + env.timeout 5 + +=head1 REQUIRED PERL MODULES + +This plugin requires the Asterisk::AMI module and its dependencies. +Its dependencies can be found here: +http://deps.cpantesters.org/?module=Asterisk::AMI;perl=latest + + +=head1 AUTHOR + +Copyright (C) 2011 Frank DiGennaro + +=head1 LICENSE + +Gnu GPLv2 + +=begin comment + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; version 2 dated June, 1991. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, +USA. + +If you improve this script please send your version to my email +address with the copyright notice upgrade with your name. + +=end comment + +=head1 MAGIC MARKERS + + #%# family=contrib + +=cut + + use Carp; + use strict; + use Asterisk::AMI; + + eval "use Asterisk::AMI"; + print "Asterisk::AMI not found. Exiting...\n" if $@; + exit( 0 ) if $@; + + if ( $ARGV[ 0 ] and $ARGV[ 0 ] eq "config" ) { + print "graph_title Asterisk Fax - Negotiations Failed (T.38 and G.711)\n"; + print "graph_args --base 1000 -l 0\n"; + print "graph_vlabel Number of Negotiations Failed\n"; + print "graph_category asterisk\n"; + print "t38_failed.draw AREA\n"; + print "t38_failed.label T.38 Negotiations Failed\n"; + print "g711_failed.draw AREA\n"; + print "g711_failed.label G.711 Negotiations Failed\n"; + exit ( 0 ); + }; + + my $host = exists $ENV{ 'host' } ? $ENV{ 'host' } : "127.0.0.1"; + my $port = exists $ENV{ 'port' } ? $ENV{ 'port' } : "5038"; + my $timeout = exists $ENV{ 'timeout' } ? $ENV{ 'timeout' } : "5"; + my $username = $ENV{ 'username' }; + my $secret = $ENV{ 'secret' }; + + my $astman = Asterisk::AMI->new(PeerAddr => "$host", + PeerPort => "$port", + Username => "$username", + Secret => "$secret" + ); + + croak "Unable to connect to asterisk" unless ( $astman ); + my $actionid = $astman->send_action({ Action => 'Command', + Command => 'fax show stats', + $timeout}); + my $response = $astman->get_response( $actionid ); + my $arrayref = $response->{CMD}; + my $null = qq{}; + my ( %faxstats, $section ); + foreach my $line ( @$arrayref ) { + next if ( ( ! $line ) || ( $line =~ /-----------/ ) ); + my ( $key, $value ) = split( ':', $line ); + $section = $key if ( $value eq $null ); + $key =~ s/\s+$//g; + $value =~ s/^\s+//g; + $faxstats{ "$section" }{ "$key" } = $value if ( $value ne $null ); + }; + $astman->disconnect; + + # Some idiot who wrote the SpanDSP code spelled "Negotiation" wrong. + print "t38_failed.value $faxstats{'Spandsp T.38'}{'Negotation Failed'}\n"; + print "g711_failed.value $faxstats{'Spandsp G.711'}{'Negotation Failed'}\n"; + + exit( 0 ); + + + diff --git a/plugins/asterisk/asterisk_18_fax_spandsp/asterisk_fax_nofax b/plugins/asterisk/asterisk_18_fax_spandsp/asterisk_fax_nofax new file mode 100755 index 00000000..21d8a942 --- /dev/null +++ b/plugins/asterisk/asterisk_18_fax_spandsp/asterisk_fax_nofax @@ -0,0 +1,132 @@ +#!/usr/bin/perl + +=head1 NAME + +asterisk_fax_* - Plugin to monitor Asterisk fax parameters. + +=head1 SUPPORTED VERSION + +This plugin supports Asterisk 1.8.* and the SpanDSP fax modules. + +=head1 CONFIGURATION + +The following configuration parameters are used by this plugin + + [asterisk*] + env.host - hostname to connect to. Defaults to localhost. + env.port - port number to connect to. Defaults to 5038. + env.username - username used for authentication. No default value. + env.secret - secret used for authentication. No default value. + env.timeout - AMI timeout value in seconds. Defaults to 5. + +The "username" and "secret" parameters are mandatory, and have no +defaults. + +=head1 DEFAULT CONFIGURATION + + [asterisk*] + env.username manager + env.secret insecure + env.host 127.0.0.1 + env.port 5038 + env.timeout 5 + +=head1 REQUIRED PERL MODULES + +This plugin requires the Asterisk::AMI module and its dependencies. +Its dependencies can be found here: +http://deps.cpantesters.org/?module=Asterisk::AMI;perl=latest + + +=head1 AUTHOR + +Copyright (C) 2011 Frank DiGennaro + +=head1 LICENSE + +Gnu GPLv2 + +=begin comment + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; version 2 dated June, 1991. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, +USA. + +If you improve this script please send your version to my email +address with the copyright notice upgrade with your name. + +=end comment + +=head1 MAGIC MARKERS + + #%# family=contrib + +=cut + + use Carp; + use strict; + use Asterisk::AMI; + + eval "use Asterisk::AMI"; + print "Asterisk::AMI not found. Exiting...\n" if $@; + exit( 0 ) if $@; + + if ( $ARGV[ 0 ] and $ARGV[ 0 ] eq "config" ) { + print "graph_title Asterisk Fax - No Faxes (T.38 and G.711)\n"; + print "graph_args --base 1000 -l 0\n"; + print "graph_vlabel Number of No Faxes\n"; + print "graph_category asterisk\n"; + print "t38_nofax.draw AREA\n"; + print "t38_nofax.label No T.38 Faxes\n"; + print "g711_nofax.draw AREA\n"; + print "g711_nofax.label No G.711 Faxes\n"; + exit ( 0 ); + }; + + my $host = exists $ENV{ 'host' } ? $ENV{ 'host' } : "127.0.0.1"; + my $port = exists $ENV{ 'port' } ? $ENV{ 'port' } : "5038"; + my $timeout = exists $ENV{ 'timeout' } ? $ENV{ 'timeout' } : "5"; + my $username = $ENV{ 'username' }; + my $secret = $ENV{ 'secret' }; + + my $astman = Asterisk::AMI->new(PeerAddr => "$host", + PeerPort => "$port", + Username => "$username", + Secret => "$secret" + ); + + croak "Unable to connect to asterisk" unless ( $astman ); + my $actionid = $astman->send_action({ Action => 'Command', + Command => 'fax show stats', + $timeout}); + my $response = $astman->get_response( $actionid ); + my $arrayref = $response->{CMD}; + my $null = qq{}; + my ( %faxstats, $section ); + foreach my $line ( @$arrayref ) { + next if ( ( ! $line ) || ( $line =~ /-----------/ ) ); + my ( $key, $value ) = split( ':', $line ); + $section = $key if ( $value eq $null ); + $key =~ s/\s+$//g; + $value =~ s/^\s+//g; + $faxstats{ "$section" }{ "$key" } = $value if ( $value ne $null ); + }; + $astman->disconnect; + + print "t38_nofax.value $faxstats{'Spandsp T.38'}{'No FAX'}\n"; + print "g711_nofax.value $faxstats{'Spandsp G.711'}{'No FAX'}\n"; + + exit( 0 ); + + + diff --git a/plugins/asterisk/asterisk_18_fax_spandsp/asterisk_fax_protocol_error b/plugins/asterisk/asterisk_18_fax_spandsp/asterisk_fax_protocol_error new file mode 100755 index 00000000..fe065bf8 --- /dev/null +++ b/plugins/asterisk/asterisk_18_fax_spandsp/asterisk_fax_protocol_error @@ -0,0 +1,132 @@ +#!/usr/bin/perl + +=head1 NAME + +asterisk_fax_* - Plugin to monitor Asterisk fax parameters. + +=head1 SUPPORTED VERSION + +This plugin supports Asterisk 1.8.* and the SpanDSP fax modules. + +=head1 CONFIGURATION + +The following configuration parameters are used by this plugin + + [asterisk*] + env.host - hostname to connect to. Defaults to localhost. + env.port - port number to connect to. Defaults to 5038. + env.username - username used for authentication. No default value. + env.secret - secret used for authentication. No default value. + env.timeout - AMI timeout value in seconds. Defaults to 5. + +The "username" and "secret" parameters are mandatory, and have no +defaults. + +=head1 DEFAULT CONFIGURATION + + [asterisk*] + env.username manager + env.secret insecure + env.host 127.0.0.1 + env.port 5038 + env.timeout 5 + +=head1 REQUIRED PERL MODULES + +This plugin requires the Asterisk::AMI module and its dependencies. +Its dependencies can be found here: +http://deps.cpantesters.org/?module=Asterisk::AMI;perl=latest + + +=head1 AUTHOR + +Copyright (C) 2011 Frank DiGennaro + +=head1 LICENSE + +Gnu GPLv2 + +=begin comment + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; version 2 dated June, 1991. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, +USA. + +If you improve this script please send your version to my email +address with the copyright notice upgrade with your name. + +=end comment + +=head1 MAGIC MARKERS + + #%# family=contrib + +=cut + + use Carp; + use strict; + use Asterisk::AMI; + + eval "use Asterisk::AMI"; + print "Asterisk::AMI not found. Exiting...\n" if $@; + exit( 0 ) if $@; + + if ( $ARGV[ 0 ] and $ARGV[ 0 ] eq "config" ) { + print "graph_title Asterisk Fax - Protocol Errors (T.38 and G.711)\n"; + print "graph_args --base 1000 -l 0\n"; + print "graph_vlabel Number of Protocol Errors\n"; + print "graph_category asterisk\n"; + print "t38_proterror.draw AREA\n"; + print "t38_proterror.label T.38 Protocol Errors\n"; + print "g711_proterror.draw AREA\n"; + print "g711_proterror.label G.711 Protocol Errors\n"; + exit ( 0 ); + }; + + my $host = exists $ENV{ 'host' } ? $ENV{ 'host' } : "127.0.0.1"; + my $port = exists $ENV{ 'port' } ? $ENV{ 'port' } : "5038"; + my $timeout = exists $ENV{ 'timeout' } ? $ENV{ 'timeout' } : "5"; + my $username = $ENV{ 'username' }; + my $secret = $ENV{ 'secret' }; + + my $astman = Asterisk::AMI->new(PeerAddr => "$host", + PeerPort => "$port", + Username => "$username", + Secret => "$secret" + ); + + croak "Unable to connect to asterisk" unless ( $astman ); + my $actionid = $astman->send_action({ Action => 'Command', + Command => 'fax show stats', + $timeout}); + my $response = $astman->get_response( $actionid ); + my $arrayref = $response->{CMD}; + my $null = qq{}; + my ( %faxstats, $section ); + foreach my $line ( @$arrayref ) { + next if ( ( ! $line ) || ( $line =~ /-----------/ ) ); + my ( $key, $value ) = split( ':', $line ); + $section = $key if ( $value eq $null ); + $key =~ s/\s+$//g; + $value =~ s/^\s+//g; + $faxstats{ "$section" }{ "$key" } = $value if ( $value ne $null ); + }; + $astman->disconnect; + + print "t38_proterror.value $faxstats{'Spandsp T.38'}{'Protocol Error'}\n"; + print "g711_proterror.value $faxstats{'Spandsp G.711'}{'Protocol Error'}\n"; + + exit( 0 ); + + + diff --git a/plugins/asterisk/asterisk_18_fax_spandsp/asterisk_fax_retries_exceeded b/plugins/asterisk/asterisk_18_fax_spandsp/asterisk_fax_retries_exceeded new file mode 100755 index 00000000..dfb0d64c --- /dev/null +++ b/plugins/asterisk/asterisk_18_fax_spandsp/asterisk_fax_retries_exceeded @@ -0,0 +1,132 @@ +#!/usr/bin/perl + +=head1 NAME + +asterisk_fax_* - Plugin to monitor Asterisk fax parameters. + +=head1 SUPPORTED VERSION + +This plugin supports Asterisk 1.8.* and the SpanDSP fax modules. + +=head1 CONFIGURATION + +The following configuration parameters are used by this plugin + + [asterisk*] + env.host - hostname to connect to. Defaults to localhost. + env.port - port number to connect to. Defaults to 5038. + env.username - username used for authentication. No default value. + env.secret - secret used for authentication. No default value. + env.timeout - AMI timeout value in seconds. Defaults to 5. + +The "username" and "secret" parameters are mandatory, and have no +defaults. + +=head1 DEFAULT CONFIGURATION + + [asterisk*] + env.username manager + env.secret insecure + env.host 127.0.0.1 + env.port 5038 + env.timeout 5 + +=head1 REQUIRED PERL MODULES + +This plugin requires the Asterisk::AMI module and its dependencies. +Its dependencies can be found here: +http://deps.cpantesters.org/?module=Asterisk::AMI;perl=latest + + +=head1 AUTHOR + +Copyright (C) 2011 Frank DiGennaro + +=head1 LICENSE + +Gnu GPLv2 + +=begin comment + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; version 2 dated June, 1991. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, +USA. + +If you improve this script please send your version to my email +address with the copyright notice upgrade with your name. + +=end comment + +=head1 MAGIC MARKERS + + #%# family=contrib + +=cut + + use Carp; + use strict; + use Asterisk::AMI; + + eval "use Asterisk::AMI"; + print "Asterisk::AMI not found. Exiting...\n" if $@; + exit( 0 ) if $@; + + if ( $ARGV[ 0 ] and $ARGV[ 0 ] eq "config" ) { + print "graph_title Asterisk Fax - Retries Exceeded (T.38 and G.711)\n"; + print "graph_args --base 1000 -l 0\n"; + print "graph_vlabel Retries Exceeded\n"; + print "graph_category asterisk\n"; + print "t38_retries.draw AREA\n"; + print "t38_retries.label T.38 Retries Exceeded\n"; + print "g711_retries.draw AREA\n"; + print "g711_retries.label G.711 Retries Exceeded\n"; + exit ( 0 ); + }; + + my $host = exists $ENV{ 'host' } ? $ENV{ 'host' } : "127.0.0.1"; + my $port = exists $ENV{ 'port' } ? $ENV{ 'port' } : "5038"; + my $timeout = exists $ENV{ 'timeout' } ? $ENV{ 'timeout' } : "5"; + my $username = $ENV{ 'username' }; + my $secret = $ENV{ 'secret' }; + + my $astman = Asterisk::AMI->new(PeerAddr => "$host", + PeerPort => "$port", + Username => "$username", + Secret => "$secret" + ); + + croak "Unable to connect to asterisk" unless ( $astman ); + my $actionid = $astman->send_action({ Action => 'Command', + Command => 'fax show stats', + $timeout}); + my $response = $astman->get_response( $actionid ); + my $arrayref = $response->{CMD}; + my $null = qq{}; + my ( %faxstats, $section ); + foreach my $line ( @$arrayref ) { + next if ( ( ! $line ) || ( $line =~ /-----------/ ) ); + my ( $key, $value ) = split( ':', $line ); + $section = $key if ( $value eq $null ); + $key =~ s/\s+$//g; + $value =~ s/^\s+//g; + $faxstats{ "$section" }{ "$key" } = $value if ( $value ne $null ); + }; + $astman->disconnect; + + print "t38_retries.value $faxstats{'Spandsp T.38'}{'Retries Exceeded'}\n"; + print "g711_retries.value $faxstats{'Spandsp G.711'}{'Retries Exceeded'}\n"; + + exit( 0 ); + + + diff --git a/plugins/asterisk/asterisk_18_fax_spandsp/asterisk_fax_rxtx_protocol_error b/plugins/asterisk/asterisk_18_fax_spandsp/asterisk_fax_rxtx_protocol_error new file mode 100755 index 00000000..3efed790 --- /dev/null +++ b/plugins/asterisk/asterisk_18_fax_spandsp/asterisk_fax_rxtx_protocol_error @@ -0,0 +1,138 @@ +#!/usr/bin/perl + +=head1 NAME + +asterisk_fax_* - Plugin to monitor Asterisk fax parameters. + +=head1 SUPPORTED VERSION + +This plugin supports Asterisk 1.8.* and the SpanDSP fax modules. + +=head1 CONFIGURATION + +The following configuration parameters are used by this plugin + + [asterisk*] + env.host - hostname to connect to. Defaults to localhost. + env.port - port number to connect to. Defaults to 5038. + env.username - username used for authentication. No default value. + env.secret - secret used for authentication. No default value. + env.timeout - AMI timeout value in seconds. Defaults to 5. + +The "username" and "secret" parameters are mandatory, and have no +defaults. + +=head1 DEFAULT CONFIGURATION + + [asterisk*] + env.username manager + env.secret insecure + env.host 127.0.0.1 + env.port 5038 + env.timeout 5 + +=head1 REQUIRED PERL MODULES + +This plugin requires the Asterisk::AMI module and its dependencies. +Its dependencies can be found here: +http://deps.cpantesters.org/?module=Asterisk::AMI;perl=latest + + +=head1 AUTHOR + +Copyright (C) 2011 Frank DiGennaro + +=head1 LICENSE + +Gnu GPLv2 + +=begin comment + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; version 2 dated June, 1991. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, +USA. + +If you improve this script please send your version to my email +address with the copyright notice upgrade with your name. + +=end comment + +=head1 MAGIC MARKERS + + #%# family=contrib + +=cut + + use Carp; + use strict; + use Asterisk::AMI; + + eval "use Asterisk::AMI"; + print "Asterisk::AMI not found. Exiting...\n" if $@; + exit( 0 ) if $@; + + if ( $ARGV[ 0 ] and $ARGV[ 0 ] eq "config" ) { + print "graph_title Asterisk Fax - Rx and Tx Protocol Errors (T.38 and G.711)\n"; + print "graph_args --base 1000 -l 0\n"; + print "graph_vlabel Number of Protocol Errors\n"; + print "graph_category asterisk\n"; + print "t38_rx_proterror.draw AREA\n"; + print "t38_rx_proterror.label T.38 Rx Protocol Errors\n"; + print "t38_tx_proterror.draw AREA\n"; + print "t38_tx_proterror.label T.38 Tx Protocol Errors\n"; + print "g711_rx_proterror.draw AREA\n"; + print "g711_rx_proterror.label G.711 Rx Protocol Errors\n"; + print "g711_tx_proterror.draw AREA\n"; + print "g711_tx_proterror.label G.711 Tx Protocol Errors\n"; + exit ( 0 ); + }; + + my $host = exists $ENV{ 'host' } ? $ENV{ 'host' } : "127.0.0.1"; + my $port = exists $ENV{ 'port' } ? $ENV{ 'port' } : "5038"; + my $timeout = exists $ENV{ 'timeout' } ? $ENV{ 'timeout' } : "5"; + my $username = $ENV{ 'username' }; + my $secret = $ENV{ 'secret' }; + + my $astman = Asterisk::AMI->new(PeerAddr => "$host", + PeerPort => "$port", + Username => "$username", + Secret => "$secret" + ); + + croak "Unable to connect to asterisk" unless ( $astman ); + my $actionid = $astman->send_action({ Action => 'Command', + Command => 'fax show stats', + $timeout}); + my $response = $astman->get_response( $actionid ); + my $arrayref = $response->{CMD}; + my $null = qq{}; + my ( %faxstats, $section ); + foreach my $line ( @$arrayref ) { + next if ( ( ! $line ) || ( $line =~ /-----------/ ) ); + my ( $key, $value ) = split( ':', $line ); + $section = $key if ( $value eq $null ); + $key =~ s/\s+$//g; + $value =~ s/^\s+//g; + $faxstats{ "$section" }{ "$key" } = $value if ( $value ne $null ); + }; + $astman->disconnect; + + print "t38_rx_proterror.value $faxstats{'Spandsp T.38'}{'RX Protocol Error'}\n"; + print "t38_tx_proterror.value $faxstats{'Spandsp T.38'}{'TX Protocol Error'}\n"; + print "g711_rx_proterror.value $faxstats{'Spandsp G.711'}{'RX Protocol Error'}\n"; + print "g711_tx_proterror.value $faxstats{'Spandsp G.711'}{'TX Protocol Error'}\n"; + + exit( 0 ); + + + diff --git a/plugins/asterisk/asterisk_18_fax_spandsp/asterisk_fax_success b/plugins/asterisk/asterisk_18_fax_spandsp/asterisk_fax_success new file mode 100755 index 00000000..677d0d72 --- /dev/null +++ b/plugins/asterisk/asterisk_18_fax_spandsp/asterisk_fax_success @@ -0,0 +1,132 @@ +#!/usr/bin/perl + +=head1 NAME + +asterisk_fax_* - Plugin to monitor Asterisk fax parameters. + +=head1 SUPPORTED VERSION + +This plugin supports Asterisk 1.8.* and the SpanDSP fax modules. + +=head1 CONFIGURATION + +The following configuration parameters are used by this plugin + + [asterisk*] + env.host - hostname to connect to. Defaults to localhost. + env.port - port number to connect to. Defaults to 5038. + env.username - username used for authentication. No default value. + env.secret - secret used for authentication. No default value. + env.timeout - AMI timeout value in seconds. Defaults to 5. + +The "username" and "secret" parameters are mandatory, and have no +defaults. + +=head1 DEFAULT CONFIGURATION + + [asterisk*] + env.username manager + env.secret insecure + env.host 127.0.0.1 + env.port 5038 + env.timeout 5 + +=head1 REQUIRED PERL MODULES + +This plugin requires the Asterisk::AMI module and its dependencies. +Its dependencies can be found here: +http://deps.cpantesters.org/?module=Asterisk::AMI;perl=latest + + +=head1 AUTHOR + +Copyright (C) 2011 Frank DiGennaro + +=head1 LICENSE + +Gnu GPLv2 + +=begin comment + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; version 2 dated June, 1991. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, +USA. + +If you improve this script please send your version to my email +address with the copyright notice upgrade with your name. + +=end comment + +=head1 MAGIC MARKERS + + #%# family=contrib + +=cut + + use Carp; + use strict; + use Asterisk::AMI; + + eval "use Asterisk::AMI"; + print "Asterisk::AMI not found. Exiting...\n" if $@; + exit( 0 ) if $@; + + if ( $ARGV[ 0 ] and $ARGV[ 0 ] eq "config" ) { + print "graph_title Asterisk Fax - Successful Faxes (T.38 and G.711)\n"; + print "graph_args --base 1000 -l 0\n"; + print "graph_vlabel Number of Successful Faxes\n"; + print "graph_category asterisk\n"; + print "t38_success.draw AREA\n"; + print "t38_success.label Successful T.38 Faxes\n"; + print "g711_success.draw AREA\n"; + print "g711_success.label Successful G.711 Faxes\n"; + exit ( 0 ); + }; + + my $host = exists $ENV{ 'host' } ? $ENV{ 'host' } : "127.0.0.1"; + my $port = exists $ENV{ 'port' } ? $ENV{ 'port' } : "5038"; + my $timeout = exists $ENV{ 'timeout' } ? $ENV{ 'timeout' } : "5"; + my $username = $ENV{ 'username' }; + my $secret = $ENV{ 'secret' }; + + my $astman = Asterisk::AMI->new(PeerAddr => "$host", + PeerPort => "$port", + Username => "$username", + Secret => "$secret" + ); + + croak "Unable to connect to asterisk" unless ( $astman ); + my $actionid = $astman->send_action({ Action => 'Command', + Command => 'fax show stats', + $timeout}); + my $response = $astman->get_response( $actionid ); + my $arrayref = $response->{CMD}; + my $null = qq{}; + my ( %faxstats, $section ); + foreach my $line ( @$arrayref ) { + next if ( ( ! $line ) || ( $line =~ /-----------/ ) ); + my ( $key, $value ) = split( ':', $line ); + $section = $key if ( $value eq $null ); + $key =~ s/\s+$//g; + $value =~ s/^\s+//g; + $faxstats{ "$section" }{ "$key" } = $value if ( $value ne $null ); + }; + $astman->disconnect; + + print "t38_success.value $faxstats{'Spandsp T.38'}{'Success'}\n"; + print "g711_success.value $faxstats{'Spandsp G.711'}{'Success'}\n"; + + exit( 0 ); + + + diff --git a/plugins/asterisk/asterisk_18_fax_spandsp/asterisk_fax_switched2t38 b/plugins/asterisk/asterisk_18_fax_spandsp/asterisk_fax_switched2t38 new file mode 100755 index 00000000..8b029859 --- /dev/null +++ b/plugins/asterisk/asterisk_18_fax_spandsp/asterisk_fax_switched2t38 @@ -0,0 +1,130 @@ +#!/usr/bin/perl + +=head1 NAME + +asterisk_fax_* - Plugin to monitor Asterisk fax parameters. + +=head1 SUPPORTED VERSION + +This plugin supports Asterisk 1.8.* and the SpanDSP fax modules. + +=head1 CONFIGURATION + +The following configuration parameters are used by this plugin + + [asterisk*] + env.host - hostname to connect to. Defaults to localhost. + env.port - port number to connect to. Defaults to 5038. + env.username - username used for authentication. No default value. + env.secret - secret used for authentication. No default value. + env.timeout - AMI timeout value in seconds. Defaults to 5. + +The "username" and "secret" parameters are mandatory, and have no +defaults. + +=head1 DEFAULT CONFIGURATION + + [asterisk*] + env.username manager + env.secret insecure + env.host 127.0.0.1 + env.port 5038 + env.timeout 5 + +=head1 REQUIRED PERL MODULES + +This plugin requires the Asterisk::AMI module and its dependencies. +Its dependencies can be found here: +http://deps.cpantesters.org/?module=Asterisk::AMI;perl=latest + + +=head1 AUTHOR + +Copyright (C) 2011 Frank DiGennaro + +=head1 LICENSE + +Gnu GPLv2 + +=begin comment + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; version 2 dated June, 1991. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, +USA. + +If you improve this script please send your version to my email +address with the copyright notice upgrade with your name. + +=end comment + +=head1 MAGIC MARKERS + + #%# family=contrib + +=cut + + use Carp; + use strict; + use Asterisk::AMI; + + eval "use Asterisk::AMI"; + print "Asterisk::AMI not found. Exiting...\n" if $@; + exit( 0 ) if $@; + + if ( $ARGV[ 0 ] and $ARGV[ 0 ] eq "config" ) { + print "graph_title Asterisk Fax - Switched to T.38\n"; + print "graph_args --base 1000 -l 0\n"; + print "graph_vlabel Number of Switches to T.38\n"; + print "graph_category asterisk\n"; + print "switched.draw AREA\n"; + print "switched.label Switched to T.38\n"; + exit 0; + }; + + my $host = exists $ENV{ 'host' } ? $ENV{ 'host' } : "127.0.0.1"; + my $port = exists $ENV{ 'port' } ? $ENV{ 'port' } : "5038"; + my $timeout = exists $ENV{ 'timeout' } ? $ENV{ 'timeout' } : "5"; + my $username = $ENV{ 'username' }; + my $secret = $ENV{ 'secret' }; + + my $astman = Asterisk::AMI->new(PeerAddr => "$host", + PeerPort => "$port", + Username => "$username", + Secret => "$secret" + ); + + croak "Unable to connect to asterisk" unless ( $astman ); + my $actionid = $astman->send_action({ Action => 'Command', + Command => 'fax show stats', + $timeout}); + my $response = $astman->get_response( $actionid ); + my $arrayref = $response->{CMD}; + my $null = qq{}; + my ( %faxstats, $section ); + foreach my $line ( @$arrayref ) { + next if ( ( ! $line ) || ( $line =~ /-----------/ ) ); + my ( $key, $value ) = split( ':', $line ); + $section = $key if ( $value eq $null ); + $key =~ s/\s+$//g; + $value =~ s/^\s+//g; + $faxstats{ "$section" }{ "$key" } = $value if ( $value ne $null ); + }; + $astman->disconnect; + + my $switched = $faxstats{'Spandsp G.711'}{'Switched to T.38'}; + print "switched.value $switched\n"; + + exit( 0 ); + + + diff --git a/plugins/asterisk/asterisk_18_fax_spandsp/asterisk_fax_train_failure b/plugins/asterisk/asterisk_18_fax_spandsp/asterisk_fax_train_failure new file mode 100755 index 00000000..b0852d68 --- /dev/null +++ b/plugins/asterisk/asterisk_18_fax_spandsp/asterisk_fax_train_failure @@ -0,0 +1,132 @@ +#!/usr/bin/perl + +=head1 NAME + +asterisk_fax_* - Plugin to monitor Asterisk fax parameters. + +=head1 SUPPORTED VERSION + +This plugin supports Asterisk 1.8.* and the SpanDSP fax modules. + +=head1 CONFIGURATION + +The following configuration parameters are used by this plugin + + [asterisk*] + env.host - hostname to connect to. Defaults to localhost. + env.port - port number to connect to. Defaults to 5038. + env.username - username used for authentication. No default value. + env.secret - secret used for authentication. No default value. + env.timeout - AMI timeout value in seconds. Defaults to 5. + +The "username" and "secret" parameters are mandatory, and have no +defaults. + +=head1 DEFAULT CONFIGURATION + + [asterisk*] + env.username manager + env.secret insecure + env.host 127.0.0.1 + env.port 5038 + env.timeout 5 + +=head1 REQUIRED PERL MODULES + +This plugin requires the Asterisk::AMI module and its dependencies. +Its dependencies can be found here: +http://deps.cpantesters.org/?module=Asterisk::AMI;perl=latest + + +=head1 AUTHOR + +Copyright (C) 2011 Frank DiGennaro + +=head1 LICENSE + +Gnu GPLv2 + +=begin comment + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; version 2 dated June, 1991. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, +USA. + +If you improve this script please send your version to my email +address with the copyright notice upgrade with your name. + +=end comment + +=head1 MAGIC MARKERS + + #%# family=contrib + +=cut + + use Carp; + use strict; + use Asterisk::AMI; + + eval "use Asterisk::AMI"; + print "Asterisk::AMI not found. Exiting...\n" if $@; + exit( 0 ) if $@; + + if ( $ARGV[ 0 ] and $ARGV[ 0 ] eq "config" ) { + print "graph_title Asterisk Fax - Train Failures (T.38 and G.711)\n"; + print "graph_args --base 1000 -l 0\n"; + print "graph_vlabel Number of Train Failures\n"; + print "graph_category asterisk\n"; + print "t38_failure.draw AREA\n"; + print "t38_failure.label T.38 Train Failures\n"; + print "g711_failure.draw AREA\n"; + print "g711_failure.label G.711 Train Failures\n"; + exit ( 0 ); + }; + + my $host = exists $ENV{ 'host' } ? $ENV{ 'host' } : "127.0.0.1"; + my $port = exists $ENV{ 'port' } ? $ENV{ 'port' } : "5038"; + my $timeout = exists $ENV{ 'timeout' } ? $ENV{ 'timeout' } : "5"; + my $username = $ENV{ 'username' }; + my $secret = $ENV{ 'secret' }; + + my $astman = Asterisk::AMI->new(PeerAddr => "$host", + PeerPort => "$port", + Username => "$username", + Secret => "$secret" + ); + + croak "Unable to connect to asterisk" unless ( $astman ); + my $actionid = $astman->send_action({ Action => 'Command', + Command => 'fax show stats', + $timeout}); + my $response = $astman->get_response( $actionid ); + my $arrayref = $response->{CMD}; + my $null = qq{}; + my ( %faxstats, $section ); + foreach my $line ( @$arrayref ) { + next if ( ( ! $line ) || ( $line =~ /-----------/ ) ); + my ( $key, $value ) = split( ':', $line ); + $section = $key if ( $value eq $null ); + $key =~ s/\s+$//g; + $value =~ s/^\s+//g; + $faxstats{ "$section" }{ "$key" } = $value if ( $value ne $null ); + }; + $astman->disconnect; + + print "t38_failure.value $faxstats{'Spandsp T.38'}{'Train Failure'}\n"; + print "g711_failure.value $faxstats{'Spandsp G.711'}{'Train Failure'}\n"; + + exit( 0 ); + + + diff --git a/plugins/asterisk/asterisk_18_fax_spandsp/asterisk_fax_txrx_attempts b/plugins/asterisk/asterisk_18_fax_spandsp/asterisk_fax_txrx_attempts new file mode 100755 index 00000000..7f61b968 --- /dev/null +++ b/plugins/asterisk/asterisk_18_fax_spandsp/asterisk_fax_txrx_attempts @@ -0,0 +1,134 @@ +#!/usr/bin/perl + +=head1 NAME + +asterisk_fax_* - Plugin to monitor Asterisk fax parameters. + +=head1 SUPPORTED VERSION + +This plugin supports Asterisk 1.8.* and the SpanDSP fax modules. + +=head1 CONFIGURATION + +The following configuration parameters are used by this plugin + + [asterisk*] + env.host - hostname to connect to. Defaults to localhost. + env.port - port number to connect to. Defaults to 5038. + env.username - username used for authentication. No default value. + env.secret - secret used for authentication. No default value. + env.timeout - AMI timeout value in seconds. Defaults to 5. + +The "username" and "secret" parameters are mandatory, and have no +defaults. + +=head1 DEFAULT CONFIGURATION + + [asterisk*] + env.username manager + env.secret insecure + env.host 127.0.0.1 + env.port 5038 + env.timeout 5 + +=head1 REQUIRED PERL MODULES + +This plugin requires the Asterisk::AMI module and its dependencies. +Its dependencies can be found here: +http://deps.cpantesters.org/?module=Asterisk::AMI;perl=latest + + +=head1 AUTHOR + +Copyright (C) 2011 Frank DiGennaro + +=head1 LICENSE + +Gnu GPLv2 + +=begin comment + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; version 2 dated June, 1991. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, +USA. + +If you improve this script please send your version to my email +address with the copyright notice upgrade with your name. + +=end comment + +=head1 MAGIC MARKERS + + #%# family=contrib + +=cut + + use Carp; + use strict; + use Asterisk::AMI; + + eval "use Asterisk::AMI"; + print "Asterisk::AMI not found. Exiting...\n" if $@; + exit( 0 ) if $@; + + if ( $ARGV[ 0 ] and $ARGV[ 0 ] eq "config" ) { + print "graph_title Asterisk Fax - Tx/Rx Attempts\n"; + print "graph_args --base 1000 -l 0\n"; + print "graph_vlabel Number of Tx and Rx Attempts\n"; + print "graph_category asterisk\n"; + print "transmit.draw AREA\n"; + print "transmit.label Tx Attempts\n"; + print "receive.draw AREA\n"; + print "receive.label Rx Attempts\n"; + exit 0; + }; + + my $host = exists $ENV{ 'host' } ? $ENV{ 'host' } : "127.0.0.1"; + my $port = exists $ENV{ 'port' } ? $ENV{ 'port' } : "5038"; + my $timeout = exists $ENV{ 'timeout' } ? $ENV{ 'timeout' } : "5"; + my $username = $ENV{ 'username' }; + my $secret = $ENV{ 'secret' }; + + my $astman = Asterisk::AMI->new(PeerAddr => "$host", + PeerPort => "$port", + Username => "$username", + Secret => "$secret" + ); + + croak "Unable to connect to asterisk" unless ( $astman ); + my $actionid = $astman->send_action({ Action => 'Command', + Command => 'fax show stats', + $timeout}); + my $response = $astman->get_response( $actionid ); + my $arrayref = $response->{CMD}; + my $null = qq{}; + my ( %faxstats, $section ); + foreach my $line ( @$arrayref ) { + next if ( ( ! $line ) || ( $line =~ /-----------/ ) ); + my ( $key, $value ) = split( ':', $line ); + $section = $key if ( $value eq $null ); + $key =~ s/\s+$//g; + $value =~ s/^\s+//g; + $faxstats{ "$section" }{ "$key" } = $value if ( $value ne $null ); + }; + $astman->disconnect; + + my $txstats = $faxstats{'FAX Statistics'}{'Transmit Attempts'}; + my $rxstats = $faxstats{'FAX Statistics'}{'Receive Attempts'}; + print "transmit.value $txstats\n"; + print "receive.value $rxstats\n"; + + exit( 0 ); + + + diff --git a/plugins/asterisk/asterisk_18_fax_spandsp/asterisk_fax_unknown_error b/plugins/asterisk/asterisk_18_fax_spandsp/asterisk_fax_unknown_error new file mode 100755 index 00000000..10b40354 --- /dev/null +++ b/plugins/asterisk/asterisk_18_fax_spandsp/asterisk_fax_unknown_error @@ -0,0 +1,132 @@ +#!/usr/bin/perl + +=head1 NAME + +asterisk_fax_* - Plugin to monitor Asterisk fax parameters. + +=head1 SUPPORTED VERSION + +This plugin supports Asterisk 1.8.* and the SpanDSP fax modules. + +=head1 CONFIGURATION + +The following configuration parameters are used by this plugin + + [asterisk*] + env.host - hostname to connect to. Defaults to localhost. + env.port - port number to connect to. Defaults to 5038. + env.username - username used for authentication. No default value. + env.secret - secret used for authentication. No default value. + env.timeout - AMI timeout value in seconds. Defaults to 5. + +The "username" and "secret" parameters are mandatory, and have no +defaults. + +=head1 DEFAULT CONFIGURATION + + [asterisk*] + env.username manager + env.secret insecure + env.host 127.0.0.1 + env.port 5038 + env.timeout 5 + +=head1 REQUIRED PERL MODULES + +This plugin requires the Asterisk::AMI module and its dependencies. +Its dependencies can be found here: +http://deps.cpantesters.org/?module=Asterisk::AMI;perl=latest + + +=head1 AUTHOR + +Copyright (C) 2011 Frank DiGennaro + +=head1 LICENSE + +Gnu GPLv2 + +=begin comment + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; version 2 dated June, 1991. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, +USA. + +If you improve this script please send your version to my email +address with the copyright notice upgrade with your name. + +=end comment + +=head1 MAGIC MARKERS + + #%# family=contrib + +=cut + + use Carp; + use strict; + use Asterisk::AMI; + + eval "use Asterisk::AMI"; + print "Asterisk::AMI not found. Exiting...\n" if $@; + exit( 0 ) if $@; + + if ( $ARGV[ 0 ] and $ARGV[ 0 ] eq "config" ) { + print "graph_title Asterisk Fax - Unknown Errors (T.38 and G.711)\n"; + print "graph_args --base 1000 -l 0\n"; + print "graph_vlabel Number of Unknown Errors\n"; + print "graph_category asterisk\n"; + print "t38_errors.draw AREA\n"; + print "t38_errors.label T.38 Unknown Errors\n"; + print "g711_errors.draw AREA\n"; + print "g711_errors.label G.711 Unknown Errors\n"; + exit ( 0 ); + }; + + my $host = exists $ENV{ 'host' } ? $ENV{ 'host' } : "127.0.0.1"; + my $port = exists $ENV{ 'port' } ? $ENV{ 'port' } : "5038"; + my $timeout = exists $ENV{ 'timeout' } ? $ENV{ 'timeout' } : "5"; + my $username = $ENV{ 'username' }; + my $secret = $ENV{ 'secret' }; + + my $astman = Asterisk::AMI->new(PeerAddr => "$host", + PeerPort => "$port", + Username => "$username", + Secret => "$secret" + ); + + croak "Unable to connect to asterisk" unless ( $astman ); + my $actionid = $astman->send_action({ Action => 'Command', + Command => 'fax show stats', + $timeout}); + my $response = $astman->get_response( $actionid ); + my $arrayref = $response->{CMD}; + my $null = qq{}; + my ( %faxstats, $section ); + foreach my $line ( @$arrayref ) { + next if ( ( ! $line ) || ( $line =~ /-----------/ ) ); + my ( $key, $value ) = split( ':', $line ); + $section = $key if ( $value eq $null ); + $key =~ s/\s+$//g; + $value =~ s/^\s+//g; + $faxstats{ "$section" }{ "$key" } = $value if ( $value ne $null ); + }; + $astman->disconnect; + + print "t38_errors.value $faxstats{'Spandsp T.38'}{'Unknown Error'}\n"; + print "g711_errors.value $faxstats{'Spandsp G.711'}{'Unknown Error'}\n"; + + exit( 0 ); + + + diff --git a/plugins/other/asterisk-fax b/plugins/other/asterisk-fax deleted file mode 100755 index 35ddb87e8416333865753908ab71d69085010576..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 9221 zcmZvgXH-+|m$yR)Y0{ez1QnGks5Bucy;nhMP_>I2q;yWp$JHq z-U%&&(mNp`=gsrZ%v$68pLKmmzTNBGXYYOe_5ml+(#rP;>VqgA`v*Arx%qoQogart z1U&WwZ6PE4XEk2OpUXlz)s8u_x#}$8ft&uU6=I=*Yh1`HJMy*Drmn12M(=2;L0%2b z3qz4gZ^@)UwEd|C_P5RgKVC|74Pssh;~l!~92aR1O9t>+{HWroY?CIFoROpc4!43Vq+QwRge9c zu@rLvhIgZBo8QS48V)*cPnY2qMZT^QPMVPB;lv!T5f94&yAuJAieL+_K7I&rf}Ta< z7q($8jf&MR+U3Wa?E=Z-$6>qfXmed#I!rZx(CsYv(;~5_(}jwGlTQxs#d!|@z$ zv0pMGNTrC`3_43g6B|GFY%lzYXvOhDv$9SV=-R=shkf%VPgY5b6wmX&$g7q}W8IEQ$=oE}YiML)^Royp$?G3cR&a67`>Q^?Pz z?1#1vmckz>s$mT0hM%@`@a><3TVQuOQbuuD*sQ3`uvZ;e6a8z_e%&v=6WsA8Z?uhP zFqR(1EBF2>4c}&MUspR5UM{zP>&FY9lzWP_If4)gFQKOrUcmxS*YtYMF=WA_T2OQH8n3@yRn&sOix!O8oMKn~?tS4vmf* zup!Akd5B7#3#8PRvTd_xTcQ;AYS>eb(G$|lXS>s}ZPTRKV}@_;p$}bH&yd z!(sk5Wm^r^L#Tr#A^TYvvt^l^aOl$1C&y z0z0TmGM^kn^Ng;9-a=M$X-Y!sTt{I!;J7qcs5X~%fakpv3M5(wQWrYTH5Gn9eopU#~Mt4$d3*k>}(189lUaV*3H=BVZ@@|Kob|+2x@Z6a= zj$;eD4Ttz@Y!=E?{r0TBjKgA1xt8XkD}QL_@Ck&^9V?2gskOkbmX zY(IcZv+~mr_|oyaWbZ{F+`jlOKU+>%@zM*L?sRz|v}r#4J5i_pmPN!JdxZI;iR5wb zWAOL_iow;8X{e(tiK%2QvPRvSkha!O-e|FPdFz{DFyG|fa`jNtx1s)TA7YL9lDh-I z_+ix45-|z?JSaBk&45ddgM+o}v!D>ra$6E#vJY8keKT*f+}wM33Xl_~bK&s`;Fs4p zuIsXoi1p{rx;P31f6Ct?BLE_XgoqZ&v8M? zFix2(hz$?ExISu+w=hs?aeF^}8rax5G#Q)s9FlX_v-%p0JAx-tH?Mv=wrwv74aC-+ z%e?gL%{vBr>K^u4A9hGC86wPoe#x=Tr81Dxw&J@+p}2`CE*{+3MHoi+c z%)JOTT^+&!#bEaGPUZg7(F~lRficRLBTwNK4Zac}J|D-$g_R6MTJ6rW)o}y|k1)z| zxrkZ%hpSHH?(=7@@E1P0G00o>W;L$ST^pBdZPNd}<+NH$_N-_yMfC$`vHX|p(;}3- zO+fo~e!=pwtLTH3F=9=G=iis7>DFUXtFho^nNfz^3R_*_8DWFEKIw@|j$i@l39g%4tR@GB{jJ#k*g zTr)|Z&r{lyr0>a%C-nK`olMpmR?)nWXYQQkgn;`EWok!D)Ys)(;OsVop_HiWnBbyJTY z=7~P1S;X{X&c}finx-Z&VqiJb?*JG+KK!*V7{Ov8anjuRZ6EzZB4T+Ub%;wxwWOys z?#GHio^5aYDo4fKo^-ok(wE7`kTFL|-iW@B@N*MGs)fdy9J=8G##`kkiJH}QbjHQltMG~5Fg#3(;t zAQS11KQH%34I(dPR0F>^kO9&*{I-zJLX)`v+mDIe zBVhtjN5)OdeO_b7?qUguTK#_AC2A*FHUoX4aING0VGLh;4CfxWw=Q_y?K-!? zwO7-tXUew;#p7O@J3y^sOLAbP+tGDx3ZV3XA7L$WOIa5RLU?T%Zvx-JTOB)&1$s&h zg_@PWOvAphq|^}&5B>GMc_V%Ekd()svte3w%p8Zp{8KA=uX7G%yqd#528}*A;lb;B zJLXATx_}yfgL$^U-rkbyB?<|7+vrnVF;yv5A6Sx?Ah7UfnE8)h(N|38UCs}Ue>4Iy zR^b@x!$r03fgHo)OZO8rDTh}0y$?K8KOm(yhD8Vipjjbq<~wUBVBq;r{Dy2d{Z z6)+z>aJ9y3L4|3E$1~!Ra!LJ3yW2@?vD9UK`i9=Oaa@F!q#nHy+3W$uDY5o7njF9CZ3%?iZh63{SBmM@%@SrviGT$tN6oEZu% ziweEVe{BTY0ZGVqHLw(xBE&A`)!3hkurL7jr^Tc{OjXzw$nU8fo^x&T+DpU)^wi>B z-fe&Epk~&M=x_up0m?Q0?vhsc-FV&4=qN}riO8(Kw0u#z2<9p7kImj3WY75olSs3d(?^OGi_;qnKUFRnP|!Uf@+NsIDr z)joLR)+Qcf&P6C@B?JCu8gYU?DX2LtB1`=uTx|&w_Q-YvIouh}tA%Y#-f^6QgxM|?59r!@rsh0>Jo%`$u!Wzcn#*75lf1ZGQ5 zD8BIbL1e%*H&J-Rr16qQh1fUi}F^h{GdHptMjXw%gX7xV?KTj zc9@>R*TnR`>@y?Cms&O)girIWTm&)`wCZ&-#8z~*>UmWu;5sSV;nPfAM25h#A71o^^SEo9|!a^i^ zZ-{UIZun_?@1&?#KE=lgg@HUknxPg8yW%cML3n9|JR+BK@eo;S{4=`^+Fp z5P}nwuLg<&MO^?HaXa+kn3=!E2J;YvpHzQ%SPyL6U0Y)NRa*x}wdA@{Ng3iUW z6Lb}+4ycw62Qbt(f3hQq_sVjkw4!89|yyUz( z^goS+R8&<|sa&G|^ud({pc9FH&!=wy;AKJ##+)uvB06Z4(X~09XWh$|9cD_3>BSnhbF;Y=vsQf)@MYQyHRGWDqrRmaSN;=| zTDCAP?mZFXKaqxfTiu1dxKy)`-pkO7yM8h#KGHaAKUNw#(s}sa$zLa9{ZMhVWU9r? zR9PW;dZ9D*!ReKI%jRi8XN9)&Jxj#Cq5kmO1)^H(W6nF3L1*(jCw2nFA0zVG} zp~iwnOv;=pe|$#69yt34Kd8A3>*+@Su!#{{$hYhAz3^RjY-~R9?wDV^d5Lvx|0-7k zf9SmtdGoKA{pm!!GAvZLxt0qYLQVG*2Yh}&aXl=05=Ds8v4>@zTHgIHnL~|Nk(fpz zzR_e1@E7#YMA$`tEA7KR}aLSppG#q30E_D;nWe^&KtH^l9P80Kct;i5F4s zOzeA&-|~c1C}1FTBcW5KXw*h4`+B>nwHwiwVmAT8Vj}kIG5pGVY~z>og^FpN_aiTz z-wkV(eLoSZ3BW{&V_Qcadpd?LjWIL8D? z%WvXCl53oOC9+FNCrk{Gvz2zTwTaDWkA>w=2#c2-X;Ib+lpI~prP1iJ*fNun-u&ep zo3QME?{dFh!cfkO?==LGulp5)aekY=cfeReeAq98<8$y?83obwc@*$Bo)-Z5mKmjQ zi5|<|$z({o=U#XBou0*zTdr9c#5@rnMveNN>@$hU^4y?HQdgv`qpU-4elApNee)S% zmVA@S_x_u9#K`l-+?&`7%^ST5$Nip;9&Iw=H@ELxLA@4Fq6jY%Nwq>1)F#l<`!Nph zL!e`4(C+RF8}Or?w?G3)KNNp4%T5%5-YY@H2Hp$dXl3GbpmAAH|u4j1YoRGq`qDbjROU);K*)g4lj-MY&MnmvslsvGk zELv$rXnmyXolgrZapUW<92qgCw9;Nb2Gvq~Fs5uQg3mQBykb8aY*zmAIpxJ#Q@`VQ zbLFCT;Oz~IbB`ceg;5%Ip2X3Emsc4~D|KsD&`+dCtBr3@&s|Wi*@6G8>&Js_={L}3 zLfk;-sbm-Y7BOiL`Vx3T;95bGEFkJa#2zC;Q~RQ)-5tF-3}vgSUwZb0rtQdSPWIz? z%CrwTcOEWC$K~9b%jNuBrPkUjHRoBAuSe8p3QUeXQcsnW+hA~X24rnhHHNj%qFo~~ z>-17}io$fjMkm2%UitJAaCHS(3Z?^AHh`KY{tbbRil)m+tH}pw^)-kRzzlsT{Gru< z$ZjA$8QAYcEgxXqeTlQ1$F1RZ(R>8LO( ztss}>#m?vZ4k5@_X-SBp-OD#`>E^O$IL2Izy(n|>3H5`Q?!C`*A1N&lGkMGSEs4@M zm(nQfbtosbB(bAQ23`$>7Xo8Yzl3+6$C44~$R%oYk&(Z%_00vietUSu&D(zz0`9yk z-Tsg-W#%F(L2v8GFc-!%ypK+>xw0!}b?y@io;e#rWnkeg0;kZclY2Hr>68_oO5jqZ6WN3ZB&Lw*0xi_~)XP z1T9w!v|NVUzeXs@-VGi^YKA4a1q57{;WHL_nQwzBD;C}QSb5^=id@ZDE6=wm-vM+KB&tIUvh}g3z_-F>ts(Fz~!F|@V{&5`YgfhZYv1f4Qm#9S* z7~vn9;WNHl+wNH?P;;3@{vPNI_juRB2(n16CGCQYEv-BT6)UQJK=%1Q%#=iPY)?QjZXmKU8&Oww_F5L)!4IcpUQxPL-7K>CShWHyd{1bg4F7W<9TapiJC;ZC( z6Mn7#3BUbk)MIZr^Xt^2W};^H4_Zj!7qzoxznhHwsd+(r@CS3lqifsFF5yW90k>Cj zcu@xzx2z$H9%@5ybGu_1PI2JN+4NbZbJM@hds@Kq3FF{6=%=fa2Q0h1KFiYG|D6vA z3?k+2(<^>u(L;F|C(rQkSr=SNj9c~@LaZ?B4{f!sYte&)ymwD@`rs1s6n@2346awf zjVHh-^W$^KSrPresf88@RR^{^E#2;!Sueq&sKg(2;G+<}Ipg$B8R~2@jP%S}ZX2f_ z!d=S#GxW&BOv)ts%w3e=BXgbBD%OT^G5Stj%%Rf#JNthY*!8+sV@{~_8M=HJBx+7w z^6i5yY6wHVLpR1--Z0yqb7=<=fr{s6l{%CJ=D+Y!J;f~Xoh|D9vMcn5->{o(#i==$ zYlfQ`TJD)nG7;@vp4dJ#o5YD#F$d8EWpaIPQfu8ddSPy`>-crNO_3*tz69B&#jrVI z&Y7k_%CE1>$~JCMivz#^`J^$w6$_YM{yS4HLipO@B`zPsmQQ|Qd4CwbHQi`SF-qTh zs$Uc$EA?r;^UbYd#Smr^q@;@)C>dwHZ%z{yQZF51(Hh#T|NX6qlS4z8m=f?#Li}m_ zvp&emm>VtwRJ#ELRv$oWt@!_SmtrTrcPw1GC}JDQQIOw!a>wX$n$5t9f!DET_hMYQfOz+Hw^Idq<7mFMMtt#`;&m$`mrbaJ zONU@SgW{t!xEl`I-8%>v!lQwQmlxrG!`BWNR0gF~PN@_X%El86D%P(QIiMBju*JdrvJVJ+6Zg@^#+`k|yk4CRR_30GHJ(g;@tN z`;b&s5*_-N)kG2xMZ z?AbKCRR4<>)7BG2asFj;BrM|%tcbtTEsIOqscw+o!i+QQmaE?F1N4Ntj;SrS@H^cF zrM71WovMYy z9NmYHnqpG?h?+SH z9P)1|j96a-HXKh4%f`D1@c&$hy|5$?Q;|GORbB-WBYBv^{vMJ^#w~*J5y`{RBoA}Z z{C^J@+LJs?PyIh0-i>@}%<+iTr#8_3x1fy?t+Tx(wGBO^_oarIPpU6Z!Ae(Qh&mLG z{q^sON1U;48)z$%Hq2ATT7jDv|Eed*E_${XI99u$WARz*{^S6@e=FxDba~Y zU(3hD%Ajh-f6>OAIniI`hU-x+G;uPppTJQ(Oq~wD+NgugtWa7)NX6Mz^}5enq=Co6 z$<(k^f;U;Bt~W=PWC5ad4KpK^SD3g404IB~3Vg4n>cAwDOPDB|M^p}k=v$~qSrJ{Z zf6&=2O#d>+f~|2F>$Dj26wqk$qzYNb6)RKjqV*exL-{udSwFu=e=LbXvvS$P?ct$h zcwNd(=FQ67^PU%F*vL{TnxV%Xe!)m#2ZcLuLgs)<W4>J#ZGWUxraC1Vq=SR7S;T$655@%bptGWEEmS+z*xYdlOi(aq*O*Ow077uzwRa`NE zr!xkq2|Fhx{r?c#KLt@HMO7YoR*%5=DByFxU7bV{%BLvgz;aN#RvatYT1QUaMiyTG zRr@6J%qv1uoYU%f>xp|HZPT`b64o2|&L@_uuzP-a}p( zbY1OZI2ab+fGR{&*Q;BxR%bM2%Gx*dXlYBh7~9|a{zzX?Oz@Ld)Mr+*cJg+e%b%pk z=?v$dkb5#w?@ZCbIVOs4w=yTZV)*SlS1u|tBU9}w_9SFbt!^@vpj9W+=d3l@w`#Epd&IETawG zT_N@1YlT;-Jyf~nwcUO-+aqcJQte6f`}{I-v-G{M`N?`7*Ca0M&XVC`=VVsl@0T3? z?jFxgdp10Wd|1ap>xe^t9-mLT|KD)AQ@4*^6T*Ku&(r((41NRsPxB^Cq?4LAbjKXS zNmOxNyszPR_6tcffD z+eTZi@v)Aj-{;#DW2CJ`mej??4*!;aNN=X+D!ieky~fs+22wW$}|t w{-OHER{?02>eexxt%gXIkDX8u-2=gkw3Ou0D*yK5`H29DQ~c5iYNY`EKLK0^xBvhE