add global counters to fortigate cluster status mode
This commit is contained in:
parent
47fa3a1218
commit
b909e620a9
|
@ -76,13 +76,39 @@ sub prefix_status_output {
|
||||||
return "Node '" . $options{instance_value}->{serial} . "' ";
|
return "Node '" . $options{instance_value}->{serial} . "' ";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub prefix_global_output {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
return "Nodes ";
|
||||||
|
}
|
||||||
|
|
||||||
sub set_counters {
|
sub set_counters {
|
||||||
my ($self, %options) = @_;
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
$self->{maps_counters_type} = [
|
$self->{maps_counters_type} = [
|
||||||
|
{ name => 'global', type => 0, cb_prefix_output => 'prefix_global_output' },
|
||||||
{ name => 'nodes', type => 1, cb_prefix_output => 'prefix_status_output', message_multiple => 'All cluster nodes status are ok' },
|
{ name => 'nodes', type => 1, cb_prefix_output => 'prefix_status_output', message_multiple => 'All cluster nodes status are ok' },
|
||||||
];
|
];
|
||||||
|
$self->{maps_counters}->{global} = [
|
||||||
|
{ label => 'synchronized', set => {
|
||||||
|
key_values => [ { name => 'synchronized' } ],
|
||||||
|
output_template => 'Synchronized: %d',
|
||||||
|
perfdatas => [
|
||||||
|
{ label => 'synchronized_nodes', value => 'synchronized_absolute', template => '%d',
|
||||||
|
min => 0 },
|
||||||
|
],
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ label => 'not-synchronized', set => {
|
||||||
|
key_values => [ { name => 'not_synchronized' } ],
|
||||||
|
output_template => 'Not Synchronized: %d',
|
||||||
|
perfdatas => [
|
||||||
|
{ label => 'not_synchronized_nodes', value => 'not_synchronized_absolute', template => '%d',
|
||||||
|
min => 0 },
|
||||||
|
],
|
||||||
|
}
|
||||||
|
},
|
||||||
|
];
|
||||||
$self->{maps_counters}->{nodes} = [
|
$self->{maps_counters}->{nodes} = [
|
||||||
{ label => 'node', threshold => 0, set => {
|
{ label => 'node', threshold => 0, set => {
|
||||||
key_values => [ { name => 'serial' }, { name => 'hostname' }, { name => 'sync_status' }, { name => 'role' } ],
|
key_values => [ { name => 'serial' }, { name => 'hostname' }, { name => 'sync_status' }, { name => 'role' } ],
|
||||||
|
@ -156,6 +182,8 @@ sub manage_selection {
|
||||||
$self->{results} = $options{snmp}->get_table(oid => $oid_fgHaStatsEntry,
|
$self->{results} = $options{snmp}->get_table(oid => $oid_fgHaStatsEntry,
|
||||||
nothing_quit => 1);
|
nothing_quit => 1);
|
||||||
|
|
||||||
|
$self->{global} = { synchronized => 0, not_synchronized => 0 };
|
||||||
|
|
||||||
foreach my $oid (keys %{$self->{results}}) {
|
foreach my $oid (keys %{$self->{results}}) {
|
||||||
next if ($oid !~ /^$mapping->{fgHaStatsSerial}->{oid}\.(.*)$/);
|
next if ($oid !~ /^$mapping->{fgHaStatsSerial}->{oid}\.(.*)$/);
|
||||||
my $instance = $1;
|
my $instance = $1;
|
||||||
|
@ -168,6 +196,8 @@ sub manage_selection {
|
||||||
sync_status => $result->{fgHaStatsSyncStatus},
|
sync_status => $result->{fgHaStatsSyncStatus},
|
||||||
role => ($result->{fgHaStatsMasterSerial} eq '' || $result->{fgHaStatsMasterSerial} =~ /$result->{fgHaStatsSerial}/) ? "master" : "slave",
|
role => ($result->{fgHaStatsMasterSerial} eq '' || $result->{fgHaStatsMasterSerial} =~ /$result->{fgHaStatsSerial}/) ? "master" : "slave",
|
||||||
};
|
};
|
||||||
|
$result->{fgHaStatsSyncStatus} =~ s/ /_/;
|
||||||
|
$self->{global}->{$result->{fgHaStatsSyncStatus}}++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scalar(keys %{$self->{nodes}}) <= 0) {
|
if (scalar(keys %{$self->{nodes}}) <= 0) {
|
||||||
|
@ -186,6 +216,16 @@ Check cluster status (FORTINET-FORTIGATE-MIB).
|
||||||
|
|
||||||
=over 8
|
=over 8
|
||||||
|
|
||||||
|
=item B<--warning-*>
|
||||||
|
|
||||||
|
Set warning thresholds.
|
||||||
|
Can be: 'synchronized', 'not-synchronized'
|
||||||
|
|
||||||
|
=item B<--critical-*>
|
||||||
|
|
||||||
|
Set critical thresholds.
|
||||||
|
Can be: 'synchronized', 'not-synchronized'
|
||||||
|
|
||||||
=item B<--warning-status>
|
=item B<--warning-status>
|
||||||
|
|
||||||
Set warning threshold for status (Default: '').
|
Set warning threshold for status (Default: '').
|
||||||
|
|
Loading…
Reference in New Issue