diff --git a/packaging/centreon-plugin-Applications-Monitoring-Iplabel-Datametrie-Restapi/deb.json b/packaging/centreon-plugin-Applications-Monitoring-Iplabel-Datametrie-Restapi/deb.json deleted file mode 100644 index 9757fe112..000000000 --- a/packaging/centreon-plugin-Applications-Monitoring-Iplabel-Datametrie-Restapi/deb.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "dependencies": [ - ] -} diff --git a/packaging/centreon-plugin-Applications-Monitoring-Iplabel-Datametrie-Restapi/pkg.json b/packaging/centreon-plugin-Applications-Monitoring-Iplabel-Datametrie-Restapi/pkg.json deleted file mode 100644 index 443734a23..000000000 --- a/packaging/centreon-plugin-Applications-Monitoring-Iplabel-Datametrie-Restapi/pkg.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "pkg_name": "centreon-plugin-Applications-Monitoring-Iplabel-Datametrie-Restapi", - "pkg_summary": "Centreon Plugin IP-Label datametrie rest api", - "plugin_name": "centreon_monitoring_iplabel_datametrie_restapi.pl", - "files": [ - "centreon/plugins/script_custom.pm", - "apps/monitoring/iplabel/datametrie/restapi/" - ] -} diff --git a/packaging/centreon-plugin-Applications-Monitoring-Iplabel-Datametrie-Restapi/rpm.json b/packaging/centreon-plugin-Applications-Monitoring-Iplabel-Datametrie-Restapi/rpm.json deleted file mode 100644 index 9757fe112..000000000 --- a/packaging/centreon-plugin-Applications-Monitoring-Iplabel-Datametrie-Restapi/rpm.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "dependencies": [ - ] -} diff --git a/src/apps/monitoring/iplabel/datametrie/restapi/custom/api.pm b/src/apps/monitoring/iplabel/datametrie/restapi/custom/api.pm deleted file mode 100644 index 2ef728f87..000000000 --- a/src/apps/monitoring/iplabel/datametrie/restapi/custom/api.pm +++ /dev/null @@ -1,292 +0,0 @@ -# -# Copyright 2023 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 apps::monitoring::iplabel::datametrie::restapi::custom::api; - -use strict; -use warnings; -use centreon::plugins::http; -use centreon::plugins::statefile; -use JSON::XS; -use Digest::MD5 qw(md5_hex); - -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 => { - 'api-username:s' => { name => 'api_username' }, - 'api-password:s' => { name => 'api_password' }, - '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); - $self->{cache} = centreon::plugins::statefile->new(%options); - - 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} : 'api.ip-label.net'; - $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} : 10; - $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} : ''; - $self->{api_username} = (defined($self->{option_results}->{api_username})) ? $self->{option_results}->{api_username} : undef; - $self->{api_password} = (defined($self->{option_results}->{api_password})) ? $self->{option_results}->{api_password} : undef; - - if (!defined($self->{hostname}) || $self->{hostname} eq '') { - $self->{output}->add_option_msg(short_msg => "Need to specify --hostname option."); - $self->{output}->option_exit(); - } - if (!defined($self->{api_username}) || $self->{api_username} eq '') { - $self->{output}->add_option_msg(short_msg => "Need to specify --api-username option."); - $self->{output}->option_exit(); - } - if (!defined($self->{api_password}) || $self->{api_password} eq '') { - $self->{output}->add_option_msg(short_msg => "Need to specify --api-password option."); - $self->{output}->option_exit(); - } - - $self->{cache}->check_options(option_results => $self->{option_results}); - - return 0; -} - -sub get_hostname { - my ($self, %options) = @_; - - return $self->{hostname}; -} - -sub get_port { - my ($self, %options) = @_; - - return $self->{port}; -} - -sub build_options_for_httplib { - my ($self, %options) = @_; - - $self->{option_results}->{hostname} = $self->{hostname}; - $self->{option_results}->{port} = $self->{port}; - $self->{option_results}->{proto} = $self->{proto}; - $self->{option_results}->{timeout} = $self->{timeout}; -} - -sub settings { - my ($self, %options) = @_; - - $self->build_options_for_httplib(); - $self->{http}->add_header(key => 'Content-Type', value => 'application/json;charset=UTF-8'); - $self->{http}->add_header(key => 'Accept', value => 'application/json;charset=UTF-8'); - $self->{http}->set_options(%{$self->{option_results}}); -} - -sub json_decode { - my ($self, %options) = @_; - - my $decoded; - eval { - $decoded = JSON::XS->new->utf8->decode($options{content}); - }; - if ($@) { - $self->{output}->add_option_msg(short_msg => "Cannot decode json response: $@"); - $self->{output}->option_exit(); - } - - return $decoded; -} - -sub clean_session_token { - my ($self, %options) = @_; - - my $datas = { last_timestamp => time() }; - $options{statefile}->write(data => $datas); - $self->{session_token} = undef; - $self->{http}->add_header(key => 'Ipln-Auth', value => undef); -} - -sub authenticate { - my ($self, %options) = @_; - - my $has_cache_file = $options{statefile}->read(statefile => 'iplabel_datametrie_api_' . md5_hex($self->{option_results}->{hostname}) . '_' . md5_hex($self->{option_results}->{api_username})); - my $session_token = $options{statefile}->get(name => 'session_token'); - - if ($has_cache_file == 0 || !defined($session_token)) { - my $content = $self->{http}->request( - url_path => '/REST/Get_Token/', - credentials => 1, - basic => 1, - username => $self->{api_username}, - password => $self->{api_password}, - warning_status => '', - unknown_status => '', - critical_status => '' - ); - if ($self->{http}->get_code() != 200) { - $self->{output}->add_option_msg(short_msg => "login error [code: '" . $self->{http}->get_code() . "'] [message: '" . $self->{http}->get_message() . "']"); - $self->{output}->option_exit(); - } - - my $decoded = $self->json_decode(content => $content); - - if (!defined($decoded) || !defined($decoded->{Ipln_WS_REST_datametrie}->{Get_Token}->{status}) || - $decoded->{Ipln_WS_REST_datametrie}->{Get_Token}->{status} ne 'success') { - $self->{output}->add_option_msg(short_msg => 'error retrieving session_token'); - $self->{output}->option_exit(); - } - - $session_token = $decoded->{Ipln_WS_REST_datametrie}->{Get_Token}->{response}->{TOKEN}; - - my $datas = { last_timestamp => time(), session_token => $session_token }; - $options{statefile}->write(data => $datas); - } - - $self->{session_token} = $session_token; - $self->{http}->add_header(key => 'Ipln-Auth', value => $self->{session_token}); -} - -sub request_api { - my ($self, %options) = @_; - - $self->settings(); - if (!defined($self->{session_token})) { - $self->authenticate(statefile => $self->{cache}); - } - - my $content = $self->{http}->request( - url_path => '/REST' . $options{endpoint}, - get_param => $options{get_param}, - unknown_status => $self->{unknown_http_status}, - warning_status => $self->{warning_http_status}, - critical_status => $self->{critical_http_status} - ); - - # wrong token is 200 - my $decoded = $self->json_decode(content => $content); - if (!defined($decoded) || !defined($decoded->{Ipln_WS_REST_datametrie}->{ $options{label} }->{status})) { - $self->{output}->add_option_msg(short_msg => 'error while retrieving data (add --debug option for detailed message)'); - $self->{output}->option_exit(); - } - - if ($decoded->{Ipln_WS_REST_datametrie}->{ $options{label} }->{status} ne 'success') { - $self->clean_session_token(statefile => $self->{cache}); - $self->authenticate(statefile => $self->{cache}); - $content = $self->{http}->request( - url_path => '/REST' . $options{endpoint}, - get_param => $options{get_param}, - unknown_status => $self->{unknown_http_status}, - warning_status => $self->{warning_http_status}, - critical_status => $self->{critical_http_status} - ); - - $decoded = $self->json_decode(content => $content); - if (!defined($decoded) || !defined($decoded->{Ipln_WS_REST_datametrie}->{ $options{label} }->{status})) { - $self->{output}->add_option_msg(short_msg => 'error while retrieving data (add --debug option for detailed message)'); - $self->{output}->option_exit(); - } - } - - if ($decoded->{Ipln_WS_REST_datametrie}->{ $options{label} }->{status} ne 'success') { - $self->{output}->add_option_msg(short_msg => 'method failed'); - $self->{output}->option_exit(); - } - - return $decoded->{Ipln_WS_REST_datametrie}->{ $options{label} }->{response}; -} - -1; - -__END__ - -=head1 NAME - -Ip-Label Datametrie Rest API - -=head1 REST API OPTIONS - -Ip-Label Datametrie Rest API - -=over 8 - -=item B<--hostname> - -Set hostname (Default: 'api.ip-label.net'). - -=item B<--port> - -Port used (Default: 443) - -=item B<--proto> - -Specify https if needed (Default: 'https') - -=item B<--api-username> - -Set username. - -=item B<--api-password> - -Set password. - -=item B<--timeout> - -Set timeout in seconds (Default: 10). - -=back - -=head1 DESCRIPTION - -B. - -=cut diff --git a/src/apps/monitoring/iplabel/datametrie/restapi/mode/alarms.pm b/src/apps/monitoring/iplabel/datametrie/restapi/mode/alarms.pm deleted file mode 100644 index 7ef77c6df..000000000 --- a/src/apps/monitoring/iplabel/datametrie/restapi/mode/alarms.pm +++ /dev/null @@ -1,125 +0,0 @@ -# -# Copyright 2023 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 apps::monitoring::iplabel::datametrie::restapi::mode::alarms; - -use base qw(centreon::plugins::templates::counter); - -use strict; -use warnings; - -sub prefix_alarm_output { - my ($self, %options) = @_; - - return 'current alarms '; -} - -sub set_counters { - my ($self, %options) = @_; - - $self->{maps_counters_type} = [ - { name => 'global', type => 0, cb_prefix_output => 'prefix_alarm_output', skipped_code => { -10 => 1 } } - ]; - - $self->{maps_counters}->{global} = [ - { label => 'black', nlabel => 'alarms.black.count', set => { - key_values => [ { name => 'black' } ], - output_template => 'black: %s', - perfdatas => [ - { template => '%s', min => 0 } - ] - } - }, - { label => 'red', nlabel => 'alarms.red.count', set => { - key_values => [ { name => 'red' } ], - output_template => 'red: %s', - perfdatas => [ - { template => '%s', min => 0 } - ] - } - }, - { label => 'orange', nlabel => 'alarms.orange.count', set => { - key_values => [ { name => 'orange' } ], - output_template => 'orange: %s', - perfdatas => [ - { template => '%s', min => 0 } - ] - } - } - ]; -} - -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 check_options { - my ($self, %options) = @_; - $self->SUPER::check_options(%options); - - $self->change_macros(macros => ['unknown_status', 'warning_status', 'critical_status', ]); -} - -sub manage_selection { - my ($self, %options) = @_; - - my $results = $options{custom}->request_api( - endpoint => '/Get_Current_Alarms_All_Monitors/', - label => 'Get_Current_Alarms_All_Monitors' - ); - - $self->{global} = { orange => 0, red => 0, black => 0 }; - return if (ref($results) ne 'ARRAY'); - - foreach (@$results) { - $self->{global}->{ lc($_->{ALARM_TYPE}) }++ if (defined($self->{global}->{ lc($_->{ALARM_TYPE}) })); - } -} - -1; - -__END__ - -=head1 MODE - -Check current alarms. - -=over 8 - -=item B<--filter-counters> - -Only display some counters (regexp can be used). -Example: --filter-counters='black' - -=item B<--warning-*> B<--critical-*> - -Thresholds. -Can be: 'black', 'red', 'orange'. - -=back - -=cut diff --git a/src/apps/monitoring/iplabel/datametrie/restapi/mode/kpi.pm b/src/apps/monitoring/iplabel/datametrie/restapi/mode/kpi.pm deleted file mode 100644 index 521240913..000000000 --- a/src/apps/monitoring/iplabel/datametrie/restapi/mode/kpi.pm +++ /dev/null @@ -1,201 +0,0 @@ -# -# Copyright 2023 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 apps::monitoring::iplabel::datametrie::restapi::mode::kpi; - -use base qw(centreon::plugins::templates::counter); - -use strict; -use warnings; -use POSIX; -use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold); - -sub custom_status_output { - my ($self, %options) = @_; - - return sprintf('status: %s', $self->{result_values}->{status}); -} - -sub set_counters { - my ($self, %options) = @_; - - $self->{maps_counters_type} = [ - { name => 'kpi', type => 1, cb_prefix_output => 'prefix_kpi_output', message_multiple => 'All KPI are ok', skipped_code => { -10 => 1 } }, - ]; - - $self->{maps_counters}->{kpi} = [ - { label => 'status', threshold => 0, set => { - key_values => [ { name => 'status' }, { name => 'display' } ], - closure_custom_output => $self->can('custom_status_output'), - closure_custom_perfdata => sub { return 0; }, - closure_custom_threshold_check => \&catalog_status_threshold - } - }, - { label => 'success-rate', nlabel => 'kpi.success.rate.percentage', set => { - key_values => [ { name => 'success_rate', no_value => -1 }, { name => 'display' } ], - output_template => 'success rate: %.2f %%', - perfdatas => [ - { template => '%.2f', min => 0, max => 100, unit => '%', label_extra_instance => 1 } - ] - } - }, - { label => 'sla-availability', nlabel => 'kpi.sla.availability.percentage', set => { - key_values => [ { name => 'sla_availability', no_value => -1 }, { name => 'display' } ], - output_template => 'sla availability: %.2f %%', - perfdatas => [ - { template => '%.2f', min => 0, max => 100, unit => '%', label_extra_instance => 1 } - ] - } - }, - { label => 'performance', nlabel => 'kpi.performance.milliseconds', set => { - key_values => [ { name => 'performance', no_value => -1 }, { name => 'display' } ], - output_template => 'performance: %s ms', - perfdatas => [ - { template => '%s', min => 0, unit => 'ms', 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-id:s' => { name => 'filter_id' }, - 'filter-name:s' => { name => 'filter_name' }, - 'unknown-status:s' => { name => 'unknown_status', default => '' }, - 'warning-status:s' => { name => 'warning_status', default => '' }, - 'critical-status:s' => { name => 'critical_status', default => '' } - }); - - return $self; -} - -sub check_options { - my ($self, %options) = @_; - $self->SUPER::check_options(%options); - - $self->change_macros(macros => ['unknown_status', 'warning_status', 'critical_status', ]); -} - -sub prefix_kpi_output { - my ($self, %options) = @_; - - return "KPI '" . $options{instance_value}->{display} . "' "; -} - -sub manage_selection { - my ($self, %options) = @_; - - my $results = $options{custom}->request_api( - endpoint => '/Get_Monitors/', - label => 'Get_Monitors' - ); - - $self->{kpi} = {}; - my $time = time(); - my $end_date = POSIX::strftime('%d/%m/%Y %H:%M:%S', gmtime()); - foreach (@$results) { - if (defined($self->{option_results}->{filter_name}) && $self->{option_results}->{filter_name} ne '' && - $_->{MONITOR_NAME} !~ /$self->{option_results}->{filter_name}/) { - $self->{output}->output_add(long_msg => "skipping monitor '" . $_->{MONITOR_NAME} . "': no matching filter.", debug => 1); - next; - } - if (defined($self->{option_results}->{filter_id}) && $self->{option_results}->{filter_id} ne '' && - $_->{MONITOR_ID} !~ /$self->{option_results}->{filter_id}/) { - $self->{output}->output_add(long_msg => "skipping monitor '" . $_->{MONITOR_NAME} . "': no matching filter.", debug => 1); - next; - } - - my $start_date = POSIX::strftime('%d/%m/%Y %H:%M:%S', gmtime($time - ($_->{PERIODICITY} * 60 * 2))); - my $kpi_detail = $options{custom}->request_api( - endpoint => '/GMT/Get_KPI/', - label => 'Get_KPI', - get_param => [ - 'monitor_id=' . $_->{MONITOR_ID}, - 'date_value1=' . $start_date, - 'date_value2=' . $end_date - ] - ); - - $self->{kpi}->{ $_->{MONITOR_NAME} } = { - display => $_->{MONITOR_NAME}, - status => $_->{MONITOR_STATUS}, - success_rate => $kpi_detail->{SUCCESS_RATE}, - performance => $kpi_detail->{PERFORMANCE}, - sla_availability => $kpi_detail->{SLA_AVAILABILITY}, - }; - } - - if (scalar(keys %{$self->{kpi}}) <= 0) { - $self->{output}->add_option_msg(short_msg => "No monitor found"); - $self->{output}->option_exit(); - } -} - -1; - -__END__ - -=head1 MODE - -Check KPI. - -=over 8 - -=item B<--filter-counters> - -Only display some counters (regexp can be used). -Example: --filter-counters='status' - -=item B<--filter-id> - -Filter by monitor id (can be a regexp). - -=item B<--filter-name> - -Filter by monitor name (can be a regexp). - -=item B<--unknown-status> - -Define the conditions to match for the status to be UNKNOWN. -You can use the following variables: %{status}, %{display} - -=item B<--warning-status> - -Define the conditions to match for the status to be WARNING. -You can use the following variables: %{status}, %{display} - -=item B<--critical-status> - -Define the conditions to match for the status to be CRITICAL. -You can use the following variables: %{status}, %{display} - -=item B<--warning-*> B<--critical-*> - -Thresholds. -Can be: 'success-rate' (%) 'sla-availability' (%), 'performance' (ms). - -=back - -=cut diff --git a/src/apps/monitoring/iplabel/datametrie/restapi/mode/listkpi.pm b/src/apps/monitoring/iplabel/datametrie/restapi/mode/listkpi.pm deleted file mode 100644 index 2e613891a..000000000 --- a/src/apps/monitoring/iplabel/datametrie/restapi/mode/listkpi.pm +++ /dev/null @@ -1,115 +0,0 @@ -# -# Copyright 2023 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 apps::monitoring::iplabel::datametrie::restapi::mode::listkpi; - -use base qw(centreon::plugins::mode); - -use strict; -use warnings; - -sub new { - my ($class, %options) = @_; - my $self = $class->SUPER::new(package => __PACKAGE__, %options); - bless $self, $class; - - $options{options}->add_options(arguments => { - }); - - return $self; -} - -sub check_options { - my ($self, %options) = @_; - $self->SUPER::init(%options); -} - -sub manage_selection { - my ($self, %options) = @_; - - my $api_results = $options{custom}->request_api( - endpoint => '/Get_Monitors/', - label => 'Get_Monitors' - ); - my $results = {}; - foreach (@$api_results) { - $results->{$_->{MONITOR_ID}} = { - id => $_->{MONITOR_ID}, - name => $_->{MONITOR_NAME}, - client_id => $_->{CLIENT_ID}, - status => $_->{MONITOR_STATUS} - }; - } - - return $results; -} - -sub run { - my ($self, %options) = @_; - - my $results = $self->manage_selection(%options); - foreach (sort {lc $a->{name} cmp lc $b->{name}} values %$results) { - $self->{output}->output_add( - long_msg => sprintf( - '[name = %s][id = %s][client id = %s][status = %s]', - $_->{name}, - $_->{id}, - $_->{client_id}, - $_->{status} - ) - ); - } - - $self->{output}->output_add( - severity => 'OK', - short_msg => 'List kpi:' - ); - $self->{output}->display(nolabel => 1, force_ignore_perfdata => 1, force_long_output => 1); - $self->{output}->exit(); -} - -sub disco_format { - my ($self, %options) = @_; - - $self->{output}->add_disco_format(elements => ['id', 'name', 'client_id', 'status']); -} - -sub disco_show { - my ($self, %options) = @_; - - my $scenarios = $self->manage_selection(%options); - foreach (sort {lc $a->{name} cmp lc $b->{name}} values %$scenarios) { - $self->{output}->add_disco_entry(%$_); - } -} - -1; - -__END__ - -=head1 MODE - -List KPI. - -=over 8 - -=back - -=cut diff --git a/src/apps/monitoring/iplabel/datametrie/restapi/plugin.pm b/src/apps/monitoring/iplabel/datametrie/restapi/plugin.pm deleted file mode 100644 index 85fa037b1..000000000 --- a/src/apps/monitoring/iplabel/datametrie/restapi/plugin.pm +++ /dev/null @@ -1,51 +0,0 @@ -# -# Copyright 2023 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 apps::monitoring::iplabel::datametrie::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->{version} = '0.1'; - $self->{modes} = { - 'alarms' => 'apps::monitoring::iplabel::datametrie::restapi::mode::alarms', - 'list-kpi' => 'apps::monitoring::iplabel::datametrie::restapi::mode::listkpi', - 'kpi' => 'apps::monitoring::iplabel::datametrie::restapi::mode::kpi' - }; - - $self->{custom_modes}{api} = 'apps::monitoring::iplabel::datametrie::restapi::custom::api'; - return $self; -} - -1; - -__END__ - -=head1 PLUGIN DESCRIPTION - -Check IP-Label Datametrie using Rest API. - -=cut