Merge pull request #2384 from centreon/add-fortiauthenticator
Add fortiauthenticator + new option display_short
This commit is contained in:
commit
3bbcc38db9
|
@ -221,6 +221,7 @@ sub run_global {
|
|||
&& $options{config}->{name} =~ /$self->{option_results}->{filter_counters_block}/);
|
||||
return undef if (defined($options{config}->{cb_init}) && $self->call_object_callback(method_name => $options{config}->{cb_init}) == 1);
|
||||
my $resume = defined($options{resume}) && $options{resume} == 1 ? 1 : 0;
|
||||
my $display_short = (!defined($options{config}->{display_short}) || $options{config}->{display_short} != 0) ? 1 : 0;
|
||||
# Can be set when it comes from type 3 counters
|
||||
my $called_multiple = defined($options{called_multiple}) && $options{called_multiple} == 1 ? 1 : 0;
|
||||
my $multiple_parent = defined($options{multiple_parent}) && $options{multiple_parent} == 1 ? 1 : 0;
|
||||
|
@ -294,12 +295,13 @@ sub run_global {
|
|||
} else {
|
||||
if ($long_msg ne '' && $multiple_parent == 0) {
|
||||
if ($called_multiple == 0) {
|
||||
$self->{output}->output_add(short_msg => $prefix_output . $long_msg . $suffix_output) ;
|
||||
$self->{output}->output_add(short_msg => $prefix_output . $long_msg . $suffix_output)
|
||||
if ($display_short == 1);
|
||||
} else {
|
||||
$self->run_multiple_prefix_output(
|
||||
severity => 'ok',
|
||||
short_msg => $prefix_output . $long_msg . $suffix_output
|
||||
);
|
||||
) if ($display_short == 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -645,7 +647,13 @@ sub run_multiple {
|
|||
if ($group->{type} == 1) {
|
||||
$self->run_multiple_instances(config => $group, multiple_parent => $multiple, instance_parent => $instance, indent_long_output => $indent_long_output);
|
||||
} elsif ($group->{type} == 0) {
|
||||
$self->run_global(config => $group, multiple_parent => $multiple, called_multiple => 1, force_instance => $instance, indent_long_output => $indent_long_output);
|
||||
$self->run_global(
|
||||
config => $group,
|
||||
multiple_parent => $multiple,
|
||||
called_multiple => 1,
|
||||
force_instance => $instance,
|
||||
indent_long_output => $indent_long_output
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,251 @@
|
|||
#
|
||||
# Copyright 2020 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fledged industry-strength solution that meets
|
||||
# the needs in IT infrastructure and application monitoring for
|
||||
# service performance.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
package network::fortinet::fortiauthenticator::snmp::mode::authenticator;
|
||||
|
||||
use base qw(centreon::plugins::templates::counter);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Digest::MD5 qw(md5_hex);
|
||||
|
||||
sub custom_remaining_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return sprintf(
|
||||
'total: %s used: %s (%.3f%%) free: %s (%.3f%%)',
|
||||
$self->{result_values}->{total},
|
||||
$self->{result_values}->{used},
|
||||
$self->{result_values}->{prct_used},
|
||||
$self->{result_values}->{free},
|
||||
$self->{result_values}->{prct_free}
|
||||
);
|
||||
}
|
||||
|
||||
sub auth_long_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return 'checking authenticator';
|
||||
}
|
||||
|
||||
sub prefix_auth_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return 'Authenticator ';
|
||||
}
|
||||
|
||||
sub prefix_users_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return 'users ';
|
||||
}
|
||||
|
||||
sub prefix_groups_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return 'groups ';
|
||||
}
|
||||
|
||||
sub prefix_radius_nas_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return 'radius nas ';
|
||||
}
|
||||
|
||||
sub prefix_authentication_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return 'authentication ';
|
||||
}
|
||||
|
||||
sub set_counters {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{maps_counters_type} = [
|
||||
{ name => 'auth', type => 3, cb_prefix_output => 'prefix_auth_output', cb_long_output => 'auth_long_output', indent_long_output => ' ',
|
||||
group => [
|
||||
{ name => 'users', type => 0, display_short => 0, cb_prefix_output => 'prefix_users_output', skipped_code => { -10 => 1 } },
|
||||
{ name => 'groups', type => 0, display_short => 0, cb_prefix_output => 'prefix_groups_output', skipped_code => { -10 => 1 } },
|
||||
{ name => 'radius_nas', type => 0, display_short => 0, cb_prefix_output => 'prefix_radius_nas_output', skipped_code => { -10 => 1 } },
|
||||
{ name => 'authentication', type => 0, display_short => 0, cb_prefix_output => 'prefix_authentication_output', skipped_code => { -10 => 1 } },
|
||||
]
|
||||
}
|
||||
];
|
||||
|
||||
$self->{maps_counters}->{users} = [
|
||||
{ label => 'users-usage', nlabel => 'authenticator.users.count', set => {
|
||||
key_values => [ { name => 'used' }, { name => 'free' }, { name => 'prct_used' }, { name => 'prct_free' }, { name => 'total' } ],
|
||||
closure_custom_output => $self->can('custom_remaining_output'),
|
||||
perfdatas => [
|
||||
{ template => '%d', min => 0, max => 'total', cast_int => 1 }
|
||||
]
|
||||
}
|
||||
},
|
||||
{ label => 'users-usage-prct', nlabel => 'authenticator.users.percentage', display_ok => 0, set => {
|
||||
key_values => [ { name => 'prct_used' }, { name => 'free' }, { name => 'used' }, { name => 'prct_free' }, { name => 'total' } ],
|
||||
closure_custom_output => $self->can('custom_remaining_output'),
|
||||
perfdatas => [
|
||||
{ template => '%.3f', min => 0, max => 100, unit => '%' }
|
||||
]
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
$self->{maps_counters}->{groups} = [
|
||||
{ label => 'groups-usage', nlabel => 'authenticator.groups.count', set => {
|
||||
key_values => [ { name => 'used' }, { name => 'free' }, { name => 'prct_used' }, { name => 'prct_free' }, { name => 'total' } ],
|
||||
closure_custom_output => $self->can('custom_remaining_output'),
|
||||
perfdatas => [
|
||||
{ template => '%d', min => 0, max => 'total', cast_int => 1 }
|
||||
]
|
||||
}
|
||||
},
|
||||
{ label => 'groups-usage-prct', nlabel => 'authenticator.groups.percentage', display_ok => 0, set => {
|
||||
key_values => [ { name => 'prct_used' }, { name => 'free' }, { name => 'used' }, { name => 'prct_free' }, { name => 'total' } ],
|
||||
closure_custom_output => $self->can('custom_remaining_output'),
|
||||
perfdatas => [
|
||||
{ template => '%.3f', min => 0, max => 100, unit => '%' }
|
||||
]
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
$self->{maps_counters}->{radius_nas} = [
|
||||
{ label => 'radius-nas-usage', nlabel => 'authenticator.radius.nas.count', set => {
|
||||
key_values => [ { name => 'used' }, { name => 'free' }, { name => 'prct_used' }, { name => 'prct_free' }, { name => 'total' } ],
|
||||
closure_custom_output => $self->can('custom_remaining_output'),
|
||||
perfdatas => [
|
||||
{ template => '%d', min => 0, max => 'total', cast_int => 1 }
|
||||
]
|
||||
}
|
||||
},
|
||||
{ label => 'radius-nas-usage-prct', nlabel => 'authenticator.radius.nas.percentage', display_ok => 0, set => {
|
||||
key_values => [ { name => 'prct_used' }, { name => 'free' }, { name => 'used' }, { name => 'prct_free' }, { name => 'total' } ],
|
||||
closure_custom_output => $self->can('custom_remaining_output'),
|
||||
perfdatas => [
|
||||
{ template => '%.3f', min => 0, max => 100, unit => '%' }
|
||||
]
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
$self->{maps_counters}->{authentication} = [
|
||||
{ label => 'authentication-events', nlabel => 'authenticator.authentication.events.persecond', set => {
|
||||
key_values => [ { name => 'events_total', per_second => 1 } ],
|
||||
output_template => 'events: %d/s',
|
||||
perfdatas => [
|
||||
{ template => '%d', min => 0, unit => '/s', cast_int => 1 }
|
||||
]
|
||||
}
|
||||
},
|
||||
{ label => 'authentication-failures', nlabel => 'authenticator.authentication.failures.persecond', set => {
|
||||
key_values => [ { name => 'failures_total', per_second => 1 } ],
|
||||
output_template => 'failures: %d/s',
|
||||
perfdatas => [
|
||||
{ template => '%d', min => 0, unit => '/s', cast_int => 1 }
|
||||
]
|
||||
}
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options, statefile => 1, force_new_perfdata => 1);
|
||||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments => {
|
||||
});
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
my $mapping = {
|
||||
users => { oid => '.1.3.6.1.4.1.12356.113.1.202.1' }, # facAuthUserCount
|
||||
groups => { oid => '.1.3.6.1.4.1.12356.113.1.202.2' }, # facAuthUserCount
|
||||
users_remaining => { oid => '.1.3.6.1.4.1.12356.113.1.202.4' }, # facAuthUsersRemaining
|
||||
groups_remaining => { oid => '.1.3.6.1.4.1.12356.113.1.202.5' }, # facAuthGroupRemaining
|
||||
radius_nas => { oid => '.1.3.6.1.4.1.12356.113.1.202.7' }, # facRadiusNasCount
|
||||
radius_nas_remaining => { oid => '.1.3.6.1.4.1.12356.113.1.202.8' }, # facRadiusNasRemaining
|
||||
events_total => { oid => '.1.3.6.1.4.1.12356.113.1.202.20' }, # facAuthEventsTotal
|
||||
failures_total => { oid => '.1.3.6.1.4.1.12356.113.1.202.22' } # facAuthFailuresTotal
|
||||
};
|
||||
|
||||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $snmp_result = $options{snmp}->get_leef(oids => [ map($_->{oid} . '.0', values(%$mapping)) ], nothing_quit => 1);
|
||||
my $result = $options{snmp}->map_instance(mapping => $mapping, results => $snmp_result, instance => 0);
|
||||
|
||||
$self->{output}->output_add(short_msg => 'Authenticator statistics are ok');
|
||||
|
||||
$self->{auth} = {
|
||||
global => {
|
||||
users => {
|
||||
used => $result->{users},
|
||||
free => $result->{users_remaining},
|
||||
total => $result->{users} + $result->{users_remaining},
|
||||
prct_used => $result->{users} / ($result->{users} + $result->{users_remaining}),
|
||||
prct_free => 100 - ($result->{users} / ($result->{users} + $result->{users_remaining}))
|
||||
},
|
||||
groups => {
|
||||
used => $result->{groups},
|
||||
free => $result->{groups_remaining},
|
||||
total => $result->{groups} + $result->{groups_remaining},
|
||||
prct_used => $result->{groups} / ($result->{groups} + $result->{groups_remaining}),
|
||||
prct_free => 100 - ($result->{groups} / ($result->{groups} + $result->{groups_remaining}))
|
||||
},
|
||||
radius_nas => {
|
||||
used => $result->{radius_nas},
|
||||
free => $result->{radius_nas_remaining},
|
||||
total => $result->{radius_nas} + $result->{radius_nas_remaining},
|
||||
prct_used => $result->{radius_nas} / ($result->{radius_nas} + $result->{radius_nas_remaining}),
|
||||
prct_free => 100 - ($result->{radius_nas} / ($result->{radius_nas} + $result->{radius_nas_remaining}))
|
||||
},
|
||||
authentication => {
|
||||
events_total => $result->{events_total},
|
||||
failures_total => $result->{failures_total}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
$self->{cache_name} = 'fortinet_fortiauthenticator_' . $self->{mode} . '_' . $options{snmp}->get_hostname() . '_' . $options{snmp}->get_port() . '_' .
|
||||
(defined($self->{option_results}->{filter_counters}) ? md5_hex($self->{option_results}->{filter_counters}) : md5_hex('all'));
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Check authenticator statistics.
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--warning-*> B<--critical-*>
|
||||
|
||||
Thresholds.
|
||||
Can be: 'members-total', 'memory-usage-prct', 'memory-usage', 'memory-usage-free',
|
||||
'cpu-utilization'.
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
|
@ -0,0 +1,90 @@
|
|||
#
|
||||
# Copyright 2020 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fledged industry-strength solution that meets
|
||||
# the needs in IT infrastructure and application monitoring for
|
||||
# service performance.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
package network::fortinet::fortiauthenticator::snmp::mode::cpu;
|
||||
|
||||
use base qw(centreon::plugins::templates::counter);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub set_counters {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{maps_counters_type} = [
|
||||
{ name => 'cpu', type => 0 }
|
||||
];
|
||||
|
||||
$self->{maps_counters}->{cpu} = [
|
||||
{ label => 'cpu-utilization', nlabel => 'cpu.utilization.percentage', set => {
|
||||
key_values => [ { name => 'cpu_usage' } ],
|
||||
output_template => 'Cpu usage is: %.2f%%',
|
||||
perfdatas => [
|
||||
{ template => '%.2f', unit => '%', min => 0, max => 100 }
|
||||
]
|
||||
}
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
|
||||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments => {
|
||||
});
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $oid_facSysCpuUsage = '.1.3.6.1.4.1.12356.113.1.4.0';
|
||||
my $snmp_result = $options{snmp}->get_leef(
|
||||
oids => [ $oid_facSysCpuUsage ],
|
||||
nothing_quit => 1
|
||||
);
|
||||
|
||||
$self->{cpu} = { cpu_usage => $snmp_result->{$oid_facSysCpuUsage} };
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Check cpu usage.
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--warning-cpu-utilization>
|
||||
|
||||
Threshold warning in percent.
|
||||
|
||||
=item B<--critical-cpu-utilization>
|
||||
|
||||
Threshold critical in percent.
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
|
@ -0,0 +1,87 @@
|
|||
#
|
||||
# Copyright 2020 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fledged industry-strength solution that meets
|
||||
# the needs in IT infrastructure and application monitoring for
|
||||
# service performance.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
package network::fortinet::fortiauthenticator::snmp::mode::disklog;
|
||||
|
||||
use base qw(centreon::plugins::templates::counter);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub set_counters {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{maps_counters_type} = [
|
||||
{ name => 'disk', type => 0, skipped_code => { -10 => 1 } }
|
||||
];
|
||||
|
||||
$self->{maps_counters}->{disk} = [
|
||||
{ label => 'space-usage-prct', nlabel => 'disk.log.space.usage.percentage', set => {
|
||||
key_values => [ { name => 'prct_used' } ],
|
||||
output_template => 'Log disk space used: %.2f %%',
|
||||
perfdatas => [
|
||||
{ template => '%.2f', min => 0, max => 100, unit => '%' }
|
||||
]
|
||||
}
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
|
||||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments => {
|
||||
});
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $oid_facSysLogDiskUsage = '.1.3.6.1.4.1.12356.113.1.6.0';
|
||||
my $result = $options{snmp}->get_leef(oids => [$oid_facSysLogDiskUsage], nothing_quit => 1);
|
||||
|
||||
$self->{disk} = {
|
||||
prct_used => $result->{$oid_facSysLogDiskUsage}
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Check log disk usage.
|
||||
|
||||
=over 8
|
||||
|
||||
|
||||
=item B<--warning-*> B<--critical-*>
|
||||
|
||||
Thresholds.
|
||||
Can be: 'space-usage-prct' (%).
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
|
@ -0,0 +1,123 @@
|
|||
#
|
||||
# Copyright 2020 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fledged industry-strength solution that meets
|
||||
# the needs in IT infrastructure and application monitoring for
|
||||
# service performance.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
package network::fortinet::fortiauthenticator::snmp::mode::ha;
|
||||
|
||||
use base qw(centreon::plugins::templates::counter);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold_ng);
|
||||
use Digest::MD5 qw(md5_hex);
|
||||
|
||||
sub custom_status_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return sprintf(
|
||||
"high-availability status is '%s'",
|
||||
$self->{result_values}->{ha_status}
|
||||
);
|
||||
}
|
||||
|
||||
sub custom_status_calc {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
if (!defined($options{old_datas}->{$self->{instance} . '_ha_status'})) {
|
||||
$self->{error_msg} = 'buffer creation';
|
||||
return -2;
|
||||
}
|
||||
$self->{result_values}->{ha_status_last} = $options{old_datas}->{$self->{instance} . '_ha_status'};
|
||||
$self->{result_values}->{ha_status} = $options{new_datas}->{$self->{instance} . '_ha_status'};
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
sub set_counters {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{maps_counters_type} = [
|
||||
{ name => 'global', type => 0 }
|
||||
];
|
||||
|
||||
$self->{maps_counters}->{global} = [
|
||||
{ label => 'ha-status', type => 2, critical_default => '%{ha_status} ne %{ha_status_last}', set => {
|
||||
key_values => [ { name => 'ha_status' } ],
|
||||
closure_custom_calc => \&custom_status_calc,
|
||||
closure_custom_output => $self->can('custom_status_output'),
|
||||
closure_custom_perfdata => sub { return 0; },
|
||||
closure_custom_threshold_check => \&catalog_status_threshold_ng
|
||||
}
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options, statefile => 1, force_new_perfdata => 1);
|
||||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments => {
|
||||
});
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
my $map_ha_status = {
|
||||
1 => 'unknownOrDetermining', 2 => 'clusterMaster', 3 => 'clusterSlave',
|
||||
4 => 'standaloneMaster', 5 => 'loadBalancingSlave', 255 => 'disabled'
|
||||
};
|
||||
|
||||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $oid_facHaCurrentStatus = '.1.3.6.1.4.1.12356.113.1.201.1.0';
|
||||
my $result = $options{snmp}->get_leef(oids => [$oid_facHaCurrentStatus], nothing_quit => 1);
|
||||
|
||||
$self->{global} = {
|
||||
ha_status => $map_ha_status->{ $result->{$oid_facHaCurrentStatus} }
|
||||
};
|
||||
|
||||
$self->{cache_name} = 'fortinet_fortiauthenticator_' . $self->{mode} . '_' . $options{snmp}->get_hostname() . '_' . $options{snmp}->get_port() . '_' .
|
||||
(defined($self->{option_results}->{filter_counters}) ? md5_hex($self->{option_results}->{filter_counters}) : md5_hex('all'));
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Check high-availability status.
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--warning-status>
|
||||
|
||||
Set warning threshold for status.
|
||||
Can used special variables like: %{ha_status}, %{ha_status_last}
|
||||
|
||||
=item B<--critical-status>
|
||||
|
||||
Set critical threshold for status (Default: '%{ha_status} ne %{ha_status_last}').
|
||||
Can used special variables like: %{ha_status}, %{ha_status_last}
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
|
@ -0,0 +1,87 @@
|
|||
#
|
||||
# Copyright 2020 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fledged industry-strength solution that meets
|
||||
# the needs in IT infrastructure and application monitoring for
|
||||
# service performance.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
package network::fortinet::fortiauthenticator::snmp::mode::memory;
|
||||
|
||||
use base qw(centreon::plugins::templates::counter);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub set_counters {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{maps_counters_type} = [
|
||||
{ name => 'memory', type => 0, skipped_code => { -10 => 1 } }
|
||||
];
|
||||
|
||||
$self->{maps_counters}->{memory} = [
|
||||
{ label => 'usage-prct', nlabel => 'memory.usage.percentage', set => {
|
||||
key_values => [ { name => 'prct_used' } ],
|
||||
output_template => 'Memory used: %.2f %%',
|
||||
perfdatas => [
|
||||
{ template => '%.2f', min => 0, max => 100, unit => '%' }
|
||||
]
|
||||
}
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
|
||||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments => {
|
||||
});
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $oid_facSysMemUsage = '.1.3.6.1.4.1.12356.113.1.5.0';
|
||||
my $result = $options{snmp}->get_leef(oids => [$oid_facSysMemUsage], nothing_quit => 1);
|
||||
|
||||
$self->{memory} = {
|
||||
prct_used => $result->{$oid_facSysMemUsage}
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Check memory usage.
|
||||
|
||||
=over 8
|
||||
|
||||
|
||||
=item B<--warning-*> B<--critical-*>
|
||||
|
||||
Thresholds.
|
||||
Can be: 'usage-prct' (%).
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
|
@ -0,0 +1,54 @@
|
|||
#
|
||||
# Copyright 2020 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fledged industry-strength solution that meets
|
||||
# the needs in IT infrastructure and application monitoring for
|
||||
# service performance.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
package network::fortinet::fortiauthenticator::snmp::plugin;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use base qw(centreon::plugins::script_snmp);
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
bless $self, $class;
|
||||
|
||||
$self->{version} = '1.0';
|
||||
$self->{modes} = {
|
||||
'authenticator' => 'network::fortinet::fortiauthenticator::snmp::mode::authenticator',
|
||||
'cpu' => 'network::fortinet::fortiauthenticator::snmp::mode::cpu',
|
||||
'disk-log' => 'network::fortinet::fortiauthenticator::snmp::mode::disklog',
|
||||
'ha' => 'network::fortinet::fortiauthenticator::snmp::mode::ha',
|
||||
'interfaces' => 'snmp_standard::mode::interfaces',
|
||||
'list-interfaces' => 'snmp_standard::mode::listinterfaces',
|
||||
'memory' => 'network::fortinet::fortiauthenticator::snmp::mode::memory'
|
||||
};
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 PLUGIN DESCRIPTION
|
||||
|
||||
Check FortiAuthenticator in SNMP.
|
||||
|
||||
=cut
|
Loading…
Reference in New Issue