enhance indent

This commit is contained in:
garnier-quentin 2020-01-22 10:25:52 +01:00
parent 4047afbc70
commit 1af9434338
12 changed files with 209 additions and 143 deletions

View File

@ -49,13 +49,13 @@ sub new {
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
$options{options}->add_options(arguments =>
{
"filter-severity:s@" => { name => 'filter_severity', },
"filter-message:s" => { name => 'filter_message' },
"retention:s" => { name => 'retention' },
"memory" => { name => 'memory' },
$options{options}->add_options(arguments => {
'filter-severity:s@' => { name => 'filter_severity', },
'filter-message:s' => { name => 'filter_message' },
'retention:s' => { name => 'retention' },
'memory' => { name => 'memory' },
});
$self->{statefile_cache} = centreon::plugins::statefile->new(%options);
$self->{severities} = {};
return $self;

View File

@ -57,16 +57,22 @@ sub check {
next if ($self->absent_problem(section => 'blade', instance => $blade_dn));
next if ($self->check_filter(section => 'blade', instance => $blade_dn));
$self->{output}->output_add(long_msg => sprintf("blade '%s' state is '%s' [presence: %s].",
$self->{output}->output_add(
long_msg => sprintf(
"blade '%s' state is '%s' [presence: %s].",
$blade_dn, $result2->{cucsComputeBladeOperState},
$result->{cucsComputeBladePresence})
$result->{cucsComputeBladePresence}
)
);
my $exit = $self->get_severity(section => 'blade.presence', label => 'default.presence', value => $result->{cucsComputeBladePresence});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("blade '%s' presence is: '%s'",
$blade_dn, $result->{cucsComputeBladePresence})
$self->{output}->output_add(
severity => $exit,
short_msg => sprintf(
"blade '%s' presence is: '%s'",
$blade_dn, $result->{cucsComputeBladePresence}
)
);
next;
}
@ -75,8 +81,10 @@ sub check {
$exit = $self->get_severity(section => 'blade.overall_status', label => 'default.overall_status', value => $result2->{cucsComputeBladeOperState});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("blade '%s' state is '%s'",
$self->{output}->output_add(
severity => $exit,
short_msg => sprintf(
"blade '%s' state is '%s'",
$blade_dn, $result2->{cucsComputeBladeOperState}
)
);

View File

@ -56,13 +56,18 @@ sub check {
$self->{components}->{chassis}->{total}++;
$self->{output}->output_add(long_msg => sprintf("chassis '%s' state is '%s'.",
$chassis_dn, $result->{cucsEquipmentChassisOperState})
$self->{output}->output_add(
long_msg => sprintf(
"chassis '%s' state is '%s'.",
$chassis_dn, $result->{cucsEquipmentChassisOperState}
)
);
my $exit = $self->get_severity(section => 'chassis.operability', label => 'default.operability', value => $result->{cucsEquipmentChassisOperState});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("chassis '%s' state is '%s'",
$self->{output}->output_add(
severity => $exit,
short_msg => sprintf(
"chassis '%s' state is '%s'",
$chassis_dn, $result->{cucsEquipmentChassisOperState}
)
);

View File

@ -57,16 +57,22 @@ sub check {
next if ($self->absent_problem(section => 'cpu', instance => $cpu_dn));
next if ($self->check_filter(section => 'cpu', instance => $cpu_dn));
$self->{output}->output_add(long_msg => sprintf("cpu '%s' state is '%s' [presence: %s].",
$self->{output}->output_add(
long_msg => sprintf(
"cpu '%s' state is '%s' [presence: %s].",
$cpu_dn, $result2->{cucsProcessorUnitOperState},
$result->{cucsProcessorUnitPresence})
$result->{cucsProcessorUnitPresence}
)
);
my $exit = $self->get_severity(section => 'cpu.presence', label => 'default.presence', value => $result->{cucsProcessorUnitPresence});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("cpu '%s' presence is: '%s'",
$cpu_dn, $result->{cucsProcessorUnitPresence})
$self->{output}->output_add(
severity => $exit,
short_msg => sprintf(
"cpu '%s' presence is: '%s'",
$cpu_dn, $result->{cucsProcessorUnitPresence}
)
);
next;
}
@ -75,8 +81,10 @@ sub check {
$exit = $self->get_severity(section => 'cpu.operability', label => 'default.operability', value => $result2->{cucsProcessorUnitOperState});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("cpu '%s' state is '%s'",
$self->{output}->output_add(
severity => $exit,
short_msg => sprintf(
"cpu '%s' state is '%s'",
$cpu_dn, $result2->{cucsProcessorUnitOperState}
)
);

View File

@ -57,16 +57,22 @@ sub check {
next if ($self->absent_problem(section => 'fan', instance => $fan_dn));
next if ($self->check_filter(section => 'fan', instance => $fan_dn));
$self->{output}->output_add(long_msg => sprintf("fan '%s' state is '%s' [presence: %s].",
$self->{output}->output_add(
long_msg => sprintf(
"fan '%s' state is '%s' [presence: %s].",
$fan_dn, $result2->{cucsEquipmentFanOperState},
$result->{cucsEquipmentFanPresence})
$result->{cucsEquipmentFanPresence}
)
);
my $exit = $self->get_severity(section => 'fan.presence', label => 'default.presence', value => $result->{cucsEquipmentFanPresence});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("fan '%s' presence is: '%s'",
$fan_dn, $result->{cucsEquipmentFanPresence})
$self->{output}->output_add(
severity => $exit,
short_msg => sprintf(
"fan '%s' presence is: '%s'",
$fan_dn, $result->{cucsEquipmentFanPresence}
)
);
next;
}
@ -75,8 +81,10 @@ sub check {
$exit = $self->get_severity(section => 'fan.operability', label => 'default.operability', value => $result2->{cucsEquipmentFanOperState});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("fan '%s' state is '%s'",
$self->{output}->output_add(
severity => $exit,
short_msg => sprintf(
"fan '%s' state is '%s'",
$fan_dn, $result2->{cucsEquipmentFanOperState}
)
);

View File

@ -57,16 +57,22 @@ sub check {
next if ($self->absent_problem(section => 'fex', instance => $fex_dn));
next if ($self->check_filter(section => 'fex', instance => $fex_dn));
$self->{output}->output_add(long_msg => sprintf("Fabric extender '%s' state is '%s' [presence: %s].",
$self->{output}->output_add(
long_msg => sprintf(
"Fabric extender '%s' state is '%s' [presence: %s].",
$fex_dn, $result2->{cucsEquipmentFexOperState},
$result->{cucsEquipmentFexPresence})
$result->{cucsEquipmentFexPresence}
)
);
my $exit = $self->get_severity(section => 'fex.presence', label => 'default.presence', value => $result->{cucsEquipmentFexPresence});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("Fabric extender '%s' presence is: '%s'",
$fex_dn, $result->{cucsEquipmentFexPresence})
$self->{output}->output_add(
severity => $exit,
short_msg => sprintf(
"Fabric extender '%s' presence is: '%s'",
$fex_dn, $result->{cucsEquipmentFexPresence}
)
);
next;
}
@ -75,8 +81,10 @@ sub check {
$exit = $self->get_severity(section => 'fex.presence', label => 'default.operability', value => $result2->{cucsEquipmentFexOperState});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("Fabric extender '%s' state is '%s'.",
$self->{output}->output_add(
severity => $exit,
short_msg => sprintf(
"Fabric extender '%s' state is '%s'.",
$fex_dn, $result2->{cucsEquipmentFexOperState}
)
);

View File

@ -58,16 +58,22 @@ sub check {
next if ($self->absent_problem(section => 'iocard', instance => $iocard_dn));
next if ($self->check_filter(section => 'iocard', instance => $iocard_dn));
$self->{output}->output_add(long_msg => sprintf("IO cards '%s' state is '%s' [presence: %s].",
$self->{output}->output_add(
long_msg => sprintf(
"IO cards '%s' state is '%s' [presence: %s].",
$iocard_dn, $result2->{cucsEquipmentIOCardOperState},
$result->{cucsEquipmentIOCardPresence})
$result->{cucsEquipmentIOCardPresence}
)
);
my $exit = $self->get_severity(section => 'iocard.presence', label => 'default.presence', value => $result->{cucsEquipmentIOCardPresence});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("IO cards '%s' presence is: '%s'",
$iocard_dn, $result->{cucsEquipmentIOCardPresence})
$self->{output}->output_add(
severity => $exit,
short_msg => sprintf(
"IO cards '%s' presence is: '%s'",
$iocard_dn, $result->{cucsEquipmentIOCardPresence}
)
);
next;
}
@ -76,8 +82,10 @@ sub check {
$exit = $self->get_severity(section => 'iocard.operability', label => 'default.operability', value => $result2->{cucsEquipmentIOCardOperState});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("IO cards '%s' state is '%s'.",
$self->{output}->output_add(
severity => $exit,
short_msg => sprintf(
"IO cards '%s' state is '%s'.",
$iocard_dn, $result2->{cucsEquipmentIOCardOperState}
)
);

View File

@ -57,15 +57,20 @@ sub check {
next if ($self->absent_problem(section => 'localdisk', instance => $localdisk_dn));
next if ($self->check_filter(section => 'localdisk', instance => $localdisk_dn));
$self->{output}->output_add(long_msg => sprintf("local disk '%s' state is '%s' [presence: %s].",
$self->{output}->output_add(
long_msg => sprintf(
"local disk '%s' state is '%s' [presence: %s].",
$localdisk_dn, $result2->{cucsStorageLocalDiskOperability},
$result->{cucsStorageLocalDiskPresence})
$result->{cucsStorageLocalDiskPresence}
)
);
my $exit = $self->get_severity(section => 'localdisk.presence', label => 'default.presence', value => $result->{cucsStorageLocalDiskPresence});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("local disk '%s' presence is: '%s'",
$self->{output}->output_add(
severity => $exit,
short_msg => sprintf(
"local disk '%s' presence is: '%s'",
$localdisk_dn, $result->{cucsStorageLocalDiskPresence})
);
next;
@ -75,8 +80,10 @@ sub check {
$exit = $self->get_severity(section => 'localdisk.operability', label => 'default.operability', value => $result2->{cucsStorageLocalDiskOperability});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("local disk '%s' state is '%s'",
$self->{output}->output_add(
severity => $exit,
short_msg => sprintf(
"local disk '%s' state is '%s'",
$localdisk_dn, $result2->{cucsStorageLocalDiskOperability}
)
);

View File

@ -58,16 +58,22 @@ sub check {
next if ($self->absent_problem(section => 'memory', instance => $memory_dn));
next if ($self->check_filter(section => 'memory', instance => $memory_dn));
$self->{output}->output_add(long_msg => sprintf("memory '%s' state is '%s' [presence: %s].",
$self->{output}->output_add(
long_msg => sprintf(
"memory '%s' state is '%s' [presence: %s].",
$memory_dn, $result2->{cucsMemoryUnitOperState},
$result->{cucsMemoryUnitPresence})
$result->{cucsMemoryUnitPresence}
)
);
my $exit = $self->get_severity(section => 'memory.presence', label => 'default.presence', value => $result->{cucsMemoryUnitPresence});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("memory '%s' presence is: '%s'",
$memory_dn, $result->{cucsMemoryUnitPresence})
$self->{output}->output_add(
severity => $exit,
short_msg => sprintf(
"memory '%s' presence is: '%s'",
$memory_dn, $result->{cucsMemoryUnitPresence}
)
);
next;
}
@ -76,8 +82,10 @@ sub check {
$exit = $self->get_severity(section => 'memory.operability', label => 'default.operability', value => $result2->{cucsMemoryUnitOperState});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("memory '%s' state is '%s'",
$self->{output}->output_add(
severity => $exit,
short_msg => sprintf(
"memory '%s' state is '%s'",
$memory_dn, $result2->{cucsMemoryUnitOperState}
)
);

View File

@ -58,16 +58,22 @@ sub check {
next if ($self->absent_problem(section => 'psu', instance => $psu_dn));
next if ($self->check_filter(section => 'psu', instance => $psu_dn));
$self->{output}->output_add(long_msg => sprintf("power supply '%s' state is '%s' [presence: %s].",
$self->{output}->output_add(
long_msg => sprintf(
"power supply '%s' state is '%s' [presence: %s].",
$psu_dn, $result2->{cucsEquipmentPsuOperState},
$result->{cucsEquipmentPsuPresence})
$result->{cucsEquipmentPsuPresence}
)
);
my $exit = $self->get_severity(section => 'psu.presence', label => 'default.presence', value => $result->{cucsEquipmentPsuPresence});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("power supply '%s' presence is: '%s'",
$psu_dn, $result->{cucsEquipmentPsuPresence})
$self->{output}->output_add(
severity => $exit,
short_msg => sprintf(
"power supply '%s' presence is: '%s'",
$psu_dn, $result->{cucsEquipmentPsuPresence}
)
);
next;
}
@ -76,8 +82,10 @@ sub check {
$exit = $self->get_severity(section => 'psu.operability', label => 'default.operability', value => $result2->{cucsEquipmentPsuOperState});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("power supply '%s' state is '%s'.",
$self->{output}->output_add(
severity => $exit,
short_msg => sprintf(
"power supply '%s' state is '%s'.",
$psu_dn, $result2->{cucsEquipmentPsuOperState}
)
);

View File

@ -51,8 +51,7 @@ sub new {
my $self = $class->SUPER::new(package => __PACKAGE__, %options, no_performance => 1);
bless $self, $class;
$options{options}->add_options(arguments =>
{
$options{options}->add_options(arguments => {
});
return $self;
@ -97,4 +96,3 @@ Example: --threshold-overload='fan.operability,OK,poweredOff|removed'
=back
=cut