Tylan / check_snmp_printer

Icinga Plugin for Checking SNMP Printer Status (Trays, Consumables and Pagecounts)
GNU General Public License v3.0
12 stars 4 forks source link

Add Printer - HP LaserJet Professional P1606dn #21

Closed Cryjack closed 3 years ago

Cryjack commented 3 years ago

For consumables it tells: CRITICAL: CE278A is at 0% remaining.

Here is a working patch for it. Maybe you can adjust to fit into your code.

check_snmp_printer.txt

Tylan commented 3 years ago

nice, thanks :) You can also replace this line:

            if ($consumable =~ m/CE/) { $consumable = "Black Toner"; }

with this:

            if ($consumable =~ m/CE/) {
                    if ($consumable =~ /1A$/) { $consumable = "Cyan Toner"; }
                    elsif ($consumable =~ /3A$/) { $consumable = "Magenta Toner"; }
                    elsif ($consumable =~ /2A$/) { $consumable = "Yellow Toner"; }
                    elsif ($consumable =~ /0A$/) { $consumable = "Black Toner"; }
                    else { $consumable = "Black Toner"; }
            }

This should cover future color printers that have this same issue. Thanks!