asterisk: update xivo's script

This commit is contained in:
David Sabatié 2015-01-16 18:49:38 +01:00
parent 40d9aa6d5e
commit 92fe6a38af
2 changed files with 6 additions and 1 deletions

View File

@ -0,0 +1 @@
<centreon asterisk user> <centreon asterisk secret>

View File

@ -33,6 +33,7 @@
#%# capabilities=autoconf #%# capabilities=autoconf
use strict; use strict;
use File::Basename;
my $ret = undef; my $ret = undef;
if (! eval "require Net::Telnet;") if (! eval "require Net::Telnet;")
@ -40,6 +41,9 @@ if (! eval "require Net::Telnet;")
$ret = "Net::Telnet not found"; $ret = "Net::Telnet not found";
} }
my $DIRNAME=dirname($0);
my $conffile=$DIRNAME."/asterisk_centreon.conf";
my $command; my $command;
if ( (defined($ARGV[0])) && ($ARGV[0] ne '') ) if ( (defined($ARGV[0])) && ($ARGV[0] ne '') )
{ {
@ -60,7 +64,7 @@ my $port = exists $ENV{'port'} ? $ENV{'port'} : "5038";
my ($username, $secret); my ($username, $secret);
open FILE, "asterisk-centreon.conf" or die $!; open FILE, $conffile or die $!;
while (my $confline = <FILE>) while (my $confline = <FILE>)
{ {
($username, $secret) = split(' ', $confline); ($username, $secret) = split(' ', $confline);