1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-08-02 22:28:24 +00:00

organize asterisk plugins

untar asterisk-fax and move asterisk-multigraph-munin-plugin
This commit is contained in:
Kenyon Ralph 2012-04-24 01:43:47 -07:00
parent 05ce4b8d87
commit c33bbb90e5
53 changed files with 6292 additions and 0 deletions

View file

@ -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 <fsd@voipbusiness.us>
=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 );

View file

@ -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 <fsd@voipbusiness.us>
=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 );

View file

@ -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 <fsd@voipbusiness.us>
=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 );

View file

@ -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 <fsd@voipbusiness.us>
=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 );

View file

@ -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 <fsd@voipbusiness.us>
=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 );

View file

@ -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 <fsd@voipbusiness.us>
=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 );

View file

@ -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 <fsd@voipbusiness.us>
=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 );

View file

@ -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 <fsd@voipbusiness.us>
=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 );

View file

@ -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 <fsd@voipbusiness.us>
=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 );

View file

@ -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 <fsd@voipbusiness.us>
=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 );

View file

@ -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 <fsd@voipbusiness.us>
=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 );

View file

@ -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 <fsd@voipbusiness.us>
=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 );

View file

@ -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 <fsd@voipbusiness.us>
=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 );

View file

@ -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 <fsd@voipbusiness.us>
=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 );

View file

@ -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 <fsd@voipbusiness.us>
=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 );

View file

@ -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 <fsd@voipbusiness.us>
=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 );