+ add an option '--list-counters' in core library
This commit is contained in:
parent
298ac966b8
commit
612e842b22
|
@ -83,6 +83,7 @@ sub new {
|
|||
$options{options}->add_options(arguments =>
|
||||
{
|
||||
"filter-counters:s" => { name => 'filter_counters' },
|
||||
"list-counters" => { name => 'list_counters' },
|
||||
});
|
||||
$self->{statefile_value} = undef;
|
||||
if (defined($options{statefile}) && $options{statefile}) {
|
||||
|
@ -116,6 +117,17 @@ sub check_options {
|
|||
my ($self, %options) = @_;
|
||||
$self->SUPER::init(%options);
|
||||
|
||||
if (defined($self->{option_results}->{list_counters})) {
|
||||
my $list_counter = "Counter list:";
|
||||
foreach my $key (keys %{$self->{maps_counters}}) {
|
||||
foreach (@{$self->{maps_counters}->{$key}}) {
|
||||
$list_counter .= " " . $_->{label};
|
||||
}
|
||||
}
|
||||
$self->{output}->output_add(short_msg => $list_counter);
|
||||
$self->{output}->display(nolabel => 1, force_ignore_perfdata => 1);
|
||||
$self->{output}->exit();
|
||||
}
|
||||
foreach my $key (keys %{$self->{maps_counters}}) {
|
||||
foreach (@{$self->{maps_counters}->{$key}}) {
|
||||
$_->{obj}->init(option_results => $self->{option_results});
|
||||
|
|
Loading…
Reference in New Issue