(plugin) apps::monitoring:kadiska - removing old perfdata labels (#3638)

* 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

* remove old perfdata labels and unused if condition

* format
This commit is contained in:
lchrdn 2022-05-04 23:23:17 +02:00 committed by GitHub
parent eb5c702e01
commit 3f13066ccd
2 changed files with 17 additions and 18 deletions

View File

@ -44,7 +44,7 @@ sub set_counters {
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 },
{ template => '%.2f', unit => 'ms', min => 0, label_extra_instance => 1 },
],
}
},
@ -52,7 +52,7 @@ sub set_counters {
key_values => [ { name => 'path_length' } ],
output_template => 'Path length: %.2f',
perfdatas => [
{ label => 'path_length', template => '%.2f', min => 0, label_extra_instance => 1 },
{ template => '%.2f', min => 0, label_extra_instance => 1 },
],
}
},
@ -60,7 +60,7 @@ sub set_counters {
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 },
{ template => '%.2f', unit => '%', min => 0, max => 100, label_extra_instance => 1 },
],
}
}
@ -132,10 +132,10 @@ sub manage_selection {
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'},
}
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) {

View File

@ -44,7 +44,7 @@ sub set_counters {
key_values => [ { name => 'errors_prct' } ],
output_template => 'errors: %.2f%%',
perfdatas => [
{ label => 'errors_prct', template => '%.2f', unit => '%', min => 0, max => 100, label_extra_instance => 1 },
{ template => '%.2f', unit => '%', min => 0, max => 100, label_extra_instance => 1 },
],
}
},
@ -52,7 +52,7 @@ sub set_counters {
key_values => [ { name => 'sessions' } ],
output_template => 'sessions: %s',
perfdatas => [
{ label => 'sessions', template => '%s', min => 0, label_extra_instance => 1 },
{ template => '%s', min => 0, label_extra_instance => 1 },
],
}
},
@ -60,7 +60,7 @@ sub set_counters {
key_values => [ { name => 'requests' } ],
output_template => 'requests: %s',
perfdatas => [
{ label => 'requests', template => '%s', min => 0, label_extra_instance => 1 },
{ template => '%s', min => 0, label_extra_instance => 1 },
],
}
},
@ -68,7 +68,7 @@ sub set_counters {
key_values => [ { name => 'pages' } ],
output_template => 'pages: %d',
perfdatas => [
{ label => 'pages', template => '%d', min => 0, label_extra_instance => 1 },
{ template => '%d', min => 0, label_extra_instance => 1 },
],
}
}
@ -136,16 +136,15 @@ sub manage_selection {
$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'} };
$self->{watchers}->{$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) {