Java SNMP:用于打印页数的通用 OID

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/24403443/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-14 12:00:41  来源:igfitidea点击:

SNMP: generic OID for printed page count

javaprintingsnmp

提问by Dylan Reniers

I'm currently in the middle of developing an application that involves getting data from printers by the SNMP protocol. Since I'd like to program to be as generic as possible, I try to use the same OID's as much as I can for different types of printers. I was hoping to find an OID that would tell me how many pages were printed in color and black. I know the OID 1.3.6.1.2.1.43.10.2.1.4.1.1 gives you a total, but I really need to have a difference in color and black/white for statistical purposes

我目前正在开发一个应用程序,该应用程序涉及通过 SNMP 协议从打印机获取数据。由于我希望编程尽可能通用,因此我尝试为不同类型的打印机尽可能多地使用相同的 OID。我希望找到一个 OID 来告诉我有多少页是彩色和黑色打印的。我知道 OID 1.3.6.1.2.1.43.10.2.1.4.1.1 给了你一个总数,但为了统计目的,我真的需要在颜色和黑色/白色上有所不同

If there is an OID which could tell me how many pages there were printed in color/black and white and it can be used on different models/types of printers, and you happen to know it, please don't hesitate to fill me in.

如果有一个 OID 可以告诉我彩色/黑白打印了多少页,并且它可以用于不同型号/类型的打印机,并且您碰巧知道它,请不要犹豫填写我.

Kind regards

亲切的问候

回答by Jolta

This is not reallya programming question, but since you're developing an application, I guess it sort of fits on Stack Overflow anyway...

这不是一个真正的编程问题,但由于您正在开发一个应用程序,我想它无论如何都适合 Stack Overflow...

1.3.6.1.2.1.43.10.2 is a table, prtMarkerTable.

1.3.6.1.2.1.43.10.2 是一个表,prtMarkerTable。

1.3.6.1.2.1.43.10.2.1.4 is the column prtMarkerLifeCount. It counts the marker, and on a laser printer, I would expect it to count pages printed.

1.3.6.1.2.1.43.10.2.1.4 是列 prtMarkerLifeCount。它计算标记,在激光打印机上,我希望它计算打印的页数。

If you have a color laser printer, it might count each cartridge as a separate "marker", so you'd have multiple rows in the table. This is up to the printer vendor. If that's the case, you could see the value for each marker by doing an SNMP walk of the whole table. Using the net-snmp command line tools, the command line would be something like

如果您有一台彩色激光打印机,它可能会将每个墨盒算作一个单独的“标记”,因此表格中会有多行。这取决于打印机供应商。如果是这种情况,您可以通过对整个表执行 SNMP 遍历来查看每个标记的值。使用net-snmp 命令行工具,命令行将类似于

snmpwalk -c public -v2c <printer-address> 1.3.6.1.2.1.43.10.2

The output might give you some insight into what your particular printer publishes.

输出可能会让您深入了解您的特定打印机发布的内容。

You can see the different OIDs of the MIB for instance at this web page, and you can read the whole MIB in RFC 3805.

例如,您可以在此网页上查看 MIB 的不同 OID ,并且您可以在RFC 3805 中阅读整个 MIB 。

Note that while most printer vendors implement RFC 3805, it's not mandatory, so you should check each new printer that arrives for compliance. Some vendors might prefer to implement a proprietary printer MIB.

请注意,虽然大多数打印机供应商实施 RFC 3805,但它不是强制性的,因此您应该检查每台到货的新打印机是否符合要求。一些供应商可能更喜欢实施专有打印机 MIB。