From 26447237ff7fcb38b999a83fbd08ede993ff1e3b Mon Sep 17 00:00:00 2001 From: Guillaume Bougard Date: Fri, 10 Nov 2023 18:03:08 +0100 Subject: [PATCH] fix: More Cisco devices support enhancement --- lib/GLPI/Agent/SNMP/MibSupport/Cisco.pm | 55 +++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 lib/GLPI/Agent/SNMP/MibSupport/Cisco.pm diff --git a/lib/GLPI/Agent/SNMP/MibSupport/Cisco.pm b/lib/GLPI/Agent/SNMP/MibSupport/Cisco.pm new file mode 100644 index 000000000..ac4cc5c64 --- /dev/null +++ b/lib/GLPI/Agent/SNMP/MibSupport/Cisco.pm @@ -0,0 +1,55 @@ +package GLPI::Agent::SNMP::MibSupport::Cisco; + +use strict; +use warnings; + +use parent 'GLPI::Agent::SNMP::MibSupportTemplate'; + +use GLPI::Agent::Tools; +use GLPI::Agent::Tools::SNMP; + +use constant priority => 5; + +# See ENTITY-MIB +use constant entPhysicalModelName => '.1.3.6.1.2.1.47.1.1.1.1.13'; + +# See CISCO-SMI +use constant cisco => '.1.3.6.1.4.1.9'; +use constant cisco_local => cisco . '.2'; + +# See OLD-CISCO-MEMORY-MIB +use constant hostName => cisco_local . '.1.3.0' ; + +our $mibSupport = [ + { + name => "cisco", + sysobjectid => getRegexpOidMatch(cisco) + } +]; + +sub getModel { + my ($self) = @_; + + my $device = $self->device + or return; + + return getCanonicalString($device->{snmp}->get_first(entPhysicalModelName)); +} + +sub getSnmpHostname { + my ($self) = @_; + + return getCanonicalString($self->get(hostName)); +} + +1; + +__END__ + +=head1 NAME + +GLPI::Agent::SNMP::MibSupport::Cisco - Inventory module to enhance Cisco devices support. + +=head1 DESCRIPTION + +The module enhances Cisco support.