plugin) os::linux::local - change snmp discovery extra-oids format (#3876)
This commit is contained in:
parent
f5e06ca589
commit
2b5b9d29b6
|
@ -166,10 +166,11 @@ sub run {
|
|||
$host{snmp_version} = $last_version;
|
||||
$host{snmp_community} = $last_community;
|
||||
$host{snmp_port} = $self->{option_results}->{snmp_port};
|
||||
$host{extra_oids} = {};
|
||||
$host{extra_oids} = [];
|
||||
foreach (keys %{$self->{extra_oids}}) {
|
||||
my $label = defined($self->{extra_oids}->{$_}) && $self->{extra_oids}->{$_} ne '' ? $self->{extra_oids}->{$_} : $_;
|
||||
$host{extra_oids}->{$label} = defined($result->{$_}) ? $result->{$_} : 'unknown';
|
||||
my $value = defined($result->{$_}) ? $result->{$_} : 'unknown';
|
||||
push @{$host{extra_oids}}, { oid => $label, value => $value };
|
||||
}
|
||||
|
||||
push @disco_data, \%host;
|
||||
|
|
|
@ -200,10 +200,11 @@ sub run {
|
|||
$host{snmp_version} = '3';
|
||||
$host{snmp_port} = $self->{option_results}->{snmp_port};
|
||||
$host{snmpv3_extraopts} = $self->{snmpv3_combo};
|
||||
$host{extra_oids} = {};
|
||||
$host{extra_oids} = [];
|
||||
foreach (keys %{$self->{extra_oids}}) {
|
||||
my $label = defined($self->{extra_oids}->{$_}) && $self->{extra_oids}->{$_} ne '' ? $self->{extra_oids}->{$_} : $_;
|
||||
$host{extra_oids}->{$label} = defined($snmp_result->{$_}) ? $snmp_result->{$_} : 'unknown';
|
||||
my $value = defined($snmp_result->{$_}) ? $snmp_result->{$_} : 'unknown';
|
||||
push @{$host{extra_oids}}, { oid => $label, value => $value };
|
||||
}
|
||||
|
||||
push @disco_data, \%host;
|
||||
|
|
Loading…
Reference in New Issue