mirror of
https://github.com/centreon/centreon-plugins.git
synced 2025-07-17 02:34:41 +02:00
enh(plugin)apps-protocols-snmp metricsv2 (#2582)
This commit is contained in:
parent
0275a85c77
commit
141cbf8e54
@ -26,6 +26,12 @@ use strict;
|
|||||||
use warnings;
|
use warnings;
|
||||||
use Time::HiRes qw(gettimeofday tv_interval);
|
use Time::HiRes qw(gettimeofday tv_interval);
|
||||||
|
|
||||||
|
sub prefix_output {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
return "SNMP Agent ";
|
||||||
|
}
|
||||||
|
|
||||||
sub set_counters {
|
sub set_counters {
|
||||||
my ($self, %options) = @_;
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
@ -34,45 +40,39 @@ sub set_counters {
|
|||||||
];
|
];
|
||||||
|
|
||||||
$self->{maps_counters}->{global} = [
|
$self->{maps_counters}->{global} = [
|
||||||
{ label => 'rta', set => {
|
{ label => 'rta', nlabel => 'response.time.average', set => {
|
||||||
key_values => [ { name => 'rta' } ],
|
key_values => [ { name => 'rta' } ],
|
||||||
output_template => 'rta %.3fms',
|
output_template => 'rta %.3fms',
|
||||||
perfdatas => [
|
perfdatas => [
|
||||||
{ label => 'rta', value => 'rta', template => '%.3f', min => 0, unit => 'ms' },
|
{ label => 'rta', template => '%.3f', min => 0, unit => 'ms' }
|
||||||
],
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ label => 'rtmax', display_ok => 0, set => {
|
{ label => 'rtmax', nlabel => 'response.time.max', display_ok => 0, set => {
|
||||||
key_values => [ { name => 'rtmax' } ],
|
key_values => [ { name => 'rtmax' } ],
|
||||||
perfdatas => [
|
perfdatas => [
|
||||||
{ label => 'rtmax', value => 'rtmax', template => '%.3f', min => 0, unit => 'ms' },
|
{ label => 'rtmax', template => '%.3f', min => 0, unit => 'ms' }
|
||||||
],
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ label => 'rtmin', display_ok => 0, set => {
|
{ label => 'rtmin', nlabel => 'response.time.max', display_ok => 0, set => {
|
||||||
key_values => [ { name => 'rtmin' } ],
|
key_values => [ { name => 'rtmin' } ],
|
||||||
perfdatas => [
|
perfdatas => [
|
||||||
{ label => 'rtmin', value => 'rtmin', template => '%.3f', min => 0, unit => 'ms' },
|
{ label => 'rtmin', template => '%.3f', min => 0, unit => 'ms' }
|
||||||
],
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ label => 'pl', set => {
|
{ label => 'pl', nlabel => 'packets.loss.percentage', set => {
|
||||||
key_values => [ { name => 'pl' } ],
|
key_values => [ { name => 'pl' } ],
|
||||||
output_template => 'lost %s%%',
|
output_template => 'lost %s%%',
|
||||||
perfdatas => [
|
perfdatas => [
|
||||||
{ label => 'pl', value => 'pl', template => '%s', min => 0, max => 100, unit => '%' },
|
{ label => 'pl', template => '%s', min => 0, max => 100, unit => '%' }
|
||||||
],
|
]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
sub prefix_output {
|
|
||||||
my ($self, %options) = @_;
|
|
||||||
|
|
||||||
return "SNMP Agent ";
|
|
||||||
}
|
|
||||||
|
|
||||||
sub new {
|
sub new {
|
||||||
my ($class, %options) = @_;
|
my ($class, %options) = @_;
|
||||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||||
@ -80,7 +80,7 @@ sub new {
|
|||||||
|
|
||||||
$options{options}->add_options(arguments => {
|
$options{options}->add_options(arguments => {
|
||||||
"timeout:s" => { name => 'timeout' },
|
"timeout:s" => { name => 'timeout' },
|
||||||
"packets:s" => { name => 'packets' },
|
"packets:s" => { name => 'packets' }
|
||||||
});
|
});
|
||||||
|
|
||||||
return $self;
|
return $self;
|
||||||
|
@ -30,13 +30,13 @@ sub new {
|
|||||||
bless $self, $class;
|
bless $self, $class;
|
||||||
|
|
||||||
$self->{version} = '0.1';
|
$self->{version} = '0.1';
|
||||||
%{$self->{modes}} = (
|
$self->{modes} = {
|
||||||
'dynamic-command' => 'snmp_standard::mode::dynamiccommand',
|
'dynamic-command' => 'snmp_standard::mode::dynamiccommand',
|
||||||
'numeric-value' => 'snmp_standard::mode::numericvalue',
|
'numeric-value' => 'snmp_standard::mode::numericvalue',
|
||||||
'response-time' => 'apps::protocols::snmp::mode::responsetime',
|
'response-time' => 'apps::protocols::snmp::mode::responsetime',
|
||||||
'string-value' => 'snmp_standard::mode::stringvalue',
|
'string-value' => 'snmp_standard::mode::stringvalue',
|
||||||
'uptime' => 'snmp_standard::mode::uptime',
|
'uptime' => 'snmp_standard::mode::uptime'
|
||||||
);
|
};
|
||||||
|
|
||||||
return $self;
|
return $self;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user