mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-08-02 14:18:21 +00:00
organize asterisk plugins
untar asterisk-fax and move asterisk-multigraph-munin-plugin
This commit is contained in:
parent
05ce4b8d87
commit
c33bbb90e5
53 changed files with 6292 additions and 0 deletions
65
plugins/asterisk/asterisk_14_fax_ffa/TEMPLATE
Executable file
65
plugins/asterisk/asterisk_14_fax_ffa/TEMPLATE
Executable file
|
@ -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 );
|
||||
|
||||
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue