enhance indent

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

View File

@ -35,7 +35,7 @@ sub new {
'discovery' => 'apps::automation::ansible::tower::mode::discovery', 'discovery' => 'apps::automation::ansible::tower::mode::discovery',
'inventory-statistics' => 'apps::automation::ansible::tower::mode::inventorystatistics', 'inventory-statistics' => 'apps::automation::ansible::tower::mode::inventorystatistics',
); );
$self->{custom_modes}{towercli} = 'apps::automation::ansible::tower::custom::towercli'; $self->{custom_modes}{towercli} = 'apps::automation::ansible::tower::custom::towercli';
return $self; return $self;
} }

View File

@ -49,13 +49,13 @@ sub new {
my $self = $class->SUPER::new(package => __PACKAGE__, %options); my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class; bless $self, $class;
$options{options}->add_options(arguments => $options{options}->add_options(arguments => {
{ 'filter-severity:s@' => { name => 'filter_severity', },
"filter-severity:s@" => { name => 'filter_severity', }, 'filter-message:s' => { name => 'filter_message' },
"filter-message:s" => { name => 'filter_message' }, 'retention:s' => { name => 'retention' },
"retention:s" => { name => 'retention' }, 'memory' => { name => 'memory' },
"memory" => { name => 'memory' }, });
});
$self->{statefile_cache} = centreon::plugins::statefile->new(%options); $self->{statefile_cache} = centreon::plugins::statefile->new(%options);
$self->{severities} = {}; $self->{severities} = {};
return $self; return $self;
@ -214,4 +214,4 @@ Event older (current time - retention time) is not checked (in seconds).
=back =back
=cut =cut

View File

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

View File

@ -56,16 +56,21 @@ sub check {
$self->{components}->{chassis}->{total}++; $self->{components}->{chassis}->{total}++;
$self->{output}->output_add(long_msg => sprintf("chassis '%s' state is '%s'.", $self->{output}->output_add(
$chassis_dn, $result->{cucsEquipmentChassisOperState}) 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}); 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)) { if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit, $self->{output}->output_add(
short_msg => sprintf("chassis '%s' state is '%s'", severity => $exit,
$chassis_dn, $result->{cucsEquipmentChassisOperState} short_msg => sprintf(
) "chassis '%s' state is '%s'",
); $chassis_dn, $result->{cucsEquipmentChassisOperState}
)
);
} }
} }
} }

View File

@ -57,31 +57,39 @@ sub check {
next if ($self->absent_problem(section => 'cpu', instance => $cpu_dn)); next if ($self->absent_problem(section => 'cpu', instance => $cpu_dn));
next if ($self->check_filter(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(
$cpu_dn, $result2->{cucsProcessorUnitOperState}, long_msg => sprintf(
$result->{cucsProcessorUnitPresence}) "cpu '%s' state is '%s' [presence: %s].",
); $cpu_dn, $result2->{cucsProcessorUnitOperState},
$result->{cucsProcessorUnitPresence}
)
);
my $exit = $self->get_severity(section => 'cpu.presence', label => 'default.presence', value => $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)) { if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit, $self->{output}->output_add(
short_msg => sprintf("cpu '%s' presence is: '%s'", severity => $exit,
$cpu_dn, $result->{cucsProcessorUnitPresence}) short_msg => sprintf(
); "cpu '%s' presence is: '%s'",
$cpu_dn, $result->{cucsProcessorUnitPresence}
)
);
next; next;
} }
$self->{components}->{cpu}->{total}++; $self->{components}->{cpu}->{total}++;
$exit = $self->get_severity(section => 'cpu.operability', label => 'default.operability', value => $result2->{cucsProcessorUnitOperState}); $exit = $self->get_severity(section => 'cpu.operability', label => 'default.operability', value => $result2->{cucsProcessorUnitOperState});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit, $self->{output}->output_add(
short_msg => sprintf("cpu '%s' state is '%s'", severity => $exit,
$cpu_dn, $result2->{cucsProcessorUnitOperState} short_msg => sprintf(
) "cpu '%s' state is '%s'",
); $cpu_dn, $result2->{cucsProcessorUnitOperState}
)
);
} }
} }
} }
1; 1;

View File

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

View File

@ -57,29 +57,37 @@ sub check {
next if ($self->absent_problem(section => 'fex', instance => $fex_dn)); next if ($self->absent_problem(section => 'fex', instance => $fex_dn));
next if ($self->check_filter(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(
$fex_dn, $result2->{cucsEquipmentFexOperState}, long_msg => sprintf(
$result->{cucsEquipmentFexPresence}) "Fabric extender '%s' state is '%s' [presence: %s].",
); $fex_dn, $result2->{cucsEquipmentFexOperState},
$result->{cucsEquipmentFexPresence}
)
);
my $exit = $self->get_severity(section => 'fex.presence', label => 'default.presence', value => $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)) { if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit, $self->{output}->output_add(
short_msg => sprintf("Fabric extender '%s' presence is: '%s'", severity => $exit,
$fex_dn, $result->{cucsEquipmentFexPresence}) short_msg => sprintf(
); "Fabric extender '%s' presence is: '%s'",
$fex_dn, $result->{cucsEquipmentFexPresence}
)
);
next; next;
} }
$self->{components}->{fex}->{total}++; $self->{components}->{fex}->{total}++;
$exit = $self->get_severity(section => 'fex.presence', label => 'default.operability', value => $result2->{cucsEquipmentFexOperState}); $exit = $self->get_severity(section => 'fex.presence', label => 'default.operability', value => $result2->{cucsEquipmentFexOperState});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit, $self->{output}->output_add(
short_msg => sprintf("Fabric extender '%s' state is '%s'.", severity => $exit,
$fex_dn, $result2->{cucsEquipmentFexOperState} short_msg => sprintf(
) "Fabric extender '%s' state is '%s'.",
); $fex_dn, $result2->{cucsEquipmentFexOperState}
)
);
} }
} }
} }

View File

@ -58,29 +58,37 @@ sub check {
next if ($self->absent_problem(section => 'iocard', instance => $iocard_dn)); next if ($self->absent_problem(section => 'iocard', instance => $iocard_dn));
next if ($self->check_filter(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(
$iocard_dn, $result2->{cucsEquipmentIOCardOperState}, long_msg => sprintf(
$result->{cucsEquipmentIOCardPresence}) "IO cards '%s' state is '%s' [presence: %s].",
); $iocard_dn, $result2->{cucsEquipmentIOCardOperState},
$result->{cucsEquipmentIOCardPresence}
)
);
my $exit = $self->get_severity(section => 'iocard.presence', label => 'default.presence', value => $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)) { if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit, $self->{output}->output_add(
short_msg => sprintf("IO cards '%s' presence is: '%s'", severity => $exit,
$iocard_dn, $result->{cucsEquipmentIOCardPresence}) short_msg => sprintf(
); "IO cards '%s' presence is: '%s'",
$iocard_dn, $result->{cucsEquipmentIOCardPresence}
)
);
next; next;
} }
$self->{components}->{iocard}->{total}++; $self->{components}->{iocard}->{total}++;
$exit = $self->get_severity(section => 'iocard.operability', label => 'default.operability', value => $result2->{cucsEquipmentIOCardOperState}); $exit = $self->get_severity(section => 'iocard.operability', label => 'default.operability', value => $result2->{cucsEquipmentIOCardOperState});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit, $self->{output}->output_add(
short_msg => sprintf("IO cards '%s' state is '%s'.", severity => $exit,
$iocard_dn, $result2->{cucsEquipmentIOCardOperState} short_msg => sprintf(
) "IO cards '%s' state is '%s'.",
); $iocard_dn, $result2->{cucsEquipmentIOCardOperState}
)
);
} }
} }
} }

View File

@ -35,7 +35,7 @@ my $oid_cucsStorageLocalDiskDn = '.1.3.6.1.4.1.9.9.719.1.45.4.1.2';
sub load { sub load {
my ($self) = @_; my ($self) = @_;
push @{$self->{request}}, { oid => $mapping1->{cucsStorageLocalDiskPresence}->{oid} }, push @{$self->{request}}, { oid => $mapping1->{cucsStorageLocalDiskPresence}->{oid} },
{ oid => $mapping2->{cucsStorageLocalDiskOperability}->{oid} }, { oid => $oid_cucsStorageLocalDiskDn }; { oid => $mapping2->{cucsStorageLocalDiskOperability}->{oid} }, { oid => $oid_cucsStorageLocalDiskDn };
} }
@ -53,35 +53,42 @@ sub check {
my $localdisk_dn = $self->{results}->{$oid_cucsStorageLocalDiskDn}->{$oid}; my $localdisk_dn = $self->{results}->{$oid_cucsStorageLocalDiskDn}->{$oid};
my $result = $self->{snmp}->map_instance(mapping => $mapping1, results => $self->{results}->{$mapping1->{cucsStorageLocalDiskPresence}->{oid}}, instance => $instance); my $result = $self->{snmp}->map_instance(mapping => $mapping1, results => $self->{results}->{$mapping1->{cucsStorageLocalDiskPresence}->{oid}}, instance => $instance);
my $result2 = $self->{snmp}->map_instance(mapping => $mapping2, results => $self->{results}->{$mapping2->{cucsStorageLocalDiskOperability}->{oid}}, instance => $instance); my $result2 = $self->{snmp}->map_instance(mapping => $mapping2, results => $self->{results}->{$mapping2->{cucsStorageLocalDiskOperability}->{oid}}, instance => $instance);
next if ($self->absent_problem(section => 'localdisk', instance => $localdisk_dn)); next if ($self->absent_problem(section => 'localdisk', instance => $localdisk_dn));
next if ($self->check_filter(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(
$localdisk_dn, $result2->{cucsStorageLocalDiskOperability}, long_msg => sprintf(
$result->{cucsStorageLocalDiskPresence}) "local disk '%s' state is '%s' [presence: %s].",
); $localdisk_dn, $result2->{cucsStorageLocalDiskOperability},
$result->{cucsStorageLocalDiskPresence}
)
);
my $exit = $self->get_severity(section => 'localdisk.presence', label => 'default.presence', value => $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)) { if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit, $self->{output}->output_add(
short_msg => sprintf("local disk '%s' presence is: '%s'", severity => $exit,
$localdisk_dn, $result->{cucsStorageLocalDiskPresence}) short_msg => sprintf(
); "local disk '%s' presence is: '%s'",
$localdisk_dn, $result->{cucsStorageLocalDiskPresence})
);
next; next;
} }
$self->{components}->{localdisk}->{total}++; $self->{components}->{localdisk}->{total}++;
$exit = $self->get_severity(section => 'localdisk.operability', label => 'default.operability', value => $result2->{cucsStorageLocalDiskOperability}); $exit = $self->get_severity(section => 'localdisk.operability', label => 'default.operability', value => $result2->{cucsStorageLocalDiskOperability});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit, $self->{output}->output_add(
short_msg => sprintf("local disk '%s' state is '%s'", severity => $exit,
$localdisk_dn, $result2->{cucsStorageLocalDiskOperability} short_msg => sprintf(
) "local disk '%s' state is '%s'",
); $localdisk_dn, $result2->{cucsStorageLocalDiskOperability}
)
);
} }
} }
} }
1; 1;

View File

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

View File

@ -58,29 +58,37 @@ sub check {
next if ($self->absent_problem(section => 'psu', instance => $psu_dn)); next if ($self->absent_problem(section => 'psu', instance => $psu_dn));
next if ($self->check_filter(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(
$psu_dn, $result2->{cucsEquipmentPsuOperState}, long_msg => sprintf(
$result->{cucsEquipmentPsuPresence}) "power supply '%s' state is '%s' [presence: %s].",
); $psu_dn, $result2->{cucsEquipmentPsuOperState},
$result->{cucsEquipmentPsuPresence}
)
);
my $exit = $self->get_severity(section => 'psu.presence', label => 'default.presence', value => $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)) { if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit, $self->{output}->output_add(
short_msg => sprintf("power supply '%s' presence is: '%s'", severity => $exit,
$psu_dn, $result->{cucsEquipmentPsuPresence}) short_msg => sprintf(
); "power supply '%s' presence is: '%s'",
$psu_dn, $result->{cucsEquipmentPsuPresence}
)
);
next; next;
} }
$self->{components}->{psu}->{total}++; $self->{components}->{psu}->{total}++;
$exit = $self->get_severity(section => 'psu.operability', label => 'default.operability', value => $result2->{cucsEquipmentPsuOperState}); $exit = $self->get_severity(section => 'psu.operability', label => 'default.operability', value => $result2->{cucsEquipmentPsuOperState});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit, $self->{output}->output_add(
short_msg => sprintf("power supply '%s' state is '%s'.", severity => $exit,
$psu_dn, $result2->{cucsEquipmentPsuOperState} short_msg => sprintf(
) "power supply '%s' state is '%s'.",
); $psu_dn, $result2->{cucsEquipmentPsuOperState}
)
);
} }
} }
} }

View File

@ -28,20 +28,20 @@ use hardware::server::cisco::ucs::mode::components::resources qw($thresholds);
sub set_system { sub set_system {
my ($self, %options) = @_; my ($self, %options) = @_;
$self->{regexp_threshold_overload_check_section_option} = '^(fan|psu|chassis|iocard|blade|fex|cpu|memory|localdisk)\.(presence|operability|overall_status)$'; $self->{regexp_threshold_overload_check_section_option} = '^(fan|psu|chassis|iocard|blade|fex|cpu|memory|localdisk)\.(presence|operability|overall_status)$';
$self->{cb_hook2} = 'snmp_execute'; $self->{cb_hook2} = 'snmp_execute';
$self->{thresholds} = $thresholds; $self->{thresholds} = $thresholds;
$self->{components_path} = 'hardware::server::cisco::ucs::mode::components'; $self->{components_path} = 'hardware::server::cisco::ucs::mode::components';
$self->{components_module} = ['fan', 'psu', 'chassis', 'iocard', 'blade', 'fex', 'cpu', 'memory', 'localdisk']; $self->{components_module} = ['fan', 'psu', 'chassis', 'iocard', 'blade', 'fex', 'cpu', 'memory', 'localdisk'];
} }
sub snmp_execute { sub snmp_execute {
my ($self, %options) = @_; my ($self, %options) = @_;
$self->{snmp} = $options{snmp}; $self->{snmp} = $options{snmp};
$self->{results} = $self->{snmp}->get_multiple_table(oids => $self->{request}); $self->{results} = $self->{snmp}->get_multiple_table(oids => $self->{request});
} }
@ -50,10 +50,9 @@ sub new {
my ($class, %options) = @_; my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options, no_performance => 1); my $self = $class->SUPER::new(package => __PACKAGE__, %options, no_performance => 1);
bless $self, $class; bless $self, $class;
$options{options}->add_options(arguments => $options{options}->add_options(arguments => {
{ });
});
return $self; return $self;
} }
@ -97,4 +96,3 @@ Example: --threshold-overload='fan.operability,OK,poweredOff|removed'
=back =back
=cut =cut