(plugin) apps::monitoring::kadiska - add new plugin for Kadiska (#3622)
* initial discovery for watchers * divide discovery for station and watcher * initial commit * add period option and set help * remove unused dependancy * fix couters nlabel and period calculation method * modify default value for period
This commit is contained in:
parent
d818c4f9da
commit
8babb51486
|
@ -0,0 +1,290 @@
|
||||||
|
#
|
||||||
|
# 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 apps::monitoring::kadiska::custom::api;
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
use centreon::plugins::http;
|
||||||
|
use centreon::plugins::statefile;
|
||||||
|
use Digest::MD5 qw(md5_hex);
|
||||||
|
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 => {
|
||||||
|
'client-id:s' => { name => 'client_id' },
|
||||||
|
'client-secret:s' => { name => 'client_secret' },
|
||||||
|
'hostname:s' => { name => 'hostname' },
|
||||||
|
'port:s' => { name => 'port' },
|
||||||
|
'proto:s' => { name => 'proto' },
|
||||||
|
'period:s' => { name => 'period' },
|
||||||
|
'timeout:s' => { name => 'timeout' },
|
||||||
|
'url-path:s' => { name => 'url_path' }
|
||||||
|
});
|
||||||
|
}
|
||||||
|
$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} : 'app.kadiska.com';
|
||||||
|
$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->{period} = (defined($self->{option_results}->{period})) ? $self->{option_results}->{period} : '15';
|
||||||
|
$self->{url_path} = (defined($self->{option_results}->{url_path})) ? $self->{option_results}->{url_path} : '/api/';
|
||||||
|
$self->{timeout} = (defined($self->{option_results}->{timeout})) ? $self->{option_results}->{timeout} : 10;
|
||||||
|
$self->{client_id} = (defined($self->{option_results}->{client_id})) ? $self->{option_results}->{client_id} : '';
|
||||||
|
$self->{client_secret} = (defined($self->{option_results}->{client_secret})) ? $self->{option_results}->{client_secret} : '';
|
||||||
|
|
||||||
|
if (!defined($self->{client_id}) || $self->{client_id} eq '') {
|
||||||
|
$self->{output}->add_option_msg(short_msg => "Need to specify --client-id option.");
|
||||||
|
$self->{output}->option_exit();
|
||||||
|
}
|
||||||
|
if (!defined($self->{client_secret}) || $self->{client_secret} eq '') {
|
||||||
|
$self->{output}->add_option_msg(short_msg => "Need to specify --client-secret option.");
|
||||||
|
$self->{output}->option_exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
$self->{cache}->check_options(option_results => $self->{option_results});
|
||||||
|
|
||||||
|
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};
|
||||||
|
$self->{option_results}->{warning_status} = '';
|
||||||
|
$self->{option_results}->{critical_status} = '';
|
||||||
|
$self->{option_results}->{unknown_status} = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
sub settings {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
$self->build_options_for_httplib();
|
||||||
|
$self->{http}->add_header(key => 'Accept', value => 'application/json');
|
||||||
|
$self->{http}->add_header(key => 'Content-Type', value => 'application/json');
|
||||||
|
$self->{http}->add_header(key => 'Authorization', value => 'Bearer ' . $self->{access_token}) if defined($self->{access_token});
|
||||||
|
$self->{http}->set_options(%{$self->{option_results}});
|
||||||
|
}
|
||||||
|
|
||||||
|
sub clean_access_token {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
my $datas = { last_timestamp => time() };
|
||||||
|
$options{statefile}->write(data => $datas);
|
||||||
|
$self->{http}->remove_header(key => 'Authorization');
|
||||||
|
$self->{access_token} = undef;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub get_access_token {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
my $has_cache_file = $options{statefile}->read(statefile => 'kadiska_' . md5_hex($self->{hostname}) . '_' . md5_hex($self->{client_id}));
|
||||||
|
my $access_token = $options{statefile}->get(name => 'access_token');
|
||||||
|
|
||||||
|
if ( $has_cache_file == 0 || !defined($access_token)) {
|
||||||
|
my $credentials = { 'client_id' => $self->{client_id}, 'secret' => $self->{client_secret} };
|
||||||
|
my $post_json = JSON::XS->new->utf8->encode($credentials);
|
||||||
|
|
||||||
|
$self->settings();
|
||||||
|
|
||||||
|
my $content = $self->{http}->request(
|
||||||
|
method => 'POST',
|
||||||
|
query_form_post => $post_json,
|
||||||
|
url_path => $self->{url_path} . "config/auth/token"
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!defined($content) || $content eq '') {
|
||||||
|
$self->{output}->add_option_msg(short_msg => "Authentication endpoint returns empty content [code: '" . $self->{http}->get_code() . "'] [message: '" . $self->{http}->get_message() . "']");
|
||||||
|
$self->{output}->option_exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
$content =~ s/^"(.*)"$/$1/;
|
||||||
|
$access_token = $content;
|
||||||
|
my $datas = { access_token => $access_token, last_timestamp => time() };
|
||||||
|
|
||||||
|
$options{statefile}->write( data => $datas);
|
||||||
|
}
|
||||||
|
|
||||||
|
$self->{access_token} = $access_token;
|
||||||
|
$self->{http}->add_header(key => 'Authorization', value => 'Bearer ' . $self->{access_token});
|
||||||
|
|
||||||
|
return $access_token;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub request_api {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
if (!defined($self->{access_token})) {
|
||||||
|
$self->{access_token} = $self->get_access_token(statefile => $self->{cache});
|
||||||
|
}
|
||||||
|
|
||||||
|
$self->settings(environment_header => 1, organization_header => 1);
|
||||||
|
|
||||||
|
my $encoded_form_post;
|
||||||
|
|
||||||
|
if (defined($options{query_form_post})) {
|
||||||
|
|
||||||
|
my $end = time() * 1000;
|
||||||
|
my $begin = ($end - (60 * $self->{period} * 1000));
|
||||||
|
|
||||||
|
$options{query_form_post}->{begin} = $begin;
|
||||||
|
$options{query_form_post}->{end} = $end;
|
||||||
|
|
||||||
|
eval {
|
||||||
|
$encoded_form_post = JSON::XS->new->utf8->encode($options{query_form_post});
|
||||||
|
};
|
||||||
|
|
||||||
|
if ($@) {
|
||||||
|
$self->{output}->add_option_msg(short_msg => "Cannot encode json request");
|
||||||
|
$self->{output}->option_exit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
my ($content) = $self->{http}->request(
|
||||||
|
method => 'POST',
|
||||||
|
url_path => $self->{url_path} . $options{endpoint},
|
||||||
|
query_form_post => $encoded_form_post,
|
||||||
|
);
|
||||||
|
|
||||||
|
if ($self->{http}->get_code() < 200 || $self->{http}->get_code() >= 300){
|
||||||
|
$self->clean_access_token(statefile => $self->{cache});
|
||||||
|
$self->{access_token} = $self->get_access_token(statefile => $self->{cache});
|
||||||
|
($content) = $self->{http}->request(
|
||||||
|
method => 'POST',
|
||||||
|
url_path => $self->{url_path} . $options{endpoint},
|
||||||
|
query_form_post => $encoded_form_post,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($self->{http}->get_code() == 429){
|
||||||
|
$self->{output}->add_option_msg(short_msg => "[code: 429] Too many requests.");
|
||||||
|
$self->{output}->option_exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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 (defined($decoded->{error_code})) {
|
||||||
|
$self->{output}->output_add(long_msg => "Error message : " . $decoded->{error}, debug => 1);
|
||||||
|
$self->{output}->add_option_msg(short_msg => "Authentication endpoint returns error code '" . $decoded->{error_code} . "' (add --debug option for detailed message)");
|
||||||
|
$self->{output}->option_exit();
|
||||||
|
}
|
||||||
|
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
|
||||||
|
|
||||||
|
Kadiska Rest API.
|
||||||
|
|
||||||
|
=head1 REST API OPTIONS
|
||||||
|
|
||||||
|
Kadiska Rest API.
|
||||||
|
|
||||||
|
=over 8
|
||||||
|
|
||||||
|
=item B<--hostname>
|
||||||
|
|
||||||
|
Set hostname (Default: 'app.kadiska.com').
|
||||||
|
|
||||||
|
=item B<--port>
|
||||||
|
|
||||||
|
Port used (Default: 443)
|
||||||
|
|
||||||
|
=item B<--proto>
|
||||||
|
|
||||||
|
Specify https if needed (Default: 'https')
|
||||||
|
|
||||||
|
=item B<--period>
|
||||||
|
|
||||||
|
Set period in minutes from which you want to get information. (Default: '15')
|
||||||
|
Example: --period=60 would return you the data from last hour.
|
||||||
|
|
||||||
|
=item B<--client-id>
|
||||||
|
|
||||||
|
Set client id.
|
||||||
|
|
||||||
|
=item B<--client-secret>
|
||||||
|
|
||||||
|
Set client secret.
|
||||||
|
|
||||||
|
=item B<--timeout>
|
||||||
|
|
||||||
|
Set timeout in seconds (Default: 10).
|
||||||
|
|
||||||
|
=back
|
||||||
|
|
||||||
|
=cut
|
|
@ -0,0 +1,120 @@
|
||||||
|
#
|
||||||
|
# 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 apps::monitoring::kadiska::mode::liststations;
|
||||||
|
|
||||||
|
use base qw(centreon::plugins::mode);
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
use JSON::XS;
|
||||||
|
|
||||||
|
sub new {
|
||||||
|
my ($class, %options) = @_;
|
||||||
|
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||||
|
bless $self, $class;
|
||||||
|
|
||||||
|
$options{options}->add_options(arguments => {
|
||||||
|
'prettify' => { name => 'prettify' }
|
||||||
|
});
|
||||||
|
|
||||||
|
return $self;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub check_options {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
$self->SUPER::init(%options);
|
||||||
|
}
|
||||||
|
|
||||||
|
sub manage_selection {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
my @disco_data;
|
||||||
|
my $disco_stats;
|
||||||
|
|
||||||
|
$disco_stats->{start_time} = time();
|
||||||
|
|
||||||
|
my $raw_form_post = {
|
||||||
|
"select" => [
|
||||||
|
"station_name",
|
||||||
|
"station_id"
|
||||||
|
],
|
||||||
|
"from" => "traceroute",
|
||||||
|
"groupby" => [
|
||||||
|
"station_id"
|
||||||
|
],
|
||||||
|
"options" => {"sampling" => \1 }
|
||||||
|
};
|
||||||
|
|
||||||
|
my $results = $options{custom}->request_api(
|
||||||
|
method => 'POST',
|
||||||
|
endpoint => 'query',
|
||||||
|
query_form_post => $raw_form_post
|
||||||
|
);
|
||||||
|
|
||||||
|
foreach my $current_station (@{$results->{data}}) {
|
||||||
|
my %station;
|
||||||
|
$station{station_name} = $current_station->{station_name};
|
||||||
|
$station{station_id} = $current_station->{station_id};
|
||||||
|
push @disco_data, \%station;
|
||||||
|
}
|
||||||
|
|
||||||
|
$disco_stats->{end_time} = time();
|
||||||
|
$disco_stats->{duration} = $disco_stats->{end_time} - $disco_stats->{start_time};
|
||||||
|
$disco_stats->{discovered_items} = @disco_data;
|
||||||
|
$disco_stats->{results} = \@disco_data;
|
||||||
|
|
||||||
|
return $disco_stats;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub run {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
my $encoded_data;
|
||||||
|
|
||||||
|
eval {
|
||||||
|
if (defined($self->{option_results}->{prettify})) {
|
||||||
|
$encoded_data = JSON::XS->new->utf8->pretty->encode($self->manage_selection(%options));
|
||||||
|
} else {
|
||||||
|
$encoded_data = JSON::XS->new->utf8->encode($self->manage_selection(%options));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
if ($@) {
|
||||||
|
$encoded_data = '{"code":"encode_error","message":"Cannot encode discovered data into JSON format"}';
|
||||||
|
}
|
||||||
|
|
||||||
|
$self->{output}->output_add(short_msg => $encoded_data);
|
||||||
|
$self->{output}->display(nolabel => 1, force_ignore_perfdata => 1);
|
||||||
|
$self->{output}->exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
||||||
|
|
||||||
|
__END__
|
||||||
|
|
||||||
|
=head1 MODE
|
||||||
|
|
||||||
|
Kadiska hosts discovery for stations.
|
||||||
|
|
||||||
|
=over 8
|
||||||
|
|
||||||
|
=back
|
||||||
|
|
||||||
|
=cut
|
|
@ -0,0 +1,138 @@
|
||||||
|
#
|
||||||
|
# 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 apps::monitoring::kadiska::mode::listtargets;
|
||||||
|
|
||||||
|
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 => {
|
||||||
|
'station-name:s' => { name => 'station_name' }
|
||||||
|
});
|
||||||
|
|
||||||
|
return $self;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub set_options {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
$self->{option_results} = $options{option_results};
|
||||||
|
}
|
||||||
|
|
||||||
|
sub check_options {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
$self->SUPER::init(%options);
|
||||||
|
|
||||||
|
if (!defined($self->{option_results}->{station_name}) || $self->{option_results}->{station_name} eq '') {
|
||||||
|
$self->{output}->add_option_msg(short_msg => "Need to specify --station-name option.");
|
||||||
|
$self->{output}->option_exit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sub manage_selection {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
my $raw_form_post = {
|
||||||
|
"select" => [
|
||||||
|
"tracer_id"
|
||||||
|
],
|
||||||
|
"from" => "traceroute",
|
||||||
|
"groupby" => [
|
||||||
|
"tracer_id"
|
||||||
|
],
|
||||||
|
"offset" => 0,
|
||||||
|
"options" => {"sampling" => \1 }
|
||||||
|
};
|
||||||
|
|
||||||
|
$raw_form_post->{where} = ["=","station_name",["\$", $self->{option_results}->{station_name}]];
|
||||||
|
|
||||||
|
$self->{targets} = $options{custom}->request_api(
|
||||||
|
method => 'POST',
|
||||||
|
endpoint => 'query',
|
||||||
|
query_form_post => $raw_form_post
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
sub run {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
$self->manage_selection(%options);
|
||||||
|
|
||||||
|
foreach my $target (@{$self->{targets}->{data}}){
|
||||||
|
$self->{output}->output_add(
|
||||||
|
long_msg => sprintf("[target = %s][station = %s]",
|
||||||
|
$target->{tracer_id},
|
||||||
|
$self->{option_results}->{station_name}
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
$self->{output}->output_add(
|
||||||
|
severity => 'OK',
|
||||||
|
short_msg => 'Target-groups list:'
|
||||||
|
);
|
||||||
|
$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 => ['target', 'station']);
|
||||||
|
}
|
||||||
|
|
||||||
|
sub disco_show {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
$self->manage_selection(%options);
|
||||||
|
|
||||||
|
foreach my $target (@{$self->{targets}->{data}}){
|
||||||
|
$self->{output}->add_disco_entry(
|
||||||
|
target => $target->{tracer_id},
|
||||||
|
station => $self->{option_results}->{station_name}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
||||||
|
|
||||||
|
__END__
|
||||||
|
|
||||||
|
=head1 MODE
|
||||||
|
|
||||||
|
List tracer targets for a given station.
|
||||||
|
|
||||||
|
=over 8
|
||||||
|
|
||||||
|
=item B<--station-name>
|
||||||
|
|
||||||
|
Specify station name to list linked tracer targets.
|
||||||
|
|
||||||
|
=back
|
||||||
|
|
||||||
|
=cut
|
|
@ -0,0 +1,119 @@
|
||||||
|
#
|
||||||
|
# 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 apps::monitoring::kadiska::mode::listwatchers;
|
||||||
|
|
||||||
|
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 => {
|
||||||
|
'prettify' => { name => 'prettify' }
|
||||||
|
});
|
||||||
|
|
||||||
|
return $self;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub check_options {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
$self->SUPER::init(%options);
|
||||||
|
}
|
||||||
|
|
||||||
|
sub manage_selection {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
my @disco_data;
|
||||||
|
my $disco_stats;
|
||||||
|
|
||||||
|
$disco_stats->{start_time} = time();
|
||||||
|
|
||||||
|
my $raw_form_post = {
|
||||||
|
"select" => [
|
||||||
|
"watcher_name",
|
||||||
|
"watcher_id"
|
||||||
|
],
|
||||||
|
"from" => "rum",
|
||||||
|
"groupby" => [
|
||||||
|
"watcher_id"
|
||||||
|
],
|
||||||
|
"options" => {"sampling" => \1 }
|
||||||
|
};
|
||||||
|
|
||||||
|
my $results = $options{custom}->request_api(
|
||||||
|
method => 'POST',
|
||||||
|
endpoint => 'query',
|
||||||
|
query_form_post => $raw_form_post
|
||||||
|
);
|
||||||
|
|
||||||
|
foreach my $watcher (@{$results->{data}}) {
|
||||||
|
my %application;
|
||||||
|
$application{watcher_name} = $watcher->{watcher_name};
|
||||||
|
$application{watcher_id} = $watcher->{watcher_id};
|
||||||
|
push @disco_data, \%application;
|
||||||
|
}
|
||||||
|
|
||||||
|
$disco_stats->{end_time} = time();
|
||||||
|
$disco_stats->{duration} = $disco_stats->{end_time} - $disco_stats->{start_time};
|
||||||
|
$disco_stats->{discovered_items} = @disco_data;
|
||||||
|
$disco_stats->{results} = \@disco_data;
|
||||||
|
|
||||||
|
return $disco_stats;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub run {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
my $encoded_data;
|
||||||
|
|
||||||
|
eval {
|
||||||
|
if (defined($self->{option_results}->{prettify})) {
|
||||||
|
$encoded_data = JSON::XS->new->utf8->pretty->encode($self->manage_selection(%options));
|
||||||
|
} else {
|
||||||
|
$encoded_data = JSON::XS->new->utf8->encode($self->manage_selection(%options));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
if ($@) {
|
||||||
|
$encoded_data = '{"code":"encode_error","message":"Cannot encode discovered data into JSON format"}';
|
||||||
|
}
|
||||||
|
|
||||||
|
$self->{output}->output_add(short_msg => $encoded_data);
|
||||||
|
$self->{output}->display(nolabel => 1, force_ignore_perfdata => 1);
|
||||||
|
$self->{output}->exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
||||||
|
|
||||||
|
__END__
|
||||||
|
|
||||||
|
=head1 MODE
|
||||||
|
|
||||||
|
Kadiska hosts discovery for watchers/application.
|
||||||
|
|
||||||
|
=over 8
|
||||||
|
|
||||||
|
=back
|
||||||
|
|
||||||
|
=cut
|
|
@ -0,0 +1,196 @@
|
||||||
|
#
|
||||||
|
# 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 apps::monitoring::kadiska::mode::tracerstatistics;
|
||||||
|
|
||||||
|
use base qw(centreon::plugins::templates::counter);
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold_ng);
|
||||||
|
|
||||||
|
sub prefix_output {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
return "Target '" . $options{instance} . "' ";
|
||||||
|
}
|
||||||
|
|
||||||
|
sub set_counters {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
$self->{maps_counters_type} = [
|
||||||
|
{ name => 'targets', type => 1, cb_prefix_output => 'prefix_output', message_multiple => 'All targets are OK' }
|
||||||
|
];
|
||||||
|
|
||||||
|
$self->{maps_counters}->{targets} = [
|
||||||
|
{ label => 'round-trip', nlabel => 'tracer.round.trip.persecond', set => {
|
||||||
|
key_values => [ { name => 'round_trip' }],
|
||||||
|
output_template => 'Round trip: %.2f ms',
|
||||||
|
perfdatas => [
|
||||||
|
{ label => 'round_trip', template => '%.2f', unit => 'ms', min => 0, label_extra_instance => 1 },
|
||||||
|
],
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ label => 'path-length', nlabel => 'tracer.path.length', set => {
|
||||||
|
key_values => [ { name => 'path_length' } ],
|
||||||
|
output_template => 'Path length: %.2f',
|
||||||
|
perfdatas => [
|
||||||
|
{ label => 'path_length', template => '%.2f', min => 0, label_extra_instance => 1 },
|
||||||
|
],
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ label => 'packets-loss-prct', nlabel => 'tracer.packets.loss.percentage', set => {
|
||||||
|
key_values => [ { name => 'packets_loss_prct' } ],
|
||||||
|
output_template => 'Packets Loss: %.2f %%',
|
||||||
|
perfdatas => [
|
||||||
|
{ label => 'packets_loss_prct', template => '%.2f', unit => '%', min => 0, max => 100, label_extra_instance => 1 },
|
||||||
|
],
|
||||||
|
}
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
sub check_options {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
$self->SUPER::check_options(%options);
|
||||||
|
}
|
||||||
|
|
||||||
|
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-station-name:s' => { name => 'filter_station_name' },
|
||||||
|
'filter-tracer:s' => { name => 'filter_tracer' }
|
||||||
|
});
|
||||||
|
|
||||||
|
return $self;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub manage_selection {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
my $raw_form_post = {
|
||||||
|
"select" => [
|
||||||
|
{
|
||||||
|
"tracer:group" => "tracer_id"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"length_furthest:avg" => ["avg","length_furthest"]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"loss_furthest:avg" => ["*",100,["avg","loss_furthest"]]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"rtt_furthest:avg" => ["avg","rtt_furthest"]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"from" => "traceroute",
|
||||||
|
"groupby" => [
|
||||||
|
"tracer:group"
|
||||||
|
],
|
||||||
|
"orderby" => [
|
||||||
|
["rtt_furthest:avg","desc"]
|
||||||
|
],
|
||||||
|
"offset" => 0,
|
||||||
|
"options" => {"sampling" => \1 }
|
||||||
|
};
|
||||||
|
|
||||||
|
if (defined($self->{option_results}->{filter_station_name}) && $self->{option_results}->{filter_station_name} ne ''){
|
||||||
|
$raw_form_post->{where} = ["=","station_name",["\$", $self->{option_results}->{filter_station_name}]],
|
||||||
|
}
|
||||||
|
|
||||||
|
my $results = $options{custom}->request_api(
|
||||||
|
method => 'POST',
|
||||||
|
endpoint => 'query',
|
||||||
|
query_form_post => $raw_form_post
|
||||||
|
);
|
||||||
|
|
||||||
|
$self->{targets} = {};
|
||||||
|
foreach my $watcher (@{$results->{data}}) {
|
||||||
|
next if (defined($self->{option_results}->{filter_tracer}) && $self->{option_results}->{filter_tracer} ne ''
|
||||||
|
&& $watcher->{'tracer:group'} !~ /$self->{option_results}->{filter_tracer}/);
|
||||||
|
|
||||||
|
my $instance = $watcher->{"tracer:group"};
|
||||||
|
|
||||||
|
$self->{targets}->{$instance} = {
|
||||||
|
round_trip => ($watcher->{'rtt_furthest:avg'} / 1000),
|
||||||
|
packets_loss_prct => $watcher->{'loss_furthest:avg'},
|
||||||
|
path_length => $watcher->{'length_furthest:avg'},
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
if (scalar(keys %{$self->{targets}}) <= 0) {
|
||||||
|
$self->{output}->add_option_msg(short_msg => "No instances or results found.");
|
||||||
|
$self->{output}->option_exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
||||||
|
|
||||||
|
__END__
|
||||||
|
|
||||||
|
=head1 MODE
|
||||||
|
|
||||||
|
Check Kadiska tracer targets' statistics during the period specified.
|
||||||
|
|
||||||
|
=over 8
|
||||||
|
|
||||||
|
=item B<--filter-station-name>
|
||||||
|
|
||||||
|
Filter on station name to display tracer targets' statistics linked to a particular station.
|
||||||
|
|
||||||
|
=item B<--filter-tracer>
|
||||||
|
|
||||||
|
Filter to display statistics for particular tracer targets. Can be a regex or a single tracer target.
|
||||||
|
A tracer_id must be given.
|
||||||
|
|
||||||
|
Regex example:
|
||||||
|
--filter-tracer="(tracer:myid|tracer:anotherid)"
|
||||||
|
|
||||||
|
=item B<--warning-round-trip>
|
||||||
|
|
||||||
|
Warning threshold for round trip in milliseconds.
|
||||||
|
|
||||||
|
=item B<--critical-round-trip>
|
||||||
|
|
||||||
|
Critical threshold for round trip in milliseconds.
|
||||||
|
|
||||||
|
=item B<--warning-path-length>
|
||||||
|
|
||||||
|
Warning threshold for path length to reach targets.
|
||||||
|
|
||||||
|
=item B<--critical-path-length>
|
||||||
|
|
||||||
|
Critical threshold for path length to reach targets.
|
||||||
|
|
||||||
|
item B<--warning-packets-loss-prct>
|
||||||
|
|
||||||
|
Warning threshold for packets' loss in percentage.
|
||||||
|
|
||||||
|
=item B<--critical-packets-loss-prct>
|
||||||
|
|
||||||
|
Critical threshold for packets' loss in percentage.
|
||||||
|
|
||||||
|
=back
|
||||||
|
|
||||||
|
=cut
|
|
@ -0,0 +1,206 @@
|
||||||
|
#
|
||||||
|
# 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 apps::monitoring::kadiska::mode::watcherstatistics;
|
||||||
|
|
||||||
|
use base qw(centreon::plugins::templates::counter);
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold_ng);
|
||||||
|
|
||||||
|
sub prefix_output {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
return "Watcher '" . $options{instance} . "' ";
|
||||||
|
}
|
||||||
|
|
||||||
|
sub set_counters {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
$self->{maps_counters_type} = [
|
||||||
|
{ name => 'watchers', type => 1, cb_prefix_output => 'prefix_output', message_multiple => 'All Watchers are OK' }
|
||||||
|
];
|
||||||
|
|
||||||
|
$self->{maps_counters}->{watchers} = [
|
||||||
|
{ label => 'errors-prct', nlabel => 'watcher.errors.percentage', set => {
|
||||||
|
key_values => [ { name => 'errors_prct' } ],
|
||||||
|
output_template => 'errors: %.2f%%',
|
||||||
|
perfdatas => [
|
||||||
|
{ label => 'errors_prct', template => '%.2f', unit => '%', min => 0, max => 100, label_extra_instance => 1 },
|
||||||
|
],
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ label => 'sessions', nlabel => 'watcher.sessions.count', set => {
|
||||||
|
key_values => [ { name => 'sessions' } ],
|
||||||
|
output_template => 'sessions: %s',
|
||||||
|
perfdatas => [
|
||||||
|
{ label => 'sessions', template => '%s', min => 0, label_extra_instance => 1 },
|
||||||
|
],
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ label => 'requests', nlabel => 'watcher.requests.count', set => {
|
||||||
|
key_values => [ { name => 'requests' } ],
|
||||||
|
output_template => 'requests: %s',
|
||||||
|
perfdatas => [
|
||||||
|
{ label => 'requests', template => '%s', min => 0, label_extra_instance => 1 },
|
||||||
|
],
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ label => 'pages', nlabel => 'watcher.pages.count', set => {
|
||||||
|
key_values => [ { name => 'pages' } ],
|
||||||
|
output_template => 'pages: %d',
|
||||||
|
perfdatas => [
|
||||||
|
{ label => 'pages', template => '%d', min => 0, label_extra_instance => 1 },
|
||||||
|
],
|
||||||
|
}
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
sub check_options {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
$self->SUPER::check_options(%options);
|
||||||
|
}
|
||||||
|
|
||||||
|
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-watcher-name:s' => { name => 'filter_watcher_name' },
|
||||||
|
});
|
||||||
|
|
||||||
|
return $self;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub manage_selection {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
my $raw_form_post = {
|
||||||
|
"select" => [
|
||||||
|
{
|
||||||
|
"watcher_id:group" => "watcher_name"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"\%errors:avg|hits" =>
|
||||||
|
[
|
||||||
|
"*",100,["/",["sumFor","hits","error_count"],["countFor","hits"]]
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"session:sum|hits" => ["sumFor","hits","session_count"]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"item:count|requests" => ["countFor","requests"]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"item:count|pages" => ["countFor","pages"]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"from" => "rum",
|
||||||
|
"groupby" => [
|
||||||
|
"watcher_name"
|
||||||
|
],
|
||||||
|
"offset" => 0,
|
||||||
|
"options" => {"sampling" => \1 }
|
||||||
|
};
|
||||||
|
|
||||||
|
if (defined($self->{option_results}->{filter_watcher_name}) && $self->{option_results}->{filter_watcher_name} ne ''){
|
||||||
|
$raw_form_post->{where} = ["=","watcher_name",["\$", $self->{option_results}->{filter_watcher_name}]],
|
||||||
|
}
|
||||||
|
|
||||||
|
my $results = $options{custom}->request_api(
|
||||||
|
method => 'POST',
|
||||||
|
endpoint => 'query',
|
||||||
|
query_form_post => $raw_form_post
|
||||||
|
);
|
||||||
|
|
||||||
|
$self->{watchers} = {};
|
||||||
|
foreach my $watcher (@{$results->{data}}) {
|
||||||
|
next if (defined($self->{option_results}->{filter_watcher_name}) && $self->{option_results}->{filter_watcher_name} ne ''
|
||||||
|
&& $watcher->{'watcher_id:group'} !~ /$self->{option_results}->{filter_watcher_name}/);
|
||||||
|
|
||||||
|
my $instance = $watcher->{'watcher_id:group'};
|
||||||
|
|
||||||
|
$self->{watchers}->{$instance} = { display => $instance,
|
||||||
|
errors_prct => $watcher->{'%errors:avg|hits'},
|
||||||
|
sessions => $watcher->{'session:sum|hits'},
|
||||||
|
requests => $watcher->{'item:count|requests'},
|
||||||
|
pages => $watcher->{'item:count|pages'} };
|
||||||
|
};
|
||||||
|
|
||||||
|
if (scalar(keys %{$self->{watchers}}) <= 0) {
|
||||||
|
$self->{output}->add_option_msg(short_msg => "No instances or results found.");
|
||||||
|
$self->{output}->option_exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
||||||
|
|
||||||
|
__END__
|
||||||
|
|
||||||
|
=head1 MODE
|
||||||
|
|
||||||
|
Check Kadiska application watchers' statistics during the period specified.
|
||||||
|
|
||||||
|
=over 8
|
||||||
|
|
||||||
|
=item B<--filter-watcher-name>
|
||||||
|
|
||||||
|
Filter on an application watcher to only display related statistics.
|
||||||
|
|
||||||
|
=item B<--warning-errors-prct>
|
||||||
|
|
||||||
|
Warning threshold for web browser errors (4xx and 5xx types) in percentage.
|
||||||
|
|
||||||
|
=item B<--critical-errors-prct>
|
||||||
|
|
||||||
|
Critical threshold for web browser errors (4xx and 5xx types) in percentage.
|
||||||
|
|
||||||
|
=item B<--warning-sessions>
|
||||||
|
|
||||||
|
Warning threshold for web sessions number.
|
||||||
|
|
||||||
|
=item B<--critical-sessions>
|
||||||
|
|
||||||
|
Critical threshold for web sessions number.
|
||||||
|
|
||||||
|
=item B<--warning-request>
|
||||||
|
|
||||||
|
Warning threshold for requests number.
|
||||||
|
|
||||||
|
=item B<--critical-request>
|
||||||
|
|
||||||
|
Critical threshold for requests number.
|
||||||
|
|
||||||
|
=item B<--warning-pages>
|
||||||
|
|
||||||
|
Warning threshold for requested pages by the application.
|
||||||
|
|
||||||
|
=item B<--critical-pages>
|
||||||
|
|
||||||
|
Critical threshold for requested pages by the application.
|
||||||
|
|
||||||
|
=back
|
||||||
|
|
||||||
|
=cut
|
|
@ -0,0 +1,53 @@
|
||||||
|
#
|
||||||
|
# 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 apps::monitoring::kadiska::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} = '1.0';
|
||||||
|
$self->{modes} = {
|
||||||
|
'list-watchers' => 'apps::monitoring::kadiska::mode::listwatchers',
|
||||||
|
'list-stations' => 'apps::monitoring::kadiska::mode::liststations',
|
||||||
|
'list-targets' => 'apps::monitoring::kadiska::mode::listtargets',
|
||||||
|
'watcher-statistics' => 'apps::monitoring::kadiska::mode::watcherstatistics',
|
||||||
|
'tracer-statistics' => 'apps::monitoring::kadiska::mode::tracerstatistics'
|
||||||
|
};
|
||||||
|
|
||||||
|
$self->{custom_modes}->{api} = 'apps::monitoring::kadiska::custom::api';
|
||||||
|
return $self;
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
||||||
|
|
||||||
|
__END__
|
||||||
|
|
||||||
|
=head1 PLUGIN DESCRIPTION
|
||||||
|
|
||||||
|
Monitor Kadiska metrics through Rest API.
|
||||||
|
|
||||||
|
=cut
|
Loading…
Reference in New Issue