mirror of
https://github.com/centreon/centreon-plugins.git
synced 2025-07-28 16:14:21 +02:00
asterisk: correct perfdata
This commit is contained in:
parent
45a4cd83c9
commit
149be846ea
@ -94,7 +94,7 @@ sub run {
|
|||||||
{
|
{
|
||||||
$self->{command} = 'sip show peers';
|
$self->{command} = 'sip show peers';
|
||||||
}
|
}
|
||||||
elif ($self->{option_results}->{protocol} eq 'iax' || $self->{option_results}->{protocol} eq 'IAX')
|
elsif ($self->{option_results}->{protocol} eq 'iax' || $self->{option_results}->{protocol} eq 'IAX')
|
||||||
{
|
{
|
||||||
$self->{command} = 'iax2 show peers';
|
$self->{command} = 'iax2 show peers';
|
||||||
}
|
}
|
||||||
@ -103,8 +103,8 @@ sub run {
|
|||||||
|
|
||||||
# Compute data
|
# Compute data
|
||||||
foreach my $line (@result) {
|
foreach my $line (@result) {
|
||||||
next if ($line !~ /^(\w*)\/\w* .* (OK|Unreachable) \((.*)\)/);
|
next if ($line !~ /^(\w*)\/\w* .* (OK|Unreachable) \((.*) (.*)\)/);
|
||||||
my ($trunkname, $trunkstatus, $trunkvalue) = ($1, $2, $3);
|
my ($trunkname, $trunkstatus, $trunkvalue, $trunkunit) = ($1, $2, $3, $4);
|
||||||
|
|
||||||
if (defined($self->{option_results}->{filter_name}) && $self->{option_results}->{filter_name} ne '' &&
|
if (defined($self->{option_results}->{filter_name}) && $self->{option_results}->{filter_name} ne '' &&
|
||||||
$trunkname !~ /$self->{option_results}->{filter_name}/) {
|
$trunkname !~ /$self->{option_results}->{filter_name}/) {
|
||||||
@ -112,7 +112,7 @@ sub run {
|
|||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
|
|
||||||
$self->{result}->{$trunkname} = {name => $trunkname, status => $trunkstatus, value => $trunkvalue};
|
$self->{result}->{$trunkname} = {name => $trunkname, status => $trunkstatus, value => $trunkvalue, unit => $trunkunit};
|
||||||
}
|
}
|
||||||
|
|
||||||
# Send formated data to Centreon
|
# Send formated data to Centreon
|
||||||
@ -123,7 +123,7 @@ sub run {
|
|||||||
foreach my $name (sort(keys %{$self->{result}})) {
|
foreach my $name (sort(keys %{$self->{result}})) {
|
||||||
$msg = sprintf("Trunk: %s %s", $self->{result}->{$name}->{name}, $self->{result}->{$name}->{status});
|
$msg = sprintf("Trunk: %s %s", $self->{result}->{$name}->{name}, $self->{result}->{$name}->{status});
|
||||||
$self->{output}->perfdata_add(label => $self->{result}->{$name}->{name},
|
$self->{output}->perfdata_add(label => $self->{result}->{$name}->{name},
|
||||||
value => $self->{result}->{$name}->{value},
|
value => $self->{result}->{$name}->{value}.$self->{result}->{$name}->{unit},
|
||||||
# keep this lines for future upgrade of this plugin
|
# keep this lines for future upgrade of this plugin
|
||||||
#warning => $self->{perfdata}->get_perfdata_for_output(label => 'warn1'),
|
#warning => $self->{perfdata}->get_perfdata_for_output(label => 'warn1'),
|
||||||
#critical => $self->{perfdata}->get_perfdata_for_output(label => 'crit1'),
|
#critical => $self->{perfdata}->get_perfdata_for_output(label => 'crit1'),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user