add new perfdata (inodes, cpudetailed)

This commit is contained in:
garnier-quentin 2019-06-06 17:47:56 +02:00
parent 7fcec984f1
commit e05005b96d
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 } },
];
$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,

View File

@ -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();
}
}