fix cisco callmanager phone name oid, add description (#1231)

This commit is contained in:
Colin Gagnaire 2018-11-20 14:07:04 +01:00 committed by GitHub
parent 307d94012a
commit 8a982c8fb8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 4 deletions

View File

@ -40,7 +40,7 @@ sub custom_status_threshold {
eval "$instance_mode->{option_results}->{critical_status}") {
$status = 'critical';
} elsif (defined($instance_mode->{option_results}->{warning_status}) && $instance_mode->{option_results}->{warning_status} ne '' &&
eval "$instance_mode->{option_results}->{warning_status}") {
eval "$instance_mode->{option_results}->{warning_status}") {
$status = 'warning';
}
};
@ -55,6 +55,7 @@ sub custom_status_output {
my ($self, %options) = @_;
my $msg = 'status : ' . $self->{result_values}->{status};
$msg .= ' [Description: ' . $self->{result_values}->{description} . ']' if (defined($self->{result_values}->{description}) && $self->{result_values}->{description} ne '');
return $msg;
}
@ -62,7 +63,7 @@ sub custom_status_calc {
my ($self, %options) = @_;
$self->{result_values}->{status} = $options{new_datas}->{$self->{instance} . '_ccmPhoneStatus'};
$self->{result_values}->{display} = $options{new_datas}->{$self->{instance} . '_ccmPhoneName'};
$self->{result_values}->{description} = $options{new_datas}->{$self->{instance} . 'ccmPhoneDescription'};
return 0;
}
@ -76,7 +77,7 @@ sub set_counters {
$self->{maps_counters}->{phone} = [
{ label => 'status', threshold => 0, set => {
key_values => [ { name => 'ccmPhoneStatus' }, { name => 'ccmPhoneName' } ],
key_values => [ { name => 'ccmPhoneDescription' }, { name => 'ccmPhoneStatus' }, { name => 'ccmPhoneName' } ],
closure_custom_calc => $self->can('custom_status_calc'),
closure_custom_output => $self->can('custom_status_output'),
closure_custom_perfdata => sub { return 0; },
@ -159,6 +160,7 @@ my %mapping_status = (
);
my $mapping = {
ccmPhoneDescription => { oid => '.1.3.6.1.4.1.9.9.156.1.2.1.1.4' },
ccmPhoneStatus => { oid => '.1.3.6.1.4.1.9.9.156.1.2.1.1.7', map => \%mapping_status },
ccmPhoneName => { oid => '.1.3.6.1.4.1.9.9.156.1.2.1.1.20' },
};
@ -168,7 +170,7 @@ my $oid_ccmPhoneEntry = '.1.3.6.1.4.1.9.9.156.1.2.1.1';
sub manage_selection {
my ($self, %options) = @_;
my $snmp_result = $options{snmp}->get_table(oid => $oid_ccmPhoneEntry, start => $mapping->{ccmPhoneStatus}->{oid}, end => $mapping->{ccmPhoneName}->{oid}, nothing_quit => 1);
my $snmp_result = $options{snmp}->get_table(oid => $oid_ccmPhoneEntry, start => $mapping->{ccmPhoneDescription}->{oid}, end => $mapping->{ccmPhoneName}->{oid}, nothing_quit => 1);
$self->{phone} = {};
$self->{global} = { unknown => 0, registered => 0, unregistered => 0, rejected => 0, partiallyregistered => 0 };