enh(plugin): PVX Rest API metricsv2 (#2820)
* enh(plugin): PVX Restapi metricsv2 * nlabel name fix
This commit is contained in:
parent
cb5d170caf
commit
1e79829632
|
@ -25,6 +25,12 @@ use base qw(centreon::plugins::templates::counter);
|
|||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub prefix_instances_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return $options{instance_value}->{instance_label} . " '" . $options{instance_value}->{key} . "' ";
|
||||
}
|
||||
|
||||
sub set_counters {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
|
@ -33,42 +39,36 @@ sub set_counters {
|
|||
];
|
||||
|
||||
$self->{maps_counters}->{instances} = [
|
||||
{ label => 'ratio', set => {
|
||||
{ label => 'ratio', nlabel => 'http.hits.percentage', set => {
|
||||
key_values => [ { name => 'ratio' }, { name => 'key' }, { name => 'instance_label' } ],
|
||||
output_template => 'Ratio: %.2f',
|
||||
perfdatas => [
|
||||
{ label => 'ratio', template => '%.2f',
|
||||
min => 0, label_extra_instance => 1, instance_use => 'key' },
|
||||
],
|
||||
min => 0, label_extra_instance => 1, instance_use => 'key' }
|
||||
]
|
||||
}
|
||||
},
|
||||
{ label => 'hits-error', set => {
|
||||
{ label => 'hits-error', nlabel => 'http.hits.error.hitspersecond', set => {
|
||||
key_values => [ { name => 'error_hits' }, { name => 'key' }, { name => 'instance_label' } ],
|
||||
output_template => 'Hits Error: %.3f hits/s',
|
||||
perfdatas => [
|
||||
{ label => 'hits_error', template => '%.3f',
|
||||
min => 0, unit => 'hits/s', label_extra_instance => 1, instance_use => 'key' },
|
||||
],
|
||||
min => 0, unit => 'hits/s', label_extra_instance => 1, instance_use => 'key' }
|
||||
]
|
||||
}
|
||||
},
|
||||
{ label => 'hits', set => {
|
||||
{ label => 'hits', nlabel => 'http.hits.hitspersecond', set => {
|
||||
key_values => [ { name => 'hits' }, { name => 'key' }, { name => 'instance_label' } ],
|
||||
output_template => 'Hits: %.3f hits/s',
|
||||
perfdatas => [
|
||||
{ label => 'hits', template => '%.3f',
|
||||
min => 0, unit => 'hits/s', label_extra_instance => 1, instance_use => 'key' },
|
||||
],
|
||||
min => 0, unit => 'hits/s', label_extra_instance => 1, instance_use => 'key' }
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
sub prefix_instances_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return $options{instance_value}->{instance_label} . " '" . $options{instance_value}->{key} . "' ";
|
||||
}
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
|
|
|
@ -25,6 +25,12 @@ use base qw(centreon::plugins::templates::counter);
|
|||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub prefix_instances_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return $options{instance_value}->{instance_label} . " '" . $options{instance_value}->{key} . "' ";
|
||||
}
|
||||
|
||||
sub set_counters {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
|
@ -33,51 +39,45 @@ sub set_counters {
|
|||
];
|
||||
|
||||
$self->{maps_counters}->{instances} = [
|
||||
{ label => 'ratio', set => {
|
||||
{ label => 'ratio', nlabel => 'connections.ratio.percentage.', set => {
|
||||
key_values => [ { name => 'syns_ratio' }, { name => 'key' }, { name => 'instance_label' } ],
|
||||
output_template => 'Ratio: %.2f',
|
||||
perfdatas => [
|
||||
{ label => 'ratio', template => '%.2f',
|
||||
min => 0, label_extra_instance => 1, instance_use => 'key' },
|
||||
],
|
||||
min => 0, label_extra_instance => 1, instance_use => 'key' }
|
||||
]
|
||||
}
|
||||
},
|
||||
{ label => 'attempt', set => {
|
||||
{ label => 'attempt', nlabel => 'connections.attempt.connectionspersecond', set => {
|
||||
key_values => [ { name => 'syns' }, { name => 'key' }, { name => 'instance_label' } ],
|
||||
output_template => 'Connections Attempts: %.2f conn/s',
|
||||
perfdatas => [
|
||||
{ label => 'attempt', template => '%.2f',
|
||||
min => 0, unit => 'connections/s', label_extra_instance => 1, instance_use => 'key' },
|
||||
],
|
||||
min => 0, unit => 'connections/s', label_extra_instance => 1, instance_use => 'key' }
|
||||
]
|
||||
}
|
||||
},
|
||||
{ label => 'successful', set => {
|
||||
{ label => 'successful', nlabel => 'connections.successful.connectionspersecond', set => {
|
||||
key_values => [ { name => 'ct_count' }, { name => 'key' }, { name => 'instance_label' } ],
|
||||
output_template => 'Successful Connections: %.2f conn/s',
|
||||
perfdatas => [
|
||||
{ label => 'successful', template => '%.2f',
|
||||
min => 0, unit => 'connections/s', label_extra_instance => 1, instance_use => 'key' },
|
||||
],
|
||||
min => 0, unit => 'connections/s', label_extra_instance => 1, instance_use => 'key' }
|
||||
]
|
||||
}
|
||||
},
|
||||
{ label => 'connection-time', set => {
|
||||
{ label => 'connection-time', nlabel => 'connection.time.millisecond', set => {
|
||||
key_values => [ { name => 'ct' }, { name => 'key' }, { name => 'instance_label' } ],
|
||||
output_template => 'Average Connection Time: %.3f ms',
|
||||
perfdatas => [
|
||||
{ label => 'connection_time', template => '%.3f',
|
||||
min => 0, unit => 'ms', label_extra_instance => 1, instance_use => 'key' },
|
||||
],
|
||||
min => 0, unit => 'ms', label_extra_instance => 1, instance_use => 'key' }
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
sub prefix_instances_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return $options{instance_value}->{instance_label} . " '" . $options{instance_value}->{key} . "' ";
|
||||
}
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
|
|
|
@ -34,7 +34,7 @@ sub set_counters {
|
|||
];
|
||||
|
||||
$self->{maps_counters}->{global} = [
|
||||
{ label => 'total-traffic', set => {
|
||||
{ label => 'total-traffic', nlabel => 'traffic.total.bitspersecond', set => {
|
||||
key_values => [ { name => 'total_traffic' } ],
|
||||
output_template => 'Total Traffic: %.2f %s/s',
|
||||
output_change_bytes => 2,
|
||||
|
@ -43,7 +43,7 @@ sub set_counters {
|
|||
]
|
||||
}
|
||||
},
|
||||
{ label => 'total-server-traffic', set => {
|
||||
{ label => 'total-server-traffic', nlabel => 'traffic.server.total.bitspersecond', set => {
|
||||
key_values => [ { name => 'total_server_traffic' } ],
|
||||
output_template => 'Total Server Traffic: %.2f %s/s',
|
||||
output_change_bytes => 2,
|
||||
|
@ -52,7 +52,7 @@ sub set_counters {
|
|||
]
|
||||
}
|
||||
},
|
||||
{ label => 'total-client-traffic', set => {
|
||||
{ label => 'total-client-traffic', nlabel => 'traffic.client.total.bitspersecond', set => {
|
||||
key_values => [ { name => 'total_client_traffic' } ],
|
||||
output_template => 'Total Client Traffic: %.2f %s/s',
|
||||
output_change_bytes => 2,
|
||||
|
@ -64,7 +64,7 @@ sub set_counters {
|
|||
];
|
||||
|
||||
$self->{maps_counters}->{instances} = [
|
||||
{ label => 'traffic', set => {
|
||||
{ label => 'traffic', nlabel => 'traffic.bitspersecond', set => {
|
||||
key_values => [ { name => 'traffic' }, { name => 'key' }, { name => 'instance_label' } ],
|
||||
output_template => 'Traffic: %.2f %s/s',
|
||||
output_change_bytes => 2,
|
||||
|
@ -74,7 +74,7 @@ sub set_counters {
|
|||
]
|
||||
}
|
||||
},
|
||||
{ label => 'server-traffic', set => {
|
||||
{ label => 'server-traffic', nlabel => 'traffic.server.bitspersecond', set => {
|
||||
key_values => [ { name => 'server_traffic' }, { name => 'key' }, { name => 'instance_label' } ],
|
||||
output_template => 'Server Traffic: %.2f %s/s',
|
||||
output_change_bytes => 2,
|
||||
|
@ -84,7 +84,7 @@ sub set_counters {
|
|||
]
|
||||
}
|
||||
},
|
||||
{ label => 'client-traffic', set => {
|
||||
{ label => 'client-traffic', nlabel => 'traffic.client.bitspersecond', set => {
|
||||
key_values => [ { name => 'client_traffic' }, { name => 'key' }, { name => 'instance_label' } ],
|
||||
output_template => 'Client Traffic: %.2f %s/s',
|
||||
output_change_bytes => 2,
|
||||
|
|
|
@ -25,6 +25,12 @@ use base qw(centreon::plugins::templates::counter);
|
|||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub prefix_instances_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return $options{instance_value}->{instance_label} . " '" . $options{instance_value}->{key} . "' ";
|
||||
}
|
||||
|
||||
sub set_counters {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
|
@ -33,7 +39,7 @@ sub set_counters {
|
|||
];
|
||||
|
||||
$self->{maps_counters}->{instances} = [
|
||||
{ label => 'time', set => {
|
||||
{ label => 'time', nlabel => 'enduser.experience.second', set => {
|
||||
key_values => [ { name => 'user_experience' }, { name => 'key' }, { name => 'instance_label' } ],
|
||||
output_template => 'End-User Experience: %.3f s',
|
||||
perfdatas => [
|
||||
|
@ -45,12 +51,6 @@ sub set_counters {
|
|||
];
|
||||
}
|
||||
|
||||
sub prefix_instances_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return $options{instance_value}->{instance_label} . " '" . $options{instance_value}->{key} . "' ";
|
||||
}
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
|
|
|
@ -30,12 +30,12 @@ sub new {
|
|||
bless $self, $class;
|
||||
|
||||
$self->{version} = '0.1';
|
||||
%{$self->{modes}} = (
|
||||
$self->{modes} => {
|
||||
'http-hits' => 'apps::pvx::restapi::mode::httphits',
|
||||
'network-connection' => 'apps::pvx::restapi::mode::networkconnection',
|
||||
'network-user-experience' => 'apps::pvx::restapi::mode::networkuserexperience',
|
||||
'network-traffic' => 'apps::pvx::restapi::mode::networktraffic',
|
||||
);
|
||||
};
|
||||
|
||||
$self->{custom_modes}{api} = 'apps::pvx::restapi::custom::api';
|
||||
return $self;
|
||||
|
|
Loading…
Reference in New Issue