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

Lexmark XC9255 Duplicate Consumables #22

Closed 0xliam closed 3 years ago

0xliam commented 3 years ago

Hi there :) Big fan of this plugin and we're using it in production for a number of devices.

One of our sites has a number of Lexmark XC9235 printers, and they all report duplicate consumables.

It also reports a consumable called Hole - which we believe is the hole punch box, which can be ignored.

[root@satellite ~]# /usr/lib64/nagios/plugins/check_snmp_printer --consum --metric -C public -H 10.1.80.2 -v 2c --nofeeder CRITICAL: Hole is at 0% remaining. CRITICAL: Black Toner is at 5.00% remaining. OK: 200K is at 100.00% remaining. OK: 200K is at 100.00% remaining. OK: Yellow Toner is at 54.00% remaining. OK: Magenta Toner is at 78.00% remaining. OK: Staples is at 100.00% remaining. OK: 300K is at 68.00% remaining. OK: Cyan Toner is at 60.00% remaining. OK: Magenta Toner is at 54.00% remaining. OK: Staples is at 100.00% remaining. OK: Staples is at 100.00% remaining. OK: Cyan Toner is at 60.00% remaining. OK: Fuser is at 92.00% remaining. OK: Yellow Toner is at 71.00% remaining. OK: Black Toner is at 40.00% remaining. |Hole=0;;;; 200K=100.00;;;; 200K=100.00;;;; Yellow_Toner=54.00;;;; Magenta_Toner=78.00;;;; Staples=100.00;;;; Black_Toner=5.00;;;; 300K=68.00;;;; Cyan_Toner=60.00;;;; Magenta_Toner=54.00;;;; Staples=100.00;;;; Staples=100.00;;;; Cyan_Toner=60.00;;;; Fuser=92.00;;;; Yellow_Toner=71.00;;;; Black_Toner=40.00;;;;

snmpwalk -On -c public -v 1 10.1.80.2 1.3.6.1.2.1.25.3.2.1.3.1 .1.3.6.1.2.1.25.3.2.1.3.1 = STRING: Lexmark XC9255 7559040011097 CXTMH.073.022

I've walked the 1.3.6.1.2.1.43 OID and it dumps a lot of data - I believe these are the relevant ones but I've attached the full walk in case.

XC9255.txt

.1.3.6.1.2.1.43.11.1.1.6.1.1 = STRING: "200K HCF Maintenance Kit" .1.3.6.1.2.1.43.11.1.1.6.1.2 = STRING: "200K MPF Maintenance Kit" .1.3.6.1.2.1.43.11.1.1.6.1.3 = STRING: "300K Maintenance Kit" .1.3.6.1.2.1.43.11.1.1.6.1.4 = STRING: "Black Developer" .1.3.6.1.2.1.43.11.1.1.6.1.5 = STRING: "Black Photoconductor" .1.3.6.1.2.1.43.11.1.1.6.1.6 = STRING: "Black Cartridge" .1.3.6.1.2.1.43.11.1.1.6.1.7 = STRING: "Color Developer Kit (CMY)" .1.3.6.1.2.1.43.11.1.1.6.1.8 = STRING: "Cyan Photoconductor" .1.3.6.1.2.1.43.11.1.1.6.1.9 = STRING: "Cyan Cartridge" .1.3.6.1.2.1.43.11.1.1.6.1.10 = STRING: "Fuser Kit" .1.3.6.1.2.1.43.11.1.1.6.1.11 = STRING: "Hole Punch Box" .1.3.6.1.2.1.43.11.1.1.6.1.12 = STRING: "Magenta Photoconductor" .1.3.6.1.2.1.43.11.1.1.6.1.13 = STRING: "Magenta Cartridge" .1.3.6.1.2.1.43.11.1.1.6.1.14 = STRING: "Staples" .1.3.6.1.2.1.43.11.1.1.6.1.15 = STRING: "Staples G11" .1.3.6.1.2.1.43.11.1.1.6.1.16 = STRING: "Staples G12" .1.3.6.1.2.1.43.11.1.1.6.1.17 = STRING: "Waste Toner Bottle" .1.3.6.1.2.1.43.11.1.1.6.1.18 = STRING: "Yellow Photoconductor" .1.3.6.1.2.1.43.11.1.1.6.1.19 = STRING: "Yellow Cartridge"

I have no experience with Perl, so I'm not sure how best to contribute to fixing this, but happy to provide any details if you think this is something you would be able to resolve.

Tylan commented 3 years ago

Thanks for using my plugin :)

Please try this patch and let me know

patch check_snmp_printer < check_snmp_printer_1.2.4-patch.txt

check_snmp_printer_1.2.4-patch.txt

0xliam commented 3 years ago

Beautiful, that has worked perfectly!

Before:

[root@satellite ~]# /usr/lib64/nagios/plugins/check_snmp_printer --consum --metric -C public -H 10.1.80.36 -v 2c CRITICAL: Hole is at 0% remaining. OK: Transfer Unit is at 100.00% remaining. OK: Cyan Toner is at 79.00% remaining. OK: ADF is at 99.00% remaining. OK: Yellow Toner is at 100.00% remaining. OK: Magenta Toner is at 100.00% remaining. OK: Cyan Toner is at 100.00% remaining. OK: Black Toner is at 91.00% remaining. OK: Fuser is at 100.00% remaining. OK: Staples is at 100.00% remaining. OK: Magenta Toner is at 89.00% remaining. OK: Filter is at 100.00% remaining. OK: Black Toner is at 71.00% remaining. OK: Yellow Toner is at 90.00% remaining. |Transfer_Unit=100.00;;;; Cyan_Toner=79.00;;;; ADF=99.00;;;; Yellow_Toner=100.00;;;; Magenta_Toner=100.00;;;; Cyan_Toner=100.00;;;; Black_Toner=91.00;;;; Fuser=100.00;;;; Staples=100.00;;;; Magenta_Toner=89.00;;;; Filter=100.00;;;; Black_Toner=71.00;;;; Hole=0;;;; Yellow_Toner=90.00;;;;

After:

[root@satellite ~]# ./check_snmp_printer --consum --metric -C public -H 10.1.80.36 -v 2c OK: Transfer Unit is at 100.00% remaining. OK: Cyan Toner is at 79.00% remaining. OK: ADF is at 99.00% remaining. OK: Fuser Kit is at 100.00% remaining. OK: Staples is at 100.00% remaining. OK: Magenta Toner is at 89.00% remaining. OK: Filter is at 100.00% remaining. OK: Black Toner is at 71.00% remaining. OK: Hole Punch Box is at 0% remaining. OK: Yellow Toner is at 90.00% remaining. |Transfer_Unit=100.00;;;; Cyan_Toner=79.00;;;; ADF=99.00;;;; Fuser_Kit=100.00;;;; Staples=100.00;;;; Magenta_Toner=89.00;;;; Filter=100.00;;;; Black_Toner=71.00;;;; Hole_Punch_Box=0;;;; Yellow_Toner=90.00;;;;

Tylan commented 3 years ago

Awesome :) One thing I noticed is the Hole Punch Box should read: "is X% full." I added another patch to fix that, could you apply that and let me know?

patch check_snmp_printer < check_snmp_printer_1.2.4-patch2.txt

check_snmp_printer_1.2.4-patch2.txt

0xliam commented 3 years ago

Hmm, unfortunately I am still seeing that line as OK: Hole Punch Box is at 0% remaining.

Tylan commented 3 years ago

Oops,

I forgot to modify another section too. Can you apply this patch as well and let me know?

patch check_snmp_printer < check_snmp_printer_1.2.4-patch3.txt

check_snmp_printer_1.2.4-patch3.txt

0xliam commented 3 years ago

Perfect!

/usr/lib64/nagios/plugins/check_snmp_printer --consum --metric -C public -H 10.1.80.37 -v 2c
OK: Fuser Kit is at 85.00% remaining.
OK: Black Toner is at 73.00% remaining.
OK: Hole Punch Box is 0% full.
OK: Yellow Toner is at 41.00% remaining.
OK: Staples is at 100.00% remaining.
OK: Magenta Toner is at 53.00% remaining.
OK: ADF is at 93.00% remaining.
OK: Cyan Toner is at 38.00% remaining.
|Fuser_Kit=85.00;;;; Black_Toner=73.00;;;; Hole_Punch_Box=0;;;; Yellow_Toner=41.00;;;; Staples=100.00;;;; Magenta_Toner=53.00;;;; ADF=93.00;;;; Cyan_Toner=38.00;;;;
Tylan commented 3 years ago

Great! Closing issue then :)