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

Brother Support #10

Closed fma-bk closed 3 years ago

fma-bk commented 3 years ago

Hi, and here are the oids from our Brother Printer. brother-snmpwalk.txt

Tylan commented 3 years ago

Give this patch a whirl. I found an old brother printer I had lying around to help assist with some of the OIDs. This should work as you would want it to. Let me know!

check_snmp_printer-brother-patch.txt

patch check_snmp_printer < check_snmp_printer-brother-patch.txt

fma-bk commented 3 years ago

Good Morning :) Works well, expect two things: brother-icinga

  1. There is a missing Space between the Elements of "Plugin-Ausgabe"
  2. It says Yellow Toner levels are OK AND "Wenig Toner :Y" (EN: Low Toner) at the same time

I attached a (very poorly painted ;) ) image with the output of the plugin and an screenshot of the printers web page toner status.

Tylan commented 3 years ago

Oops. Can you apply this patch and let me know. Thanks!

Note this isn't probably 100% perfect, but should work in most scenarios.

check_snmp_printer-brother-patch2.txt

patch check_snmp_printer < check_snmp_printer-brother-patch2.txt

Tylan commented 3 years ago

Did that patch work out for you?

fma-bk commented 3 years ago

Hi, The missing Space is fixed. But the Toner Level is still on 100% althoug yellow is nearly empty. We are still looking into to to see if the problem is with snmp/icinga/the Plugin...

fma-bk commented 3 years ago

Ok, its the Plugin. I think you can only get the Toner Levels from the Error Warnings. Maybe "bigger" Brother Printers will deliver more accurate results over snmp... What about the sollution i mentioned in the brother-snmpwalk.txt at the end? if [ -z $ALERTDESCR ]; then EXIT_STRING="UNKNOWN - could not get values for toner level. \n" EXIT_CODE=3 elif [[ ! $ALERTDESCR =~ "WENIG TONER" ]] && [[ ! $ALERTDESCR =~ "TONER ERSETZEN" ]]; then EXIT_STRING="OK - toner level is ok. \n" EXIT_CODE=0 elif [[ $ALERTDESCR =~ "WENIG TONER" ]]; then EXIT_STRING="WARNING - toner low. \n" EXIT_CODE=1 elif [[ $ALERTDESCR =~ "TONER ERSETZEN" ]]; then EXIT_STRING="CRITICAL - toner empty! \n" EXIT_CODE=2 else EXIT_STRING="UNKNOWN - please check script. \n" EXIT_CODE=3 fi

Tylan commented 3 years ago

My code was supposed to fallback to the alert messages if the brother's OID specific levels weren't there. I'm testing with a small MFC-7840W but it's only B&W and the only one I have available. My concern about the alert messages is it sounds pretty generic. It doesn't seem to specify which toner is low or empty.

Tylan commented 3 years ago

I think I found the issue - the current capacity OID is reporting -3 which is supposed to mean that the printer knows that there is some supply/remaining space. It looks like even if it's low it will report a -3. Let me look to find a solution around this.

Tylan commented 3 years ago

Are all the toners showing "levels are OK" messages or are you actually seeing a % message after the last patch?

I might only be able to report on empty or something there and then you'd have to fall back to the --messages switch which I can change the plugin to report as warning/critical depending on messaging.

fma-bk commented 3 years ago

MicrosoftTeams-image (4) It reports all "OK" and no %. In the picture in my 2nd posting you can see the actual levels. It reports Yellow Low(DE Niedrig). I dont think it will give you % values via snmp... And sorry for my late reply...

Tylan commented 3 years ago

Sorry for delay.

That is the way that Brother will be reporting unfortunately. They don't provide % information for older models and possibly current models. It only reports on "Yes I have something remaining" (could be even 1% left but it still has something) or "Nope, I'm empty" so there's no in between. Because of this I modified the -messages output to go warning/critical depending on specific messages so that can be used in unison with the consumables.

Grab the new update below. I'm going to mark this as closed but if there's any bug you notice with the below code please open another issue and I'll look into it. Thanks!

https://github.com/Tylan/check_snmp_printer/blob/master/check_snmp_printer