I’ll tell you about a simple and effective way to monitor network printers in an organization. It will be about setting up monitoring of the status of printers HP, Kyocera, Brother through snmp with Zabbix. I will collect the values of the printed pages for all time, the state of the toner, the name of the cartridge and the serial number of the printer.
Almost all modern printers are able to give data about their condition through the snmp protocol. Zabbix monitoring system allows you to easily collect this data, store, configure alerts for various events. In my example, I will send a notification if the toner level in the cartridge drops below 10%.
The biggest problem here is finding the actual MIB and OID for the values being collected. If you collect all available metrics on snmp, for example, from an HP printer, you will get over 1000 different metrics! Find in it what you really need is not easy. I will talk about the metrics that interested me. The values of these OIDs I found out.
I will collect the following metrics:
- How many printers printed total pages.
- The maximum number of pages that the printer prints on the current cartridge.
- The number of pages that the printer has already printed on the current cartridge.
- Cartridge model.
- The serial number of the printer.
Getting Started. If you do not have your own monitoring server, I recommend post on this site – install and configure zabbix.
Search required OID
To begin with, let’s take some printer and see what it will give us with snmp. For example, I’ll take the HP LaserJet Pro MFP M426fdn printer (ip address 192.168.88.20). By default, HP printers are allowed to view parameters on snmp.
Go to the linux console and see with the snmpwalk printer metrics on snmp. To do this, install the necessary package.
# yum install net-snmp-utils
Now let’s look at printer metrics:
# snmpwalk -v 2c -c public 192.168.88.20
You can see a lot of lines with data. Send the output to a text file and look at it.
# snmpwalk -v 2c -c public 192.168.88.20 > ~/snmp.txt
I will immediately point out the lines that interest us:
|SNMPv2-SMI::mib-188.8.131.52.184.108.40.206 = Counter32: 8909||Total pages printed|
|SNMPv2-SMI::mib-220.127.116.11.18.104.22.168 = STRING: “Black Cartridge HP CF226X”||Cartridge name|
|SNMPv2-SMI::mib-22.214.171.124.1.17.1 = STRING: “PHB8K3H0P1”||Serial Number|
|SNMPv2-SMI::mib-126.96.36.199.188.8.131.52 = INTEGER: 85||Toner Level|
You may still be interested in the parameter mib-184.108.40.206.1.16.1 – the name of the printer. I personally do not need it, but if everything is displayed in a overall table, it can be useful. Just pay attention to the parameter mib-220.127.116.11.18.104.22.168. It usually shows the maximum number of pages that can be printed from the current cartridge.
I had to deal with two different situations in the toner level readings:
- The toner level is displayed immediately in % in 22.214.171.124.126.96.36.199. The parameter for the maximum number of pages from the current cartridge is listed as 100% in 188.8.131.52.184.108.40.206.
- The toner level in 220.127.116.11.18.104.22.168 indicates the number of printed pages from the current cartridge. The second parameter 22.214.171.124.126.96.36.199 indicates the maximum number of pages that can be printed with the current cartridge. Then the level of toner in % should be calculated using the formula 100-100 * (mib-188.8.131.52.184.108.40.206) / (mib-220.127.116.11.18.104.22.168).
The first situation came to me in HP printers, the second in Kyocera and Brother. Because of this, I had to make 3 different templates for each manufacturer of printers. All other parameters they have coincided.
In Brother mib printers, the toner level was different, the same as those of HP and Kyocera, but differed by the last digit – 22.214.171.124.126.96.36.199 and 188.8.131.52.184.108.40.206, respectively. I do not know why it is so, but I have seen a similar situation with other people. Because of this, someone created autodiscovery rules to calculate the last digit. I did not have to do this. It was enough to create different templates for each manufacturer. All printers are 100% included in these templates.
Another story with color printers. There are several cartridges and you need to carefully look at their numbers. Also not difficult, just the offset will be one unit, all cartridges will go in order.
Configuring printer monitoring by snmp
There is nothing to configure on the monitoring server. It will be enough for you to take my templates, make sure that the MIB and OID match with your printers and add the printers to monitoring, not forgetting to specify the snmp interface from them.
Here is an example of one item for an HP printer template.
And here is an example of a calculated toner level value for the Kyocera template.
An example of a trigger that is in all templates.
All information about printers can be displayed on the Dashboard in the following view:
Interval updates items in template:
- Total pages printed – 1 hour
- Printed with toner – 10 min
- Toner capacity – 10 min
- Toner level – 10 min
- Cartridge name – 1 day
- Serial number – 1 day
When debugging, I recommend setting these values to 1 minute.
For the Toner Level data item, the Numeric data type is specified so that the trigger works and compares the value. If you have any errors with toner, the value will be -2 or -3 with the type “String”. The item will become inactive with an error.
Value "-2" of type "string" is not suitable for value type "Numeric (unsigned)"
There’s nothing you can do about it. You can make a separate template for such printers and change the item type from numeric to string. So at least you will get a value of -2, and not an error item.
At this I have everything on this topic. Add templates, check and use.
Such a simple and useful solution. It is configured quickly, the display of information is useful. Perhaps there are some more interesting and useful values that you can take with snmp. Maybe there is something that tells or hints at the upcoming repair. For example, resource oven or even some element. On the MFP, I saw information about the scanned pages, the number of copies made. I do not know what could be useful. If there are comments and recommendations, please write in the comments.