Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enhance quadstor vtltapeusage mode #987

Merged
merged 2 commits into from
May 14, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 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 @@ -257,6 +270,7 @@ sub manage_selection {
used_prct => $used_prct,
status => $status,
};
$self->{global}->{count}++;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we get a "skipped no value" if 0 tapes ? Think it should be better to init to 0 before looping through the tapes.

}

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