enhance name for entity standard mode
This commit is contained in:
parent
df7a77dd55
commit
ae63c23983
|
@ -18,7 +18,7 @@
|
|||
# limitations under the License.
|
||||
#
|
||||
|
||||
package network::arista::standard::snmp::plugin;
|
||||
package network::arista::snmp::plugin;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
@ -28,19 +28,15 @@ sub new {
|
|||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
bless $self, $class;
|
||||
# $options->{options} = options object
|
||||
|
||||
$self->{version} = '1.0';
|
||||
%{$self->{modes}} = (
|
||||
'cpu' => 'snmp_standard::mode::cpu',
|
||||
'entity' => 'snmp_standard::mode::entity',
|
||||
'hardwaredevice' => 'snmp_standard::mode::hardwaredevice',
|
||||
'interfaces' => 'snmp_standard::mode::interfaces',
|
||||
'list-interfaces' => 'snmp_standard::mode::listinterfaces',
|
||||
'ntp' => 'snmp_standard::mode::ntp',
|
||||
'tcpcon' => 'snmp_standard::mode::tcpcon',
|
||||
'uptime' => 'snmp_standard::mode::uptime',
|
||||
'vrrp' => 'snmp_standard::mode::vrrp',
|
||||
'cpu' => 'snmp_standard::mode::cpu',
|
||||
'entity' => 'snmp_standard::mode::entity',
|
||||
'interfaces' => 'snmp_standard::mode::interfaces',
|
||||
'list-interfaces' => 'snmp_standard::mode::listinterfaces',
|
||||
'tcpcon' => 'snmp_standard::mode::tcpcon',
|
||||
'uptime' => 'snmp_standard::mode::uptime',
|
||||
);
|
||||
|
||||
return $self;
|
||||
|
@ -48,3 +44,10 @@ sub new {
|
|||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 PLUGIN DESCRIPTION
|
||||
|
||||
Check Arista equipments in SNMP.
|
||||
|
||||
=cut
|
|
@ -62,9 +62,10 @@ sub new {
|
|||
sub snmp_execute {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $oid_entPhysicalName = '.1.3.6.1.2.1.47.1.1.1.1.7';
|
||||
my $oid_entPhysicalName = '.1.3.6.1.2.1.47.1.1.1.1.7';
|
||||
my $oid_entPhysicalDescr = '.1.3.6.1.2.1.47.1.1.1.1.2';
|
||||
$self->{snmp} = $options{snmp};
|
||||
push @{$self->{request}}, { oid => $oid_entPhysicalName};
|
||||
push @{$self->{request}}, { oid => $oid_entPhysicalName }, { oid => $oid_entPhysicalDescr };
|
||||
$self->{results} = $self->{snmp}->get_multiple_table(oids => $self->{request});
|
||||
}
|
||||
|
||||
|
@ -186,6 +187,7 @@ sub check {
|
|||
return if ($self->check_filter(section => 'sensor'));
|
||||
|
||||
my $oid_entPhysicalName = '.1.3.6.1.2.1.47.1.1.1.1.7';
|
||||
my $oid_entPhysicalDescr = '.1.3.6.1.2.1.47.1.1.1.1.2';
|
||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_entPhysicalName}})) {
|
||||
next if ($oid !~ /^$oid_entPhysicalName\.(.*)$/);
|
||||
my $instance = $1;
|
||||
|
@ -194,7 +196,8 @@ sub check {
|
|||
|
||||
next if ($self->check_filter(section => 'sensor', instance => $result->{entPhySensorType} . '.' . $instance));
|
||||
|
||||
my $name = $self->{results}->{$oid_entPhysicalName}->{$oid};
|
||||
my $name = $self->{results}->{$oid_entPhysicalName}->{$oid} ne '' ?
|
||||
$self->{results}->{$oid_entPhysicalName}->{$oid} : $self->{results}->{$oid_entPhysicalDescr}->{$oid_entPhysicalDescr . '.' . $instance};
|
||||
# It seems there is no scale
|
||||
if (!defined($self->{option_results}->{sensor_scale})) {
|
||||
$result->{entPhySensorValue} = defined($result->{entPhySensorValue}) ?
|
||||
|
|
Loading…
Reference in New Issue