|
| 1 | +package GLPI::Agent::SNMP::MibSupport::Fortinet; |
| 2 | + |
| 3 | +use strict; |
| 4 | +use warnings; |
| 5 | + |
| 6 | +use parent 'GLPI::Agent::SNMP::MibSupportTemplate'; |
| 7 | + |
| 8 | +use GLPI::Agent::Tools; |
| 9 | +use GLPI::Agent::Tools::SNMP; |
| 10 | + |
| 11 | +# FORTINET-CORE-MIB |
| 12 | +use constant fortinet => '.1.3.6.1.4.1.12356'; |
| 13 | +use constant fnCoreMib => fortinet . '.100'; |
| 14 | +use constant fnSysSerial => fnCoreMib . '.1.1.1.0'; |
| 15 | + |
| 16 | +# FORTINET-FORTIGATE-MIB |
| 17 | +use constant fnFortiGateMib => fortinet . '.101'; |
| 18 | +use constant fgHighAvailability => fnFortiGateMib . '.13'; |
| 19 | +use constant fgHaStatsEntry => fgHighAvailability . '.2.1.1'; |
| 20 | + |
| 21 | +use constant fgHaStatsIndex => fgHaStatsEntry . '.1'; |
| 22 | +use constant fgHaStatsSerial => fgHaStatsEntry . '.2'; |
| 23 | +use constant fgHaStatsHostname => fgHaStatsEntry . '.11'; |
| 24 | + |
| 25 | +our $mibSupport = [ |
| 26 | + { |
| 27 | + name => "fortinet", |
| 28 | + sysobjectid => getRegexpOidMatch(fnFortiGateMib) |
| 29 | + } |
| 30 | +]; |
| 31 | + |
| 32 | +sub getComponents { |
| 33 | + my ($self) = @_; |
| 34 | + |
| 35 | + my $device = $self->device |
| 36 | + or return; |
| 37 | + |
| 38 | + my @components; |
| 39 | + my $components = $device->{COMPONENTS}->{COMPONENT}; |
| 40 | + |
| 41 | + if (scalar @{$components}) { |
| 42 | + # Replace components with found HA devices |
| 43 | + my $index = $self->walk(fgHaStatsIndex); |
| 44 | + if (ref($index) eq "HASH") { |
| 45 | + delete $device->{COMPONENTS}; |
| 46 | + my @index = sort values(%{$index}); |
| 47 | + foreach my $index (@index) { |
| 48 | + my $serial = getCanonicalString($self->get(fgHaStatsSerial.".".$index)); |
| 49 | + push @components, { |
| 50 | + INDEX => $index, |
| 51 | + NAME => getCanonicalString($self->get(fgHaStatsHostname.".".$index)), |
| 52 | + CONTAINEDININDEX => 0, |
| 53 | + SERIAL => $serial, |
| 54 | + MODEL => $device->{MODEL}, |
| 55 | + TYPE => 'chassis', |
| 56 | + }; |
| 57 | + } |
| 58 | + } |
| 59 | + } |
| 60 | + |
| 61 | + return \@components; |
| 62 | +} |
| 63 | + |
| 64 | +sub getSerial { |
| 65 | + my ($self) = @_; |
| 66 | + |
| 67 | + return getCanonicalString($self->get(fnSysSerial)); |
| 68 | +} |
| 69 | + |
| 70 | +1; |
| 71 | + |
| 72 | +__END__ |
| 73 | +
|
| 74 | +=head1 NAME |
| 75 | +
|
| 76 | +GLPI::Agent::SNMP::MibSupport::Fortinet - Inventory module for Fortinet devices |
| 77 | +
|
| 78 | +=head1 DESCRIPTION |
| 79 | +
|
| 80 | +The module enhances Fortinet devices support. |
0 commit comments