Merge pull request #1945 from UrBnW/bladeflexunit

Blade/Flex, correct units and labels
This commit is contained in:
qgarnier 2020-04-17 14:46:57 +02:00 committed by GitHub
commit 8497a1f6b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 22 additions and 22 deletions

View File

@ -35,7 +35,7 @@ sub set_counters {
$self->{maps_counters}->{cpu} = [
{ label => 'average-1m', nlabel => 'cpu.utilization.1m.percentage', set => {
key_values => [ { name => 'average_1m' } ],
output_template => '%.2f %% (1min)',
output_template => '%.2f %% (1m)',
perfdatas => [
{ value => 'average_1m_absolute', template => '%.2f',
min => 0, max => 100, unit => '%' }
@ -44,7 +44,7 @@ sub set_counters {
},
{ label => 'average-5m', nlabel => 'cpu.utilization.5m.percentage', set => {
key_values => [ { name => 'average_5m' } ],
output_template => '%.2f %% (5min)',
output_template => '%.2f %% (5m)',
perfdatas => [
{ value => 'average_5m_absolute', template => '%.2f',
min => 0, max => 100, unit => '%' }
@ -94,7 +94,7 @@ Check CPU usage (over the last minute).
=item B<--warning-*> B<--critical-*>
Thresholds.
Can be: 'average-1min' (%), 'average-5min' (%).
Can be: 'average-1m' (%), 'average-5m' (%).
=back

View File

@ -96,7 +96,7 @@ sub check {
}
$self->{output}->perfdata_add(
nlabel => 'hardware.temperature.celsius', unit => 'C',
instances => 'switch=' . $instance,
instances => 'switch' . $instance,
value => $temperature,
warning => $warn,
critical => $crit

View File

@ -33,20 +33,20 @@ sub set_counters {
];
$self->{maps_counters}->{cpu} = [
{ label => 'average-1min', nlabel => 'switch.cpu.utilization.1min.percentage', set => {
key_values => [ { name => 'average_1min' }, { name => 'display' } ],
output_template => '%.2f %% (1min)',
{ label => 'average-1m', nlabel => 'cpu.utilization.1m.percentage', set => {
key_values => [ { name => 'average_1m' }, { name => 'display' } ],
output_template => '%.2f %% (1m)',
perfdatas => [
{ value => 'average_1min_absolute', template => '%.2f',
{ value => 'average_1m_absolute', template => '%.2f',
min => 0, max => 100, unit => '%', label_extra_instance => 1 }
]
}
},
{ label => 'average-5min', nlabel => 'switch.cpu.utilization.5min.percentage', set => {
key_values => [ { name => 'average_5min' }, { name => 'display' } ],
output_template => '%.2f %% (5min)',
{ label => 'average-5m', nlabel => 'cpu.utilization.5m.percentage', set => {
key_values => [ { name => 'average_5m' }, { name => 'display' } ],
output_template => '%.2f %% (5m)',
perfdatas => [
{ value => 'average_5min_absolute', template => '%.2f',
{ value => 'average_5m_absolute', template => '%.2f',
min => 0, max => 100, unit => '%', label_extra_instance => 1 }
]
}
@ -73,8 +73,8 @@ sub new {
}
my $mapping = {
average_1min => { oid => '.1.3.6.1.4.1.20301.2.5.1.2.2.12.1.1.5' }, # mpCpuStatsUtil1MinuteSwRev
average_5min => { oid => '.1.3.6.1.4.1.20301.2.5.1.2.2.12.1.1.6' } # mpCpuStatsUtil5MinutesSwRev
average_1m => { oid => '.1.3.6.1.4.1.20301.2.5.1.2.2.12.1.1.5' }, # mpCpuStatsUtil1MinuteSwRev
average_5m => { oid => '.1.3.6.1.4.1.20301.2.5.1.2.2.12.1.1.6' } # mpCpuStatsUtil5MinutesSwRev
};
my $oid_mpCpuStatsRevTableEntry = '.1.3.6.1.4.1.20301.2.5.1.2.2.12.1.1';
@ -84,13 +84,13 @@ sub manage_selection {
my $snmp_result = $options{snmp}->get_table(
oid => $oid_mpCpuStatsRevTableEntry,
start => $mapping->{average_1min}->{oid},
start => $mapping->{average_1m}->{oid},
nothing_quit => 1
);
$self->{cpu} = {};
foreach my $oid (keys %$snmp_result) {
next if ($oid !~ /^$mapping->{average_1min}->{oid}\.(.*)$/);
next if ($oid !~ /^$mapping->{average_1m}->{oid}\.(.*)$/);
my $instance = $1;
my $result = $options{snmp}->map_instance(mapping => $mapping, results => $snmp_result, instance => $instance);
@ -100,7 +100,7 @@ sub manage_selection {
next;
}
$self->{cpu}->{$instance} = {
$self->{cpu}->{'switch' . $instance} = {
display => $instance,
%$result
};
@ -124,7 +124,7 @@ Filter switch number.
=item B<--warning-*> B<--critical-*>
Thresholds.
Can be: 'average-1min' (%), 'average-5min' (%).
Can be: 'average-1m' (%), 'average-5m' (%).
=back

View File

@ -46,7 +46,7 @@ sub set_counters {
];
$self->{maps_counters}->{memory} = [
{ label => 'usage', nlabel => 'switch.memory.usage.bytes', set => {
{ label => 'usage', nlabel => 'memory.usage.bytes', set => {
key_values => [ { name => 'used' }, { name => 'free' }, { name => 'prct_used' }, { name => 'prct_free' }, { name => 'total' }, { name => 'display' } ],
closure_custom_output => $self->can('custom_usage_output'),
perfdatas => [
@ -55,7 +55,7 @@ sub set_counters {
]
}
},
{ label => 'usage-free', display_ok => 0, nlabel => 'switch.memory.free.bytes', set => {
{ label => 'usage-free', display_ok => 0, nlabel => 'memory.free.bytes', set => {
key_values => [ { name => 'free' }, { name => 'used' }, { name => 'prct_used' }, { name => 'prct_free' }, { name => 'total' }, { name => 'display' } ],
closure_custom_output => $self->can('custom_usage_output'),
perfdatas => [
@ -64,7 +64,7 @@ sub set_counters {
]
}
},
{ label => 'usage-prct', display_ok => 0, nlabel => 'switch.memory.usage.percentage', set => {
{ label => 'usage-prct', display_ok => 0, nlabel => 'memory.usage.percentage', set => {
key_values => [ { name => 'prct_used' }, { name => 'display' } ],
output_template => 'Ram Used : %.2f %%',
perfdatas => [
@ -124,7 +124,7 @@ sub manage_selection {
}
my $prct_used = ($result->{total} - $result->{free}) * 100 / $result->{total};
$self->{memory}->{$instance} = {
$self->{memory}->{'switch' . $instance} = {
display => $instance,
prct_used => $prct_used,
prct_free => 100 - $prct_used,