This commit is contained in:
garnier-quentin 2019-03-28 11:14:12 +01:00
parent 222e784221
commit f78273797c
1 changed files with 11 additions and 9 deletions

View File

@ -91,6 +91,7 @@ sub custom_dcmetrics_perfdata {
if (scalar(keys %{$self->{instance_mode}->{datacenter}}) > 1) {
$extra_label .= '_' . $self->{result_values}->{name};
}
$self->{output}->perfdata_add(label => 'alarm_' . $self->{result_values}->{label_ref} . $extra_label,
value => $self->{result_values}->{alarm_value},
min => 0);
@ -153,6 +154,7 @@ sub set_counters {
{ label => 'alarm-warning', threshold => 0, set => {
key_values => [ { name => 'name' } ],
output_template => '',
closure_custom_threshold_check => sub { return 'ok' },
closure_custom_calc => $self->can('custom_dcmetrics_calc'), closure_custom_calc_extra_options => { label_ref => 'warning' },
closure_custom_perfdata => $self->can('custom_dcmetrics_perfdata'),
}
@ -160,6 +162,7 @@ sub set_counters {
{ label => 'alarm-critical', threshold => 0, set => {
key_values => [ { name => 'name' } ],
output_template => '',
closure_custom_threshold_check => sub { return 'ok' },
closure_custom_calc => $self->can('custom_dcmetrics_calc'), closure_custom_calc_extra_options => { label_ref => 'critical' },
closure_custom_perfdata => $self->can('custom_dcmetrics_perfdata'),
}
@ -192,15 +195,14 @@ sub new {
bless $self, $class;
$self->{version} = '1.0';
$options{options}->add_options(arguments =>
{
"datacenter:s" => { name => 'datacenter' },
"filter" => { name => 'filter' },
"filter-time:s" => { name => 'filter_time', },
"memory" => { name => 'memory', },
"warning-status:s" => { name => 'warning_status', default => '%{status} =~ /yellow/i' },
"critical-status:s" => { name => 'critical_status', default => '%{status} =~ /red/i' },
});
$options{options}->add_options(arguments => {
"datacenter:s" => { name => 'datacenter' },
"filter" => { name => 'filter' },
"filter-time:s" => { name => 'filter_time', },
"memory" => { name => 'memory', },
"warning-status:s" => { name => 'warning_status', default => '%{status} =~ /yellow/i' },
"critical-status:s" => { name => 'critical_status', default => '%{status} =~ /red/i' },
});
centreon::plugins::misc::mymodule_load(output => $self->{output}, module => 'Date::Parse',
error_msg => "Cannot load module 'Date::Parse'.");