mirror of
https://github.com/centreon/centreon-plugins.git
synced 2025-07-29 00:24:46 +02:00
wip fortiauthenticator
This commit is contained in:
parent
289f934f8d
commit
4c8bd540fd
90
network/fortinet/fortiauthenticator/snmp/mode/cpu.pm
Normal file
90
network/fortinet/fortiauthenticator/snmp/mode/cpu.pm
Normal file
@ -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
|
87
network/fortinet/fortiauthenticator/snmp/mode/disklog.pm
Normal file
87
network/fortinet/fortiauthenticator/snmp/mode/disklog.pm
Normal file
@ -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
|
122
network/fortinet/fortiauthenticator/snmp/mode/ha.pm
Normal file
122
network/fortinet/fortiauthenticator/snmp/mode/ha.pm
Normal file
@ -0,0 +1,122 @@
|
||||
#
|
||||
# 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) = @_;
|
||||
|
||||
$self->{result_values}->{ha_status} = $options{old_datas}->{$self->{instance} . '_ha_status'};
|
||||
$self->{result_values}->{ha_status_last} = $options{new_datas}->{$self->{instance} . '_ha_status'};
|
||||
if (!defined($options{old_datas}->{$self->{instance} . '_ha_status'})) {
|
||||
$self->{error_msg} = 'buffer creation';
|
||||
return -2;
|
||||
}
|
||||
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
|
87
network/fortinet/fortiauthenticator/snmp/mode/memory.pm
Normal file
87
network/fortinet/fortiauthenticator/snmp/mode/memory.pm
Normal file
@ -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
|
53
network/fortinet/fortiauthenticator/snmp/plugin.pm
Normal file
53
network/fortinet/fortiauthenticator/snmp/plugin.pm
Normal file
@ -0,0 +1,53 @@
|
||||
#
|
||||
# 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} = {
|
||||
'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…
x
Reference in New Issue
Block a user