This commit is contained in:
qgarnier 2017-11-22 14:14:08 +01:00
parent e9a884c041
commit 277b71c2a0
1 changed files with 6 additions and 13 deletions

View File

@ -72,21 +72,14 @@ sub run {
my $oid_hrPrinterDetectedErrorState = '.1.3.6.1.2.1.25.3.5.1.2';
my $result = $self->{snmp}->get_table(oid => $oid_hrPrinterDetectedErrorState, nothing_quit => 1);
use Data::Dumper;
print Data::Dumper::Dumper($result);
foreach (keys %$result) {
my ($value1, $value2) = unpack('C', $result->{$_});
# 16 bits value
my $value = unpack('S', $result->{$_});
foreach my $key (keys %errors_printer) {
my ($byte_check, $pos);
if ($key >= 8) {
next if (!defined($value2));
$byte_check = $value2;
$pos = $key - 8;
} else {
$byte_check = $value1;
$pos = $key
}
if (($byte_check & (1 << $pos)) &&
foreach my $key (keys %errors_printer) {
if (($value & (1 << $key)) &&
(!$self->{output}->is_status(value => ${$errors_printer{$key}}[1], compare => 'ok', litteral => 1))) {
$self->{output}->output_add(severity => ${$errors_printer{$key}}[1],
short_msg => sprintf(${$errors_printer{$key}}[0]));