Closed renepaul77 closed 2 months ago
The plan to solve the bug involves modifying the alert checking logic in the PrinterSubsystem.pm
file to ensure that "energy saving mode" and "warm-up" states are treated as informational messages rather than warnings. This change will prevent these states from being incorrectly flagged as warnings, which is the root cause of the issue reported by the user.
The bug is caused by the overly broad condition in the alert checking logic within the PrinterSubsystem.pm
file. The current logic adds a warning for any alert description that does not contain the word "Sleep". This condition does not account for "energy saving mode" or "warm-up" states, leading to these states being incorrectly flagged as warnings.
The necessary changes involve modifying the check
method in the PrinterSubsystem.pm
file to refine the condition that determines whether an alert should be treated as a warning.
package CheckPrinterHealth::PRINTERMIB::Component::PrinterSubsystem::Alert;
our @ISA = qw(Monitoring::GLPlugin::SNMP::TableItem);
use strict;
sub finish {
my ($self) = @_;
$self->{prtAlertDescription} =
$self->accentfree($self->{prtAlertDescription});
# empty prtAlertDescription seems to be traps
$self->{prtAlertAge} = $self->ago_sysuptime($self->{prtAlertTime});
$self->{prtAlertTimeHuman} = scalar localtime(time - $self->{prtAlertAge});
}
sub check {
my ($self) = @_;
$self->add_info(sprintf 'Alert: %s', $self->{prtAlertDescription});
if ($self->{prtAlertDescription} !~ /Sleep|Energiesparmodus|Warm-up/i) {
$self->add_warning();
}
}
if
condition is updated to include "Energiesparmodus" (German for "energy saving mode") and "Warm-up".i
modifier is added to make the match case-insensitive.To replicate the bug, follow these steps:
check_printer_health
plugin version 1.2.0.1 to monitor the printer.Ticket title: Ricoh Printer alerts "energy saving mode" and "warm up" with warning
Ticket Description: Hello Gerhard,
We have noticed that the “warm-up” and “energy saving mode” jams are displayed as warnings on Ricoh printers.
Plugin Version: check_printer_health $Revision: 1.2.0.1
check output:
I am a RICOH MP C307 1.23 / RICOH Network Printer C model / RICOH Network Scanner C model / RICOH Network Facsimile C model
WARNING - Alert: Energiesparmodus {10033}
checking displays
checking channels
checking covers
Vordere Abdeckung is coverClosed
Rechte Abdeckung is coverClosed
ADF-Abdeckung is coverClosed
checking alerts
Alert: Energiesparmodus {10033}
An email with the same subject and the snmpwalk is already on its way
The ChangeLog
file provides a historical record of changes made to the plugin. It includes version numbers, dates, and brief descriptions of the changes. The file does not contain any code but is crucial for documenting modifications and ensuring traceability.
* 2024-08-15 1.2.0.2
handle 'energy saving mode' and 'warm-up' states for Ricoh printers as informational messages instead of warnings
The file PrinterSubsystem.pm
is part of the CheckPrinterHealth
plugin, specifically dealing with SNMP monitoring of printer components. The primary function of this file is to gather and process SNMP data related to various printer subsystems such as displays, covers, channels, alerts, inputs, outputs, supplies, markers, and media paths.
The identified issue is due to the overly broad condition in the alert checking logic. By refining the condition to exclude "energy saving mode" and "warm-up" states, we can ensure these states are treated as informational messages rather than warnings. This change should resolve the user's reported issue with Ricoh printers.
ChangeLog
file to document the changes made.Click here to create a Pull Request with the proposed solution
Files used for this task:
This has fixed the problem
Hello Gerhard,
We have noticed that the “warm-up” and “energy saving mode” jams are displayed as warnings on Ricoh printers.
Plugin Version: check_printer_health $Revision: 1.2.0.1
check output:
I am a RICOH MP C307 1.23 / RICOH Network Printer C model / RICOH Network Scanner C model / RICOH Network Facsimile C model WARNING - Alert: Energiesparmodus {10033} checking displays checking channels checking covers Vordere Abdeckung is coverClosed Rechte Abdeckung is coverClosed ADF-Abdeckung is coverClosed checking alerts Alert: Energiesparmodus {10033}
An email with the same subject and the snmpwalk is already on its way