From e05005b96d9282e3ff4b087c7ef03bd5104d8e06 Mon Sep 17 00:00:00 2001 From: garnier-quentin Date: Thu, 6 Jun 2019 17:47:56 +0200 Subject: [PATCH] add new perfdata (inodes, cpudetailed) --- snmp_standard/mode/cpudetailed.pm | 22 +++++++++++----------- snmp_standard/mode/inodes.pm | 24 +++++++++++++----------- 2 files changed, 24 insertions(+), 22 deletions(-) diff --git a/snmp_standard/mode/cpudetailed.pm b/snmp_standard/mode/cpudetailed.pm index 8b2b1b459..7264536dc 100644 --- a/snmp_standard/mode/cpudetailed.pm +++ b/snmp_standard/mode/cpudetailed.pm @@ -76,7 +76,7 @@ sub set_counters { { name => 'global', type => 0, cb_prefix_output => 'prefix_cpu_output', skipped_code => { -10 => 1 } }, ]; $self->{maps_counters}->{global} = [ - { label => 'user', set => { + { label => 'user', nlabel => 'cpu.user.utilization.percentage', set => { key_values => [], closure_custom_calc => $self->can('custom_cpu_calc'), closure_custom_calc_extra_options => { label_ref => 'ssCpuRawUser' }, manual_keys => 1, @@ -87,7 +87,7 @@ sub set_counters { ], } }, - { label => 'nice', set => { + { label => 'nice', nlabel => 'cpu.nice.utilization.percentage', set => { key_values => [], closure_custom_calc => $self->can('custom_cpu_calc'), closure_custom_calc_extra_options => { label_ref => 'ssCpuRawNice' }, manual_keys => 1, @@ -98,7 +98,7 @@ sub set_counters { ], } }, - { label => 'system', set => { + { label => 'system', nlabel => 'cpu.system.utilization.percentage', set => { key_values => [], closure_custom_calc => $self->can('custom_cpu_calc'), closure_custom_calc_extra_options => { label_ref => 'ssCpuRawSystem' }, manual_keys => 1, @@ -109,7 +109,7 @@ sub set_counters { ], } }, - { label => 'idle', set => { + { label => 'idle', nlabel => 'cpu.idle.utilization.percentage', set => { key_values => [], closure_custom_calc => $self->can('custom_cpu_calc'), closure_custom_calc_extra_options => { label_ref => 'ssCpuRawIdle' }, manual_keys => 1, @@ -120,7 +120,7 @@ sub set_counters { ], } }, - { label => 'wait', set => { + { label => 'wait', nlabel => 'cpu.wait.utilization.percentage', set => { key_values => [], closure_custom_calc => $self->can('custom_cpu_calc'), closure_custom_calc_extra_options => { label_ref => 'ssCpuRawWait' }, manual_keys => 1, @@ -131,7 +131,7 @@ sub set_counters { ], } }, - { label => 'kernel', set => { + { label => 'kernel', nlabel => 'cpu.kernel.utilization.percentage', set => { key_values => [], closure_custom_calc => $self->can('custom_cpu_calc'), closure_custom_calc_extra_options => { label_ref => 'ssCpuRawKernel' }, manual_keys => 1, @@ -142,7 +142,7 @@ sub set_counters { ], } }, - { label => 'interrupt', set => { + { label => 'interrupt', nlabel => 'cpu.interrupt.utilization.percentage', set => { key_values => [], closure_custom_calc => $self->can('custom_cpu_calc'), closure_custom_calc_extra_options => { label_ref => 'ssCpuRawInterrupt' }, manual_keys => 1, @@ -153,7 +153,7 @@ sub set_counters { ], } }, - { label => 'softirq', set => { + { label => 'softirq', nlabel => 'cpu.softirq.utilization.percentage', set => { key_values => [], closure_custom_calc => $self->can('custom_cpu_calc'), closure_custom_calc_extra_options => { label_ref => 'ssCpuRawSoftIRQ' }, manual_keys => 1, @@ -164,7 +164,7 @@ sub set_counters { ], } }, - { label => 'steal', set => { + { label => 'steal', nlabel => 'cpu.steal.utilization.percentage', set => { key_values => [], closure_custom_calc => $self->can('custom_cpu_calc'), closure_custom_calc_extra_options => { label_ref => 'ssCpuRawSteal' }, manual_keys => 1, @@ -175,7 +175,7 @@ sub set_counters { ], } }, - { label => 'guest', set => { + { label => 'guest', nlabel => 'cpu.guest.utilization.percentage', set => { key_values => [], closure_custom_calc => $self->can('custom_cpu_calc'), closure_custom_calc_extra_options => { label_ref => 'ssCpuRawGuest' }, manual_keys => 1, @@ -186,7 +186,7 @@ sub set_counters { ], } }, - { label => 'guestnice', set => { + { label => 'guestnice', nlabel => 'cpu.guestnice.utilization.percentage', set => { key_values => [], closure_custom_calc => $self->can('custom_cpu_calc'), closure_custom_calc_extra_options => { label_ref => 'ssCpuRawGuestNice' }, manual_keys => 1, diff --git a/snmp_standard/mode/inodes.pm b/snmp_standard/mode/inodes.pm index 194edaa5f..cee88b73d 100644 --- a/snmp_standard/mode/inodes.pm +++ b/snmp_standard/mode/inodes.pm @@ -33,7 +33,7 @@ sub set_counters { ]; $self->{maps_counters}->{disk} = [ - { label => 'usage', set => { + { label => 'usage', nlabel => 'storage.inodes.usage.percentage', set => { key_values => [ { name => 'usage' }, { name => 'display' } ], output_template => 'Used: %s %%', output_error_template => "%s", perfdatas => [ @@ -58,13 +58,13 @@ sub new { $self->{version} = '1.0'; $options{options}->add_options(arguments => { - "name" => { name => 'use_name' }, - "diskpath:s" => { name => 'diskpath' }, - "regexp" => { name => 'use_regexp' }, - "regexp-isensitive" => { name => 'use_regexpi' }, - "filter-device:s" => { name => 'filter_device' }, - "display-transform-src:s" => { name => 'display_transform_src' }, - "display-transform-dst:s" => { name => 'display_transform_dst' }, + 'name' => { name => 'use_name' }, + 'diskpath:s' => { name => 'diskpath' }, + 'regexp' => { name => 'use_regexp' }, + 'regexp-isensitive' => { name => 'use_regexpi' }, + 'filter-device:s' => { name => 'filter_device' }, + 'display-transform-src:s' => { name => 'display_transform_src' }, + 'display-transform-dst:s' => { name => 'display_transform_dst' }, }); return $self; @@ -128,12 +128,14 @@ sub manage_selection { } - $self->{disk}->{$result->{dskPath}} = { display => $result->{dskPath}, - usage => $result->{dskPercentNode} }; + $self->{disk}->{$result->{dskPath}} = { + display => $result->{dskPath}, + usage => $result->{dskPercentNode} + }; } 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(); } }