add new perfdata (inodes, cpudetailed)

This commit is contained in:
garnier-quentin 2019-06-06 17:47:56 +02:00
parent 33d97c5a3c
commit 3ada46dec8
2 changed files with 24 additions and 22 deletions

View File

@ -76,7 +76,7 @@ sub set_counters {
{ name => 'global', type => 0, cb_prefix_output => 'prefix_cpu_output', skipped_code => { -10 => 1 } }, { name => 'global', type => 0, cb_prefix_output => 'prefix_cpu_output', skipped_code => { -10 => 1 } },
]; ];
$self->{maps_counters}->{global} = [ $self->{maps_counters}->{global} = [
{ label => 'user', set => { { label => 'user', nlabel => 'cpu.user.utilization.percentage', set => {
key_values => [], key_values => [],
closure_custom_calc => $self->can('custom_cpu_calc'), closure_custom_calc_extra_options => { label_ref => 'ssCpuRawUser' }, closure_custom_calc => $self->can('custom_cpu_calc'), closure_custom_calc_extra_options => { label_ref => 'ssCpuRawUser' },
manual_keys => 1, manual_keys => 1,
@ -87,7 +87,7 @@ sub set_counters {
], ],
} }
}, },
{ label => 'nice', set => { { label => 'nice', nlabel => 'cpu.nice.utilization.percentage', set => {
key_values => [], key_values => [],
closure_custom_calc => $self->can('custom_cpu_calc'), closure_custom_calc_extra_options => { label_ref => 'ssCpuRawNice' }, closure_custom_calc => $self->can('custom_cpu_calc'), closure_custom_calc_extra_options => { label_ref => 'ssCpuRawNice' },
manual_keys => 1, manual_keys => 1,
@ -98,7 +98,7 @@ sub set_counters {
], ],
} }
}, },
{ label => 'system', set => { { label => 'system', nlabel => 'cpu.system.utilization.percentage', set => {
key_values => [], key_values => [],
closure_custom_calc => $self->can('custom_cpu_calc'), closure_custom_calc_extra_options => { label_ref => 'ssCpuRawSystem' }, closure_custom_calc => $self->can('custom_cpu_calc'), closure_custom_calc_extra_options => { label_ref => 'ssCpuRawSystem' },
manual_keys => 1, manual_keys => 1,
@ -109,7 +109,7 @@ sub set_counters {
], ],
} }
}, },
{ label => 'idle', set => { { label => 'idle', nlabel => 'cpu.idle.utilization.percentage', set => {
key_values => [], key_values => [],
closure_custom_calc => $self->can('custom_cpu_calc'), closure_custom_calc_extra_options => { label_ref => 'ssCpuRawIdle' }, closure_custom_calc => $self->can('custom_cpu_calc'), closure_custom_calc_extra_options => { label_ref => 'ssCpuRawIdle' },
manual_keys => 1, manual_keys => 1,
@ -120,7 +120,7 @@ sub set_counters {
], ],
} }
}, },
{ label => 'wait', set => { { label => 'wait', nlabel => 'cpu.wait.utilization.percentage', set => {
key_values => [], key_values => [],
closure_custom_calc => $self->can('custom_cpu_calc'), closure_custom_calc_extra_options => { label_ref => 'ssCpuRawWait' }, closure_custom_calc => $self->can('custom_cpu_calc'), closure_custom_calc_extra_options => { label_ref => 'ssCpuRawWait' },
manual_keys => 1, manual_keys => 1,
@ -131,7 +131,7 @@ sub set_counters {
], ],
} }
}, },
{ label => 'kernel', set => { { label => 'kernel', nlabel => 'cpu.kernel.utilization.percentage', set => {
key_values => [], key_values => [],
closure_custom_calc => $self->can('custom_cpu_calc'), closure_custom_calc_extra_options => { label_ref => 'ssCpuRawKernel' }, closure_custom_calc => $self->can('custom_cpu_calc'), closure_custom_calc_extra_options => { label_ref => 'ssCpuRawKernel' },
manual_keys => 1, manual_keys => 1,
@ -142,7 +142,7 @@ sub set_counters {
], ],
} }
}, },
{ label => 'interrupt', set => { { label => 'interrupt', nlabel => 'cpu.interrupt.utilization.percentage', set => {
key_values => [], key_values => [],
closure_custom_calc => $self->can('custom_cpu_calc'), closure_custom_calc_extra_options => { label_ref => 'ssCpuRawInterrupt' }, closure_custom_calc => $self->can('custom_cpu_calc'), closure_custom_calc_extra_options => { label_ref => 'ssCpuRawInterrupt' },
manual_keys => 1, manual_keys => 1,
@ -153,7 +153,7 @@ sub set_counters {
], ],
} }
}, },
{ label => 'softirq', set => { { label => 'softirq', nlabel => 'cpu.softirq.utilization.percentage', set => {
key_values => [], key_values => [],
closure_custom_calc => $self->can('custom_cpu_calc'), closure_custom_calc_extra_options => { label_ref => 'ssCpuRawSoftIRQ' }, closure_custom_calc => $self->can('custom_cpu_calc'), closure_custom_calc_extra_options => { label_ref => 'ssCpuRawSoftIRQ' },
manual_keys => 1, manual_keys => 1,
@ -164,7 +164,7 @@ sub set_counters {
], ],
} }
}, },
{ label => 'steal', set => { { label => 'steal', nlabel => 'cpu.steal.utilization.percentage', set => {
key_values => [], key_values => [],
closure_custom_calc => $self->can('custom_cpu_calc'), closure_custom_calc_extra_options => { label_ref => 'ssCpuRawSteal' }, closure_custom_calc => $self->can('custom_cpu_calc'), closure_custom_calc_extra_options => { label_ref => 'ssCpuRawSteal' },
manual_keys => 1, manual_keys => 1,
@ -175,7 +175,7 @@ sub set_counters {
], ],
} }
}, },
{ label => 'guest', set => { { label => 'guest', nlabel => 'cpu.guest.utilization.percentage', set => {
key_values => [], key_values => [],
closure_custom_calc => $self->can('custom_cpu_calc'), closure_custom_calc_extra_options => { label_ref => 'ssCpuRawGuest' }, closure_custom_calc => $self->can('custom_cpu_calc'), closure_custom_calc_extra_options => { label_ref => 'ssCpuRawGuest' },
manual_keys => 1, manual_keys => 1,
@ -186,7 +186,7 @@ sub set_counters {
], ],
} }
}, },
{ label => 'guestnice', set => { { label => 'guestnice', nlabel => 'cpu.guestnice.utilization.percentage', set => {
key_values => [], key_values => [],
closure_custom_calc => $self->can('custom_cpu_calc'), closure_custom_calc_extra_options => { label_ref => 'ssCpuRawGuestNice' }, closure_custom_calc => $self->can('custom_cpu_calc'), closure_custom_calc_extra_options => { label_ref => 'ssCpuRawGuestNice' },
manual_keys => 1, manual_keys => 1,

View File

@ -33,7 +33,7 @@ sub set_counters {
]; ];
$self->{maps_counters}->{disk} = [ $self->{maps_counters}->{disk} = [
{ label => 'usage', set => { { label => 'usage', nlabel => 'storage.inodes.usage.percentage', set => {
key_values => [ { name => 'usage' }, { name => 'display' } ], key_values => [ { name => 'usage' }, { name => 'display' } ],
output_template => 'Used: %s %%', output_error_template => "%s", output_template => 'Used: %s %%', output_error_template => "%s",
perfdatas => [ perfdatas => [
@ -58,13 +58,13 @@ sub new {
$self->{version} = '1.0'; $self->{version} = '1.0';
$options{options}->add_options(arguments => { $options{options}->add_options(arguments => {
"name" => { name => 'use_name' }, 'name' => { name => 'use_name' },
"diskpath:s" => { name => 'diskpath' }, 'diskpath:s' => { name => 'diskpath' },
"regexp" => { name => 'use_regexp' }, 'regexp' => { name => 'use_regexp' },
"regexp-isensitive" => { name => 'use_regexpi' }, 'regexp-isensitive' => { name => 'use_regexpi' },
"filter-device:s" => { name => 'filter_device' }, 'filter-device:s' => { name => 'filter_device' },
"display-transform-src:s" => { name => 'display_transform_src' }, 'display-transform-src:s' => { name => 'display_transform_src' },
"display-transform-dst:s" => { name => 'display_transform_dst' }, 'display-transform-dst:s' => { name => 'display_transform_dst' },
}); });
return $self; return $self;
@ -128,12 +128,14 @@ sub manage_selection {
} }
$self->{disk}->{$result->{dskPath}} = { display => $result->{dskPath}, $self->{disk}->{$result->{dskPath}} = {
usage => $result->{dskPercentNode} }; display => $result->{dskPath},
usage => $result->{dskPercentNode}
};
} }
if (scalar(keys %{$self->{disk}}) <= 0) { if (scalar(keys %{$self->{disk}}) <= 0) {
$self->{output}->add_option_msg(short_msg => "No entry found."); $self->{output}->add_option_msg(short_msg => 'No entry found.');
$self->{output}->option_exit(); $self->{output}->option_exit();
} }
} }