enhance indent
This commit is contained in:
parent
e6453003ab
commit
268d52bda1
|
@ -186,8 +186,11 @@ sub check_options {
|
|||
$self->{output}->add_option_msg(short_msg => "Wrong threshold-overload section '" . $val . "'.");
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
$self->call_object_callback(method_name => $self->{cb_threshold_overload_check_section_option},
|
||||
section => $section, option_value => $val);
|
||||
$self->call_object_callback(
|
||||
method_name => $self->{cb_threshold_overload_check_section_option},
|
||||
section => $section,
|
||||
option_value => $val
|
||||
);
|
||||
|
||||
if ($self->{output}->is_litteral_status(status => $status) == 0) {
|
||||
$self->{output}->add_option_msg(short_msg => "Wrong threshold-overload status '" . $val . "'.");
|
||||
|
@ -212,8 +215,12 @@ sub check_options {
|
|||
$self->{output}->add_option_msg(short_msg => "Wrong $option option '" . $val . "'.");
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
$self->call_object_callback(method_name => $self->{cb_threshold_numeric_check_section_option},
|
||||
section => $section, option_name => $option, option_value => $val);
|
||||
$self->call_object_callback(
|
||||
method_name => $self->{cb_threshold_numeric_check_section_option},
|
||||
section => $section,
|
||||
option_name => $option,
|
||||
option_value => $val
|
||||
);
|
||||
|
||||
my $position = 0;
|
||||
if (defined($self->{numeric_threshold}->{$section})) {
|
||||
|
@ -247,7 +254,8 @@ sub load_components {
|
|||
foreach (@{$self->{components_module}}) {
|
||||
if (/$self->{option_results}->{component}/) {
|
||||
my $mod_name = $self->{components_path} . "::$_";
|
||||
centreon::plugins::misc::mymodule_load(output => $self->{output}, module => $mod_name,
|
||||
centreon::plugins::misc::mymodule_load(
|
||||
output => $self->{output}, module => $mod_name,
|
||||
error_msg => "Cannot load module '$mod_name'.") if ($self->{load_components} == 1);
|
||||
$self->{loaded} = 1;
|
||||
if ($self->{components_exec_load} == 1) {
|
||||
|
@ -287,10 +295,14 @@ sub display {
|
|||
if ($self->{count} == 1) {
|
||||
($exit, $warn, $crit) = $self->get_severity_count(label => $comp, value => $self->{components}->{$comp}->{total});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("'%s' components '%s' checked",
|
||||
$self->{output}->output_add(
|
||||
severity => $exit,
|
||||
short_msg => sprintf(
|
||||
"'%s' components '%s' checked",
|
||||
$self->{components}->{$comp}->{total},
|
||||
$comp));
|
||||
$comp
|
||||
)
|
||||
);
|
||||
}
|
||||
$self->{output}->perfdata_add(
|
||||
label => 'count_' . $comp,
|
||||
|
@ -311,15 +323,20 @@ sub display {
|
|||
$exit = $self->{output}->get_most_critical(status => $exits) if (scalar(@{$exits}) > 0);
|
||||
|
||||
if ($self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(short_msg => sprintf('All %s components are ok [%s].',
|
||||
$self->{output}->output_add(
|
||||
short_msg => sprintf(
|
||||
'All %s components are ok [%s].',
|
||||
$total_components,
|
||||
$display_by_component)
|
||||
$display_by_component
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
if (defined($self->{option_results}->{no_component}) && $total_components == 0) {
|
||||
$self->{output}->output_add(severity => $self->{no_components},
|
||||
short_msg => 'No components are checked.');
|
||||
$self->{output}->output_add(
|
||||
severity => $self->{no_components},
|
||||
short_msg => 'No components are checked.'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -387,9 +404,14 @@ sub absent_problem {
|
|||
foreach (@{$self->{absent_problem}}) {
|
||||
if ($options{section} =~ /$_->{filter}/) {
|
||||
if (!defined($_->{instance}) || $options{instance} =~ /$_->{instance}/) {
|
||||
$self->{output}->output_add(severity => 'CRITICAL',
|
||||
short_msg => sprintf("Component '%s' instance '%s' is not present",
|
||||
$options{section}, $options{instance}));
|
||||
$self->{output}->output_add(
|
||||
severity => 'CRITICAL',
|
||||
short_msg => sprintf(
|
||||
"Component '%s' instance '%s' is not present",
|
||||
$options{section},
|
||||
$options{instance}
|
||||
)
|
||||
);
|
||||
$self->{output}->output_add(long_msg => sprintf("Skipping $options{section} section $options{instance} instance (not present)"));
|
||||
$self->{components}->{$options{section}}->{skip}++;
|
||||
return 1;
|
||||
|
@ -405,9 +427,13 @@ sub get_severity_count {
|
|||
my $status = 'OK'; # default
|
||||
my $thresholds = { warning => undef, critical => undef };
|
||||
|
||||
$status = $self->{perfdata}->threshold_check(value => $options{value},
|
||||
threshold => [ { label => 'critical-count-' . $options{label}, 'exit_litteral' => 'critical' },
|
||||
{ label => 'warning-count-' . $options{label}, 'exit_litteral' => 'warning' } ]);
|
||||
$status = $self->{perfdata}->threshold_check(
|
||||
value => $options{value},
|
||||
threshold => [
|
||||
{ label => 'critical-count-' . $options{label}, 'exit_litteral' => 'critical' },
|
||||
{ label => 'warning-count-' . $options{label}, 'exit_litteral' => 'warning' }
|
||||
]
|
||||
);
|
||||
$thresholds->{critical} = $self->{perfdata}->get_perfdata_for_output(label => 'critical-count-' . $options{label});
|
||||
$thresholds->{warning} = $self->{perfdata}->get_perfdata_for_output(label => 'warning-count-' . $options{label});
|
||||
|
||||
|
@ -449,6 +475,7 @@ sub get_severity {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
my $label = defined($options{label}) ? $options{label} : $options{section};
|
||||
foreach (@{$self->{thresholds}->{$label}}) {
|
||||
if ($options{value} =~ /$$_[0]/i) {
|
||||
|
|
Loading…
Reference in New Issue