(plugin) network::fortinet::fortigate::restapi - new (#3857)

This commit is contained in:
qgarnier 2022-08-23 14:41:51 +02:00 committed by GitHub
parent d872c90799
commit 0e00d1a739
7 changed files with 894 additions and 1 deletions

View File

@ -40,6 +40,7 @@ sub custom_expires_perfdata {
$self->{output}->perfdata_add(
nlabel => $self->{nlabel} . '.' . $unitdiv_long->{ $self->{instance_mode}->{option_results}->{unit} },
unit => $self->{instance_mode}->{option_results}->{unit},
instances => $self->{result_values}->{to},
value => floor($self->{result_values}->{expires_seconds} / $unitdiv->{ $self->{instance_mode}->{option_results}->{unit} }),
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning-' . $self->{thlabel}),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical-' . $self->{thlabel}),
@ -117,7 +118,7 @@ sub set_counters {
}
},
{ label => 'expires', nlabel => 'license.expires', set => {
key_values => [ { name => 'expires_seconds' }, { name => 'expires_human' } ],
key_values => [ { name => 'expires_seconds' }, { name => 'expires_human' }, { name => 'to' } ],
output_template => 'expires in %s',
output_use => 'expires_human',
closure_custom_perfdata => $self->can('custom_expires_perfdata'),

View File

@ -0,0 +1,197 @@
#
# Copyright 2022 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::fortigate::restapi::custom::api;
use strict;
use warnings;
use centreon::plugins::http;
use JSON::XS;
sub new {
my ($class, %options) = @_;
my $self = {};
bless $self, $class;
if (!defined($options{output})) {
print "Class Custom: Need to specify 'output' argument.\n";
exit 3;
}
if (!defined($options{options})) {
$options{output}->add_option_msg(short_msg => "Class Custom: Need to specify 'options' argument.");
$options{output}->option_exit();
}
if (!defined($options{noptions})) {
$options{options}->add_options(arguments => {
'access-token:s' => { name => 'access_token' },
'hostname:s' => { name => 'hostname' },
'port:s' => { name => 'port' },
'proto:s' => { name => 'proto' },
'timeout:s' => { name => 'timeout' },
'unknown-http-status:s' => { name => 'unknown_http_status' },
'warning-http-status:s' => { name => 'warning_http_status' },
'critical-http-status:s' => { name => 'critical_http_status' }
});
}
$options{options}->add_help(package => __PACKAGE__, sections => 'REST API OPTIONS', once => 1);
$self->{output} = $options{output};
$self->{http} = centreon::plugins::http->new(%options, default_backend => 'curl');
return $self;
}
sub set_options {
my ($self, %options) = @_;
$self->{option_results} = $options{option_results};
}
sub set_defaults {}
sub check_options {
my ($self, %options) = @_;
$self->{hostname} = (defined($self->{option_results}->{hostname})) ? $self->{option_results}->{hostname} : '';
$self->{port} = (defined($self->{option_results}->{port})) ? $self->{option_results}->{port} : 443;
$self->{proto} = (defined($self->{option_results}->{proto})) ? $self->{option_results}->{proto} : 'https';
$self->{timeout} = (defined($self->{option_results}->{timeout})) ? $self->{option_results}->{timeout} : 50;
$self->{access_token} = (defined($self->{option_results}->{access_token})) ? $self->{option_results}->{access_token} : '';
$self->{unknown_http_status} = (defined($self->{option_results}->{unknown_http_status})) ? $self->{option_results}->{unknown_http_status} : '%{http_code} < 200 or %{http_code} >= 300';
$self->{warning_http_status} = (defined($self->{option_results}->{warning_http_status})) ? $self->{option_results}->{warning_http_status} : '';
$self->{critical_http_status} = (defined($self->{option_results}->{critical_http_status})) ? $self->{option_results}->{critical_http_status} : '';
if ($self->{hostname} eq '') {
$self->{output}->add_option_msg(short_msg => "Need to specify --hostname option.");
$self->{output}->option_exit();
}
if ($self->{access_token} eq '') {
$self->{output}->add_option_msg(short_msg => "Need to specify --access-token option.");
$self->{output}->option_exit();
}
return 0;
}
sub build_options_for_httplib {
my ($self, %options) = @_;
$self->{option_results}->{hostname} = $self->{hostname};
$self->{option_results}->{timeout} = $self->{timeout};
$self->{option_results}->{port} = $self->{port};
$self->{option_results}->{proto} = $self->{proto};
$self->{option_results}->{timeout} = $self->{timeout};
}
sub settings {
my ($self, %options) = @_;
return if (defined($self->{settings_done}));
$self->build_options_for_httplib();
$self->{http}->add_header(key => 'Accept', value => 'application/json');
$self->{http}->set_options(%{$self->{option_results}});
$self->{settings_done} = 1;
}
sub get_hostname {
my ($self, %options) = @_;
return $self->{hostname};
}
sub get_port {
my ($self, %options) = @_;
return $self->{port};
}
sub request_api {
my ($self, %options) = @_;
$self->settings();
my $content = $self->{http}->request(
url_path => $options{endpoint},
get_param => $options{get_param},
header => ['Authorization: Bearer ' . $self->{access_token}],
query_form_post => $options{query_form_post},
unknown_status => $self->{unknown_http_status},
warning_status => $self->{warning_http_status},
critical_status => $self->{critical_http_status}
);
if (!defined($content) || $content eq '') {
$self->{output}->add_option_msg(short_msg => "API returns empty content [code: '" . $self->{http}->get_code() . "'] [message: '" . $self->{http}->get_message() . "']");
$self->{output}->option_exit();
}
my $decoded;
eval {
$decoded = JSON::XS->new->utf8->decode($content);
};
if ($@) {
$self->{output}->add_option_msg(short_msg => "Cannot decode response (add --debug option to display returned content)");
$self->{output}->option_exit();
}
return $decoded;
}
1;
__END__
=head1 NAME
FortiOS Rest API
=head1 REST API OPTIONS
FortiOS Rest API
=over 8
=item B<--hostname>
Set hostname.
=item B<--port>
Port used (Default: 443)
=item B<--proto>
Specify https if needed (Default: 'https')
=item B<--access-token>
API token.
=item B<--timeout>
Set timeout in seconds (Default: 50).
=back
=head1 DESCRIPTION
B<custom>.
=cut

View File

@ -0,0 +1,166 @@
#
# Copyright 2022 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::fortigate::restapi::mode::ha;
use base qw(centreon::plugins::templates::counter);
use strict;
use warnings;
sub member_long_output {
my ($self, %options) = @_;
return sprintf(
"checking member '%s'",
$options{instance_value}->{name}
);
}
sub prefix_member_output {
my ($self, %options) = @_;
return sprintf(
"member '%s' ",
$options{instance_value}->{name}
);
}
sub set_counters {
my ($self, %options) = @_;
$self->{maps_counters_type} = [
{ name => 'global', type => 0, skipped_code => { -10 => 1 } },
{ name => 'members', type => 3, cb_prefix_output => 'prefix_member_output', cb_long_output => 'member_long_output', indent_long_output => ' ', message_multiple => 'All members are ok',
group => [
{ name => 'cpu', type => 0, display_short => 0, skipped_code => { -10 => 1 } },
{ name => 'memory', type => 0, display_short => 0, skipped_code => { -10 => 1 } },
{ name => 'session', type => 0, display_short => 0, skipped_code => { -10 => 1 } }
]
}
];
$self->{maps_counters}->{global} = [
{ label => 'members-detected', nlabel => 'members.detected.count', set => {
key_values => [ { name => 'num_members' } ],
output_template => 'members detected: %s',
perfdatas => [
{ template => '%s', min => 0 }
]
}
}
];
$self->{maps_counters}->{cpu} = [
{ label => 'cpu-utilization', nlabel => 'member.cpu.utilization.percentage', set => {
key_values => [ { name => 'load' } ],
output_template => 'cpu load: %.2f %%',
perfdatas => [
{ template => '%.2f', min => 0, max => 100, unit => '%', label_extra_instance => 1 }
]
}
}
];
$self->{maps_counters}->{memory} = [
{ label => 'memory-usage', nlabel => 'member.memory.usage.percentage', set => {
key_values => [ { name => 'used' } ],
output_template => 'memory used: %.2f %%',
perfdatas => [
{ template => '%.2f', min => 0, max => 100, unit => '%', label_extra_instance => 1 }
]
}
}
];
$self->{maps_counters}->{session} = [
{ label => 'sessions-active', nlabel => 'member.sessions.active.count', set => {
key_values => [ { name => 'active' } ],
output_template => 'active sessions: %s',
perfdatas => [
{ template => '%s', min => 0, label_extra_instance => 1 }
]
}
}
];
}
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 => {
'filter-name:s' => { name => 'filter_name' }
});
return $self;
}
sub manage_selection {
my ($self, %options) = @_;
my $members = $options{custom}->request_api(
endpoint => '/api/v2/monitor/system/ha-statistics/select/'
);
$self->{global} = { num_members => 0 };
$self->{members} = {};
foreach my $member (@{$members->{results}}) {
next if (defined($self->{option_results}->{filter_name}) && $self->{option_results}->{filter_name} ne '' &&
$member->{hostname} !~ /$self->{option_results}->{filter_name}/);
$self->{global}->{num_members}++;
$self->{members}->{ $member->{hostname} } = {
name => $member->{hostname},
cpu => { load => $member->{cpu_usage} },
memory => { used => $member->{mem_usage} },
session => { active => $member->{sessions} }
};
}
}
1;
__END__
=head1 MODE
Check vdom system.
=over 8
=item B<--filter-counters>
Only display some counters (regexp can be used).
Example: --filter-counters='memory-usage'
=item B<--filter-name>
Filter members by name.
=item B<--warning-*> B<--critical-*>
Thresholds.
Can be: 'members-detected', 'cpu-utilization' (%), 'memory-usage' (%), 'sessions-active'.
=back
=cut

View File

@ -0,0 +1,125 @@
#
# Copyright 2022 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::fortigate::restapi::mode::health;
use base qw(centreon::plugins::templates::counter);
use strict;
use warnings;
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold_ng);
sub prefix_vdom_output {
my ($self, %options) = @_;
return sprintf(
"vdom '%s' ",
$options{instance_value}->{name}
);
}
sub set_counters {
my ($self, %options) = @_;
$self->{maps_counters_type} = [
{ name => 'vdoms', type => 1, cb_prefix_output => 'prefix_vdom_output', message_multiple => 'All vdom firewall health are ok' }
];
$self->{maps_counters}->{vdoms} = [
{
label => 'health',
type => 2,
critical_default => '%{status} !~ /success/i',
set => {
key_values => [
{ name => 'status' }, { name => 'name' }
],
output_template => "health status: %s",
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, force_new_perfdata => 1);
bless $self, $class;
$options{options}->add_options(arguments => {
'filter-vdom:s' => { name => 'filter_vdom' }
});
return $self;
}
sub manage_selection {
my ($self, %options) = @_;
my $resources = $options{custom}->request_api(
endpoint => '/api/v2/monitor/firewall/health/select/',
get_param => ['global=1']
);
$self->{vdoms} = {};
foreach my $resource (@$resources) {
next if (defined($self->{option_results}->{filter_vdom}) && $self->{option_results}->{filter_vdom} ne '' &&
$resource->{vdom} !~ /$self->{option_results}->{filter_vdom}/);
$self->{vdoms}->{ $resource->{vdom} } = {
name => $resource->{vdom},
status => $resource->{status}
};
}
}
1;
__END__
=head1 MODE
Check firewall health.
=over 8
=item B<--filter-vdom>
Filter vdom by name.
=item B<--unknown-health>
Set unknown threshold for status.
Can used special variables like: %{status}, %{name}
=item B<--warning-health>
Set warning threshold for status.
Can used special variables like: %{status}, %{name}
=item B<--critical-health>
Set critical threshold for status (Default: '%{status} !~ /success/i').
Can used special variables like: %{status}, %{name}
=back
=cut

View File

@ -0,0 +1,200 @@
#
# Copyright 2022 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::fortigate::restapi::mode::licenses;
use base qw(centreon::plugins::templates::counter);
use strict;
use warnings;
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold_ng);
use centreon::plugins::misc;
use POSIX;
my $unitdiv = { s => 1, w => 604800, d => 86400, h => 3600, m => 60 };
my $unitdiv_long = { s => 'seconds', w => 'weeks', d => 'days', h => 'hours', m => 'minutes' };
sub custom_expires_perfdata {
my ($self, %options) = @_;
$self->{output}->perfdata_add(
nlabel => $self->{nlabel} . '.' . $unitdiv_long->{ $self->{instance_mode}->{option_results}->{unit} },
unit => $self->{instance_mode}->{option_results}->{unit},
instances => $self->{result_values}->{name},
value => floor($self->{result_values}->{expires_seconds} / $unitdiv->{ $self->{instance_mode}->{option_results}->{unit} }),
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning-' . $self->{thlabel}),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical-' . $self->{thlabel}),
min => 0
);
}
sub custom_expires_threshold {
my ($self, %options) = @_;
return $self->{perfdata}->threshold_check(
value => floor($self->{result_values}->{expires_seconds} / $unitdiv->{ $self->{instance_mode}->{option_results}->{unit} }),
threshold => [
{ label => 'critical-' . $self->{thlabel}, exit_litteral => 'critical' },
{ label => 'warning-'. $self->{thlabel}, exit_litteral => 'warning' },
{ label => 'unknown-'. $self->{thlabel}, exit_litteral => 'unknown' }
]
);
}
sub custom_status_output {
my ($self, %options) = @_;
return 'status: ' . $self->{result_values}->{status};
}
sub prefix_license_output {
my ($self, %options) = @_;
return sprintf(
"License '%s' ",
$options{instance_value}->{name}
);
}
sub set_counters {
my ($self, %options) = @_;
$self->{maps_counters_type} = [
{ name => 'licenses', type => 1, cb_prefix_output => 'prefix_license_output', message_multiple => 'All licenses are ok', skipped_code => { -10 => 1 } }
];
$self->{maps_counters}->{licenses} = [
{ label => 'status', type => 2, critical_default => '%{status} =~ /expired/i', set => {
key_values => [ { name => 'name' }, { name => 'status' } ],
closure_custom_output => $self->can('custom_status_output'),
closure_custom_perfdata => sub { return 0; },
closure_custom_threshold_check => \&catalog_status_threshold_ng
}
},
{ label => 'expires', nlabel => 'license.expires', set => {
key_values => [ { name => 'expires_seconds' }, { name => 'expires_human' }, { name => 'name' } ],
output_template => 'expires in %s',
output_use => 'expires_human',
closure_custom_perfdata => $self->can('custom_expires_perfdata'),
closure_custom_threshold_check => $self->can('custom_expires_threshold')
}
}
];
}
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 => {
'filter-name:s' => { name => 'filter_name' },
'unit:s' => { name => 'unit', default => 's' }
});
return $self;
}
sub check_options {
my ($self, %options) = @_;
$self->SUPER::check_options(%options);
if ($self->{option_results}->{unit} eq '' || !defined($unitdiv->{$self->{option_results}->{unit}})) {
$self->{option_results}->{unit} = 's';
}
}
sub add_license {
my ($self, %options) = @_;
return if (!defined($options{entry}->{status}));
return if (defined($self->{option_results}->{filter_name}) && $self->{option_results}->{filter_name} ne '' &&
$options{name} !~ /$self->{option_results}->{filter_name}/);
$self->{licenses}->{ $options{name} } = {
name => $options{name},
status => $options{entry}->{status}
};
if (defined($options{entry}->{expires})) {
$self->{licenses}->{ $options{name} }->{expires_seconds} = $options{entry}->{expires} - time();
$self->{licenses}->{ $options{name} }->{expires_seconds} = 0 if ($self->{licenses}->{ $options{name} }->{expires_seconds} < 0);
$self->{licenses}->{ $options{name} }->{expires_human} = centreon::plugins::misc::change_seconds(
value => $self->{licenses}->{ $options{name} }->{expires_seconds}
);
}
}
sub manage_selection {
my ($self, %options) = @_;
my $licenses = $options{custom}->request_api(
endpoint => '/api/v2/monitor/license/status/select/'
);
$self->{licenses} = {};
foreach my $name (keys %{$licenses->{results}}) {
if (defined($licenses->{results}->{$name}->{support})) {
foreach (keys %{$licenses->{results}->{$name}->{support}}) {
$self->add_license(name => $name . ':support:' . $_, entry => $licenses->{results}->{$name}->{support}->{$_});
}
next;
}
$self->add_license(name => $name, entry => $licenses->{results}->{$name});
}
}
1;
__END__
=head1 MODE
Check licenses.
=over 8
=item B<--filter-name>
Filter licenses by name (can be a regexp).
=item B<--warning-status>
Set warning threshold for status.
Can used special variables like: %{name}, %{status}.
=item B<--critical-status>
Set critical threshold for status (Default: '%{status} =~ /expired/i').
Can used special variables like: %{name}, %{status}.
=item B<--unit>
Select the unit for expires threshold. May be 's' for seconds, 'm' for minutes,
'h' for hours, 'd' for days, 'w' for weeks. Default is seconds.
=item B<--warning-*> B<--critical-*>
Thresholds.
Can be: 'expires'.
=back
=cut

View File

@ -0,0 +1,153 @@
#
# Copyright 2022 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::fortigate::restapi::mode::system;
use base qw(centreon::plugins::templates::counter);
use strict;
use warnings;
sub vdom_long_output {
my ($self, %options) = @_;
return sprintf(
"checking vdom '%s'",
$options{instance_value}->{name}
);
}
sub prefix_vdom_output {
my ($self, %options) = @_;
return sprintf(
"vdom '%s' ",
$options{instance_value}->{name}
);
}
sub set_counters {
my ($self, %options) = @_;
$self->{maps_counters_type} = [
{ name => 'vdoms', type => 3, cb_prefix_output => 'prefix_vdom_output', cb_long_output => 'vdom_long_output', indent_long_output => ' ', message_multiple => 'All vdom systems are ok',
group => [
{ name => 'cpu', type => 0, display_short => 0, skipped_code => { -10 => 1 } },
{ name => 'memory', type => 0, display_short => 0, skipped_code => { -10 => 1 } },
{ name => 'session', type => 0, display_short => 0, skipped_code => { -10 => 1 } }
]
}
];
$self->{maps_counters}->{cpu} = [
{ label => 'cpu-utilization', nlabel => 'cpu.utilization.percentage', set => {
key_values => [ { name => 'load' } ],
output_template => 'cpu load: %.2f %%',
perfdatas => [
{ template => '%.2f', min => 0, max => 100, unit => '%', label_extra_instance => 1 }
]
}
}
];
$self->{maps_counters}->{memory} = [
{ label => 'memory-usage', nlabel => 'memory.usage.percentage', set => {
key_values => [ { name => 'used' } ],
output_template => 'memory used: %.2f %%',
perfdatas => [
{ template => '%.2f', min => 0, max => 100, unit => '%', label_extra_instance => 1 }
]
}
}
];
$self->{maps_counters}->{session} = [
{ label => 'sessions-active', nlabel => 'sessions.active.count', set => {
key_values => [ { name => 'active' } ],
output_template => 'active sessions: %s',
perfdatas => [
{ template => '%s', min => 0, label_extra_instance => 1 }
]
}
}
];
}
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 => {
'filter-vdom:s' => { name => 'filter_vdom' }
});
return $self;
}
sub manage_selection {
my ($self, %options) = @_;
my $resources = $options{custom}->request_api(
endpoint => '/api/v2/monitor/system/vdom-resource/select/',
get_param => ['global=1']
);
$self->{vdoms} = {};
foreach my $resource (@$resources) {
next if (defined($self->{option_results}->{filter_vdom}) && $self->{option_results}->{filter_vdom} ne '' &&
$resource->{vdom} !~ /$self->{option_results}->{filter_vdom}/);
$self->{vdoms}->{ $resource->{vdom} } = {
name => $resource->{vdom},
cpu => { load => $resource->{results}->{cpu} },
memory => { used => $resource->{results}->{memory} },
session => { active => $resource->{results}->{session}->{current_usage} }
};
}
}
1;
__END__
=head1 MODE
Check vdom system.
=over 8
=item B<--filter-counters>
Only display some counters (regexp can be used).
Example: --filter-counters='memory-usage'
=item B<--filter-vdom>
Filter vdom by name.
=item B<--warning-*> B<--critical-*>
Thresholds.
Can be: 'cpu-utilization' (%), 'memory-usage' (%), 'sessions-active'.
=back
=cut

View File

@ -0,0 +1,51 @@
#
# Copyright 2022 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::fortigate::restapi::plugin;
use strict;
use warnings;
use base qw(centreon::plugins::script_custom);
sub new {
my ( $class, %options ) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
$self->{modes} = {
'ha' => 'network::fortinet::fortigate::restapi::mode::ha',
'health' => 'network::fortinet::fortigate::restapi::mode::health',
'licenses' => 'network::fortinet::fortigate::restapi::mode::licenses',
'system' => 'network::fortinet::fortigate::restapi::mode::system'
};
$self->{custom_modes}->{api} = 'network::fortinet::fortigate::restapi::custom::api';
return $self;
}
1;
__END__
=head1 PLUGIN DESCRIPTION
Check Fortinet Fortigate using Rest API.
=cut