Debian Codegraph @

check_printer_health/check_printer_health-1.1.0.2/plugins-scripts/Classes/Lexmark/Component/ConsumablesSubsystem.pm

raw
1 package Classes::Lexmark::Component::ConsumablesSubsystem;
2 our @ISA = qw(Monitoring::GLPlugin::SNMP::Item);
3 use strict;
4
5 sub init {
6 my ($self) = @_;
7 $self->get_snmp_tables('LEXMARK-MPS-MIB', [
8 ['supplies', 'currentSuppliesTable', 'Classes::Lexmark::Component::ConsumablesSubsystem::Supply'],
9 ]);
10 }
11
12 package Classes::Lexmark::Component::ConsumablesSubsystem::Supply;
13 our @ISA = qw(Monitoring::GLPlugin::SNMP::TableItem);
14 use strict;
15
16 sub check {
17 my ($self) = @_;
18 if ($self->{currentSupplyCurrentStatus} eq "low") {
19 $self->add_warning_mitigation(sprintf "%s is %s",
20 $self->{currentSupplyDescription},
21 $self->{currentSupplyCurrentStatus});
22 } elsif ($self->{currentSupplyCurrentStatus} eq "empty") {
23 $self->add_critical(sprintf "%s is %s",
24 $self->{currentSupplyDescription},
25 $self->{currentSupplyCurrentStatus});
26 } elsif ($self->{currentSupplyCurrentStatus} eq "invalid") {
27 $self->add_critical(sprintf "%s is %s",
28 $self->{currentSupplyDescription},
29 $self->{currentSupplyCurrentStatus});
30 }
31 }