From 6d4b1c7663c4adcf246a82ce44c9c679ce713ce7 Mon Sep 17 00:00:00 2001 From: Colin Gagnaire Date: Fri, 18 Jan 2019 10:11:57 +0100 Subject: [PATCH] fix fortigate cluster status ha roles --- centreon/common/fortinet/fortigate/mode/clusterstatus.pm | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/centreon/common/fortinet/fortigate/mode/clusterstatus.pm b/centreon/common/fortinet/fortigate/mode/clusterstatus.pm index e6dd1afdf..6f258ea62 100644 --- a/centreon/common/fortinet/fortigate/mode/clusterstatus.pm +++ b/centreon/common/fortinet/fortigate/mode/clusterstatus.pm @@ -145,17 +145,19 @@ sub manage_selection { $self->{nodes} = {}; my $mode = $self->{snmp}->get_leef(oids => [ $oid_fgHaSystemMode ], nothing_quit => 1); - + if ($map_ha_mode{$mode->{$oid_fgHaSystemMode}} =~ /standalone/) { $self->{output}->add_option_msg(short_msg => "No cluster configuration (standalone mode)"); $self->{output}->option_exit(); } + $self->{output}->output_add(short_msg => "HA mode: " . $map_ha_mode{$mode->{$oid_fgHaSystemMode}}); + $self->{results} = $options{snmp}->get_table(oid => $oid_fgHaStatsEntry, nothing_quit => 1); foreach my $oid (keys %{$self->{results}}) { - next if($oid !~ /^$mapping->{fgHaStatsSerial}->{oid}\.(.*)$/); + next if ($oid !~ /^$mapping->{fgHaStatsSerial}->{oid}\.(.*)$/); my $instance = $1; my $result = $options{snmp}->map_instance(mapping => $mapping, results => $self->{results}, instance => $instance); @@ -164,7 +166,7 @@ sub manage_selection { serial => $result->{fgHaStatsSerial}, hostname => $result->{fgHaStatsHostname}, sync_status => $result->{fgHaStatsSyncStatus}, - role => ($result->{fgHaStatsMasterSerial} eq '') ? "master" : "slave", + role => ($result->{fgHaStatsMasterSerial} eq '' || $result->{fgHaStatsMasterSerial} =~ /$result->{fgHaStatsSerial}/) ? "master" : "slave", }; }