enh(plugin)apps-protocol-ssh-metricsv2 (#2583)
This commit is contained in:
parent
61a05110c9
commit
0275a85c77
|
@ -25,7 +25,7 @@ use base qw(centreon::plugins::templates::counter);
|
|||
use strict;
|
||||
use warnings;
|
||||
use Time::HiRes qw(gettimeofday tv_interval);
|
||||
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold);
|
||||
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold_ng);
|
||||
|
||||
sub custom_status_output {
|
||||
my ($self, %options) = @_;
|
||||
|
@ -49,22 +49,26 @@ sub set_counters {
|
|||
{ name => 'global', type => 0, message_separator => ' - ' },
|
||||
];
|
||||
$self->{maps_counters}->{global} = [
|
||||
{ label => 'status', threshold => 0, set => {
|
||||
{
|
||||
label => 'status',
|
||||
type => 2
|
||||
critical_default => '%{message} !~ /authentification succeeded/i',
|
||||
set => {
|
||||
key_values => [ { name => 'status' }, { name => 'message' } ],
|
||||
closure_custom_calc => $self->can('custom_status_calc'),
|
||||
closure_custom_output => $self->can('custom_status_output'),
|
||||
closure_custom_perfdata => sub { return 0; },
|
||||
closure_custom_threshold_check => \&catalog_status_threshold,
|
||||
closure_custom_threshold_check => \&catalog_status_threshold_ng
|
||||
}
|
||||
},
|
||||
{ label => 'time', set => {
|
||||
{ label => 'time', nlabel => 'response.time.seconds' , set => {
|
||||
key_values => [ { name => 'time_elapsed' } ],
|
||||
output_template => 'Response time %.3fs',
|
||||
perfdatas => [
|
||||
{ label => 'time', value => 'time_elapsed', template => '%.3f', unit => 's', min => 0 },
|
||||
],
|
||||
{ label => 'time', template => '%.3f', unit => 's', min => 0 }
|
||||
]
|
||||
}
|
||||
},
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -73,22 +77,12 @@ sub new {
|
|||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments =>
|
||||
{
|
||||
"warning-status:s" => { name => 'warning_status', default => '' },
|
||||
"critical-status:s" => { name => 'critical_status', default => '%{message} !~ /authentification succeeded/i' },
|
||||
});
|
||||
$options{options}->add_options(arguments => {
|
||||
});
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub check_options {
|
||||
my ($self, %options) = @_;
|
||||
$self->SUPER::check_options(%options);
|
||||
|
||||
$self->change_macros(macros => ['warning_status', 'critical_status']);
|
||||
}
|
||||
|
||||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
|
|
|
@ -30,9 +30,9 @@ sub new {
|
|||
bless $self, $class;
|
||||
|
||||
$self->{version} = '0.1';
|
||||
%{$self->{modes}} = (
|
||||
'login' => 'apps::protocols::ssh::mode::login',
|
||||
);
|
||||
$self->{modes} = {
|
||||
'login' => 'apps::protocols::ssh::mode::login'
|
||||
};
|
||||
|
||||
$self->{custom_modes}{api} = 'centreon::common::protocols::ssh::custom::api';
|
||||
return $self;
|
||||
|
|
Loading…
Reference in New Issue