enhance quadstor vtltapeusage mode (#987)

* enhance quadstor vtltapeusage mode

* init counter to 0
This commit is contained in:
cgagnaire 2018-05-14 14:25:01 +00:00 committed by Simon Bomm
parent 9f6aa3e3a2
commit e0698406f4
1 changed files with 19 additions and 4 deletions

View File

@ -136,9 +136,22 @@ sub set_counters {
my ($self, %options) = @_;
$self->{maps_counters_type} = [
{ name => 'global', type => 0 },
{ name => 'tape', type => 1, cb_prefix_output => 'prefix_tape_output', message_multiple => 'All tapes are ok' }
];
$self->{maps_counters}->{global} = [
{ label => 'count', set => {
key_values => [ { name => 'count' } ],
output_template => 'Number of tapes : %s',
perfdatas => [
{ label => 'count', value => 'count_absolute', template => '%s',
unit => 'tapes', min => 0 },
],
}
},
];
$self->{maps_counters}->{tape} = [
{ label => 'status', threshold => 0, set => {
key_values => [ { name => 'status' }, { name => 'display' } ],
@ -228,6 +241,7 @@ sub manage_selection {
command => $self->{option_results}->{command},
command_path => $self->{option_results}->{command_path},
command_options => $self->{option_results}->{command_options});
$self->{global}->{count} = 0;
$self->{tape} = {};
#Pool Label Element Address Vtype WORM Size Used% Status
#Default 701862L2 Unknown 0 LTO 2 200GB No 200 99 Vaulted
@ -257,6 +271,7 @@ sub manage_selection {
used_prct => $used_prct,
status => $status,
};
$self->{global}->{count}++;
}
if (scalar(keys %{$self->{tape}}) == 0) {
@ -345,12 +360,12 @@ Can used special variables like: %{status}, %{display}
=item B<--warning-*>
Threshold warning.
Can be: 'usage'.
Can be: 'count', 'usage'.
=item B<--critical-*>
Threshold critical.
Can be: 'usage'.
Can be: 'count', 'usage'.
=back