Skip to content

Commit

Permalink
enhance quadstor vtltapeusage mode (#987)
Browse files Browse the repository at this point in the history
* enhance quadstor vtltapeusage mode

* init counter to 0
  • Loading branch information
cgagnaire authored and Sims24 committed May 14, 2018
1 parent 9f6aa3e commit e069840
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions apps/backup/quadstor/local/mode/vtltapeusage.pm
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ sub custom_status_threshold {
eval "$instance_mode->{option_results}->{critical_status}") {
$status = 'critical';
} elsif (defined($instance_mode->{option_results}->{warning_status}) && $instance_mode->{option_results}->{warning_status} ne '' &&
eval "$instance_mode->{option_results}->{warning_status}") {
eval "$instance_mode->{option_results}->{warning_status}") {
$status = 'warning';
}
};
Expand Down Expand Up @@ -136,8 +136,21 @@ 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 => {
Expand Down Expand Up @@ -227,7 +240,8 @@ sub manage_selection {
sudo => $self->{option_results}->{sudo},
command => $self->{option_results}->{command},
command_path => $self->{option_results}->{command_path},
command_options => $self->{option_results}->{command_options});
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
Expand Down Expand Up @@ -257,6 +271,7 @@ sub manage_selection {
used_prct => $used_prct,
status => $status,
};
$self->{global}->{count}++;
}

if (scalar(keys %{$self->{tape}}) == 0) {
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit e069840

Please sign in to comment.