adjust/move prometheus perfdata + cleaning
This commit is contained in:
parent
2d9067455a
commit
6ccfd0104e
|
@ -29,14 +29,13 @@ use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold)
|
|||
sub custom_status_perfdata {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $extra_label = '';
|
||||
if (!defined($options{extra_instance}) || $options{extra_instance} != 0) {
|
||||
$extra_label .= '_' . $self->{result_values}->{instance};
|
||||
}
|
||||
|
||||
foreach my $key (@{$self->{instance_mode}->{custom_keys}}) {
|
||||
$self->{output}->perfdata_add(label => $key . $extra_label,
|
||||
value => $self->{result_values}->{$key});
|
||||
$self->{output}->perfdata_add(
|
||||
label => $key,
|
||||
nlabel => $key,
|
||||
value => $self->{result_values}->{$key},
|
||||
instances => $self->use_instances(extra_instance => $options{extra_instance}) ? $self->{result_values}->{display} : undef
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -91,17 +90,16 @@ sub new {
|
|||
bless $self, $class;
|
||||
|
||||
$self->{version} = '1.0';
|
||||
$options{options}->add_options(arguments =>
|
||||
{
|
||||
"query:s@" => { name => 'query' },
|
||||
"query-range:s@" => { name => 'query_range' },
|
||||
"instance:s" => { name => 'instance' },
|
||||
"aggregation:s" => { name => 'aggregation', default => 'average' },
|
||||
"output:s" => { name => 'output' },
|
||||
"multiple-output:s" => { name => 'multiple_output' },
|
||||
"warning-status:s" => { name => 'warning_status', default => '' },
|
||||
"critical-status:s" => { name => 'critical_status', default => '' },
|
||||
});
|
||||
$options{options}->add_options(arguments => {
|
||||
"query:s@" => { name => 'query' },
|
||||
"query-range:s@" => { name => 'query_range' },
|
||||
"instance:s" => { name => 'instance' },
|
||||
"aggregation:s" => { name => 'aggregation', default => 'average' },
|
||||
"output:s" => { name => 'output' },
|
||||
"multiple-output:s" => { name => 'multiple_output' },
|
||||
"warning-status:s" => { name => 'warning_status', default => '' },
|
||||
"critical-status:s" => { name => 'critical_status', default => '' },
|
||||
});
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
|
|
@ -67,45 +67,45 @@ sub set_counters {
|
|||
];
|
||||
|
||||
$self->{maps_counters}->{global} = [
|
||||
{ label => 'active', set => {
|
||||
{ label => 'active', nlabel => 'targets.active.count', set => {
|
||||
key_values => [ { name => 'active' } ],
|
||||
output_template => 'Active : %s',
|
||||
output_template => 'Active: %s',
|
||||
perfdatas => [
|
||||
{ label => 'active_targets', value => 'active_absolute', template => '%s',
|
||||
min => 0 },
|
||||
],
|
||||
}
|
||||
},
|
||||
{ label => 'dropped', set => {
|
||||
{ label => 'dropped', nlabel => 'targets.dropped.count', set => {
|
||||
key_values => [ { name => 'dropped' } ],
|
||||
output_template => 'Dropped : %s',
|
||||
output_template => 'Dropped: %s',
|
||||
perfdatas => [
|
||||
{ label => 'dropped_targets', value => 'dropped_absolute', template => '%s',
|
||||
min => 0 },
|
||||
],
|
||||
}
|
||||
},
|
||||
{ label => 'up', set => {
|
||||
{ label => 'up', nlabel => 'targets.up.count', set => {
|
||||
key_values => [ { name => 'up' } ],
|
||||
output_template => 'Up : %s',
|
||||
output_template => 'Up: %s',
|
||||
perfdatas => [
|
||||
{ label => 'up_targets', value => 'up_absolute', template => '%s',
|
||||
min => 0 },
|
||||
],
|
||||
}
|
||||
},
|
||||
{ label => 'down', set => {
|
||||
{ label => 'down', nlabel => 'targets.down.count', set => {
|
||||
key_values => [ { name => 'down' } ],
|
||||
output_template => 'Down : %s',
|
||||
output_template => 'Down: %s',
|
||||
perfdatas => [
|
||||
{ label => 'down_targets', value => 'down_absolute', template => '%s',
|
||||
min => 0 },
|
||||
],
|
||||
}
|
||||
},
|
||||
{ label => 'unknown', set => {
|
||||
{ label => 'unknown', nlabel => 'targets.unknown.count', set => {
|
||||
key_values => [ { name => 'unknown' } ],
|
||||
output_template => 'Unknown : %s',
|
||||
output_template => 'Unknown: %s',
|
||||
perfdatas => [
|
||||
{ label => 'unknown_targets', value => 'unknown_absolute', template => '%s',
|
||||
min => 0 },
|
||||
|
@ -132,12 +132,11 @@ sub new {
|
|||
bless $self, $class;
|
||||
|
||||
$self->{version} = '1.0';
|
||||
$options{options}->add_options(arguments =>
|
||||
{
|
||||
"filter-label:s@" => { name => 'filter_label' },
|
||||
"warning-status:s" => { name => 'warning_status', default => '' },
|
||||
"critical-status:s" => { name => 'critical_status', default => '%{health} !~ /up/' },
|
||||
});
|
||||
$options{options}->add_options(arguments => {
|
||||
"filter-label:s@" => { name => 'filter_label' },
|
||||
"warning-status:s" => { name => 'warning_status', default => '' },
|
||||
"critical-status:s" => { name => 'critical_status', default => '%{health} !~ /up/' },
|
||||
});
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue