This commit is contained in:
garnier-quentin 2020-05-15 09:21:59 +02:00 committed by Lotfi zaouche
parent 2f78e4192f
commit 307bb39697
2 changed files with 16 additions and 8 deletions

View File

@ -31,21 +31,22 @@ sub set_counters {
my ($self, %options) = @_;
$self->{maps_counters_type} = [
{ name => 'vm', type => 1, cb_prefix_output => 'prefix_vm_output', message_multiple => 'All VM snapshots are ok', skipped_code => { -10 => 1 } },
{ name => 'vm', type => 1, cb_prefix_output => 'prefix_vm_output', message_multiple => 'All VM snapshots are ok', skipped_code => { -10 => 1 } }
];
$self->{maps_counters}->{vm} = [
{ label => 'snapshot', set => {
key_values => [ { name => 'snapshot' }, { name => 'status' }, { name => 'display' }],
key_values => [ { name => 'snapshot' }, { name => 'status' }, { name => 'display' } ],
closure_custom_output => $self->can('custom_snapshot_output'),
closure_custom_perfdata => sub { return 0; },
closure_custom_perfdata => sub { return 0; }
}
},
{ label => 'backing', set => {
key_values => [ { name => 'backing' }, { name => 'status' }, { name => 'display' }],
key_values => [ { name => 'backing' }, { name => 'status' }, { name => 'display' } ],
closure_custom_output => $self->can('custom_backing_output'),
closure_custom_perfdata => sub { return 0; },
closure_custom_perfdata => sub { return 0; }
}
},
}
];
}
@ -82,7 +83,7 @@ sub new {
'ps-display' => { name => 'ps_display' },
'filter-vm:s' => { name => 'filter_vm' },
'filter-note:s' => { name => 'filter_note' },
'filter-status:s' => { name => 'filter_status', default => 'running' },
'filter-status:s' => { name => 'filter_status', default => 'running' }
});
return $self;
@ -161,6 +162,13 @@ sub manage_selection {
};
$id++;
}
if (scalar(keys %{$self->{vm}}) <= 0) {
$self->{output}->output_add(
severity => 'OK',
short_msg => 'no snapshot found'
);
}
}
1;

View File

@ -92,7 +92,7 @@ sub run {
short_msg => sprintf("Connections: %d%s", $result->{$oid_fwNumCom}, $extra)
);
$self->{output}->perfdata_add(
label => "connections", unit => 'con',
label => 'connections', unit => 'con',
value => $result->{$oid_fwNumCom},
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning', %total_options),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical', %total_options),