mirror of
https://github.com/munin-monitoring/contrib.git
synced 2018-11-08 00:59:34 +01:00
asterisk: handle more gracefully errors on the asterisk_channels path.
This commit is contained in:
parent
9f56a03d05
commit
b77eef4a62
1 changed files with 7 additions and 6 deletions
|
@ -165,7 +165,8 @@ $socket->print("Action: command\nCommand: core show channels\n\n");
|
||||||
#2 active channels
|
#2 active channels
|
||||||
#1 active call
|
#1 active call
|
||||||
#--END COMMAND--
|
#--END COMMAND--
|
||||||
my $shown_channels = readreply $socket;
|
my $channels_response = readreply $socket;
|
||||||
|
$channels_response = undef if $channels_response =~ /Response: Error/;
|
||||||
|
|
||||||
$socket->print("Action: command\nCommand: voicemail show users\n\n");
|
$socket->print("Action: command\nCommand: voicemail show users\n\n");
|
||||||
#Response: Follows
|
#Response: Follows
|
||||||
|
@ -180,7 +181,7 @@ $voicemail_response = undef if $voicemail_response =~ /Response: Error/;
|
||||||
$socket->close();
|
$socket->close();
|
||||||
|
|
||||||
my $active_channels = 'U';
|
my $active_channels = 'U';
|
||||||
$active_channels = $1 if $shown_channels =~ /\n([0-9]+) active channels/;
|
$active_channels = $1 if $channels_response =~ /\n([0-9]+) active channels/;
|
||||||
|
|
||||||
print <<END;
|
print <<END;
|
||||||
|
|
||||||
|
@ -188,11 +189,11 @@ multigraph asterisk_channels
|
||||||
total.value $active_channels
|
total.value $active_channels
|
||||||
END
|
END
|
||||||
|
|
||||||
my @channels_list = split(/\r\n/, $shown_channels);
|
my @channels_list = split(/\r\n/, $channels_response) if $channels_response;
|
||||||
foreach my $channel (@CHANNELS) {
|
foreach my $channel (@CHANNELS) {
|
||||||
print "$channel.value " .
|
print "$channel.value ";
|
||||||
scalar(grep(/^$channel\//, @channels_list))
|
print $channels_response ? scalar(grep(/^$channel\//, @channels_list)) : "U";
|
||||||
. "\n";
|
print "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
print "\nmultigraph asterisk_voicemail\n";
|
print "\nmultigraph asterisk_voicemail\n";
|
||||||
|
|
Loading…
Reference in a new issue