Cacti (home)ForumsRepositoryDocumentation
Cacti: offical forums and support
It is currently Thu Oct 30, 2014 11:39 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 70 posts ]  Go to page 1, 2, 3, 4, 5  Next
Author Message
 Post subject: SNMP Printer Template
PostPosted: Wed Apr 12, 2006 1:50 pm 
Offline

Joined: Wed Apr 12, 2006 1:34 pm
Posts: 3
I've created this bunch of XMLs to get generic SNMP Printer information:
    * Get printer supply (toner, ink cartridge, etc...) and display a graph with the total capacity and remaining level of "ink"
    * Get the lifetime counter of impressions
    * Get the network interface statistics
You have inside this ZIP file the XMLs for:
    * Data query to get Printer Supplies
    * Data template Get Printer Supply
    * Data template Get Printer Total Pages
    * Graph template Host MIB - Get Printer Supply
    * Host template SNMP Printer
    * XML SNMP Query template to put in <cactidir>/resource/snmp-queries/ in order to get the relevant OIDs
These should work on any Network Printer that has SNMP enabled. I've tested with the following printers:
    * HP Laserjet 4050: Total page count working. I get the toner name, but level is -2, according with HP it's because I'm using a recycled toner
    * HP Laserjet 4250: Total page count working, toner and fuser levels working
    * HP Deskjet 1100: Total page count working, 4 ink levels working
    * Canon LPB1760e: Total page count working, toner name working, but level 0, probably same problem as HP

What I didn't figure out as a way to get the correct units for the supply levels, for instance, in the HP 4050 the units are in tenthsOfGrams and in the HP 4250 the units are in availablePrintPages. If only I could figure out a way of making the units appear in the graphs.

Don't forget to put the
Code:
printer_supply.xml
file in the
Code:
<cactidir>/resource/snmp-queries/
directory.
Hope this helps someone!


Attachments:
SNMP Printer.zip [22.07 KiB]
Downloaded 117979 times
Top
 Profile  
 
 Post subject: Re: SNMP Printer Template
PostPosted: Thu Apr 13, 2006 8:33 am 
Offline
Developer
User avatar

Joined: Thu Dec 02, 2004 2:46 am
Posts: 22461
Location: Muenster, Germany
mazevedo wrote:
What I didn't figure out as a way to get the correct units for the supply levels, for instance, in the HP 4050 the units are in tenthsOfGrams and in the HP 4250 the units are in availablePrintPages. If only I could figure out a way of making the units appear in the graphs.
Is there any OID that spits out these Units as a STRING? The define a new field using this OID but <direction>output</direction>. Now you may use |query_YourNewFieldName| for your Graphs
Reinhard

_________________
Official Cacti Documentation
Official Debugging Help
Central Plugin Repository
Central Templates Repository


Top
 Profile  
 
 Post subject: Re: SNMP Printer Template
PostPosted: Thu Apr 13, 2006 1:25 pm 
Offline

Joined: Wed Apr 12, 2006 1:34 pm
Posts: 3
lvm wrote:
Is there any OID that spits out these Units as a STRING? The define a new field using this OID but <direction>output</direction>. Now you may use |query_YourNewFieldName| for your Graphs
Reinhard

I've found in the Printer MIB this information:
Code:
Name:             prtMarkerSuppliesSupplyUnit
Type:             OBJECT-TYPE
OID:              1.3.6.1.2.1.43.11.1.1.7

Parent:           prtMarkerSuppliesEntry
Previous sibling: prtMarkerSuppliesDescription
Next sibling:     prtMarkerSuppliesMaxCapacity
     
Numerical syntax: Integer (32bit)
Base syntax:      INTEGER
Composed syntax:  PrtMarkerSuppliesSupplyUnitTC
Status:           current
Max access:       read-only
      
Description:    

Unit of measure of this marker supply container/receptacle.

NOTE: The above description has been modified from RFC 1759
for clarification.


The composed syntax is something like this:
Code:
Name:    PrtMarkerSuppliesSupplyUnitTC
Type:    TEXTUAL-CONVENTION
Module:    Printer-MIB
     
     
Base syntax:      INTEGER
Numerical syntax: Integer (32bit)
Composed syntax:  INTEGER
Value list:     
  1:  other(1)
  2:  unknown(2)
  3:  tenThousandthsOfInches(3)
  4:  micrometers(4)
  5:  impressions(7)
  6:  sheets(8)
  7:  hours(11)
  8:  thousandthsOfOunces(12)
  9:  tenthsOfGrams(13)
  10: hundrethsOfFluidOunces(14)
  11: tenthsOfMilliliters(15)
  12: feet(16)
  13: meters(17)
  14: items(18)
  15: percent(19)
Status:           current
Description:    

Unit of this marker supply container/receptacle.

I can't seem to obtain this values from the MIB, they're defined in the MIB RFC. Is there another way, like using an external program that receives this value from SNMP and returns a string with the unit?


Top
 Profile  
 
 Post subject: Re: SNMP Printer Template
PostPosted: Thu Apr 13, 2006 2:43 pm 
Offline
Developer
User avatar

Joined: Thu Dec 02, 2004 2:46 am
Posts: 22461
Location: Muenster, Germany
mazevedo wrote:
I can't seem to obtain this values from the MIB, they're defined in the MIB RFC. Is there another way, like using an external program that receives this value from SNMP and returns a string with the unit?
How did you try? snmpwalk-ing the above OID failed? Then I'm at a loss
Reinhard

_________________
Official Cacti Documentation
Official Debugging Help
Central Plugin Repository
Central Templates Repository


Top
 Profile  
 
 Post subject: Re: SNMP Printer Template
PostPosted: Fri Apr 14, 2006 7:35 am 
Offline

Joined: Wed Apr 12, 2006 1:34 pm
Posts: 3
lvm wrote:
How did you try? snmpwalk-ing the above OID failed? Then I'm at a loss
Reinhard


This is what you get with an SNMP walk, just an integer.
Code:
cacti:~# snmpwalk -c xxxxxxx -v 1 10.50.1.203  1.3.6.1.2.1.43.11.1.1
SNMPv2-SMI::mib-2.43.11.1.1.2.1.1 = INTEGER: 1
SNMPv2-SMI::mib-2.43.11.1.1.2.1.2 = INTEGER: 1
SNMPv2-SMI::mib-2.43.11.1.1.3.1.1 = INTEGER: 0
SNMPv2-SMI::mib-2.43.11.1.1.3.1.2 = INTEGER: 0
SNMPv2-SMI::mib-2.43.11.1.1.4.1.1 = INTEGER: 3
SNMPv2-SMI::mib-2.43.11.1.1.4.1.2 = INTEGER: 3
SNMPv2-SMI::mib-2.43.11.1.1.5.1.1 = INTEGER: 21
SNMPv2-SMI::mib-2.43.11.1.1.5.1.2 = INTEGER: 15
SNMPv2-SMI::mib-2.43.11.1.1.6.1.1 = STRING: "Black Cartridge HP Q5942X"
SNMPv2-SMI::mib-2.43.11.1.1.6.1.2 = STRING: "Maintenance Kit HP 110V-Q5421A, 220V-Q5422A"
SNMPv2-SMI::mib-2.43.11.1.1.7.1.1 = INTEGER: 7
SNMPv2-SMI::mib-2.43.11.1.1.7.1.2 = INTEGER: 7
SNMPv2-SMI::mib-2.43.11.1.1.8.1.1 = INTEGER: 20000
SNMPv2-SMI::mib-2.43.11.1.1.8.1.2 = INTEGER: 225000
SNMPv2-SMI::mib-2.43.11.1.1.9.1.1 = INTEGER: 13799
SNMPv2-SMI::mib-2.43.11.1.1.9.1.2 = INTEGER: 144632
cacti:~#

Look at values .7.1.1 and 7.1.2, you only get an integer for the unit type of each the toner and the maintenance kit supply values.

As I mentioned before, if you get into the Printer MIB specification you'll see that those values are defined, but you cannot obtain the units names from an actual SNMP walk, only the integers for that unit type name.

I've found out that each printer as it's own unit of measure. Most HP LaserJets 42xx and Deskjets 1xxx use tenthsOfGrams for units, while others use remaining prints available ( like this one=impressions(7) ), or others that use "meters" of pages available (?).

As I can't seem to get the units name from an actual SNMP walk, just the integer for that unit, it would be nice that Cacti had a "units" table, so when you get a particular integer unit type and you mention that that field is to be used with a "selectable" array of units, you could actually get the units name for that particular integer. There are other special fields like this one in other SNMP values.

Hope I did my best to make this clear, but even I look at my bad english and feel dizzy! :evil:


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 14, 2006 9:04 am 
Offline
Developer
User avatar

Joined: Thu Dec 02, 2004 2:46 am
Posts: 22461
Location: Muenster, Germany
Your statements are absolutely correct. Even if it comes to the lookup table. Unfortunately, I'm not aware of any magic that would make cacti create and lookup such a table.
So, the only solution that comes to my memory would be a wrapper Script Query. This should simply perform all the SNMP lookups. And this would incorporate some "lookup table" in the code, changing ONLY this single OID from value to units. But this is very nasty, of course.
Reinhard

_________________
Official Cacti Documentation
Official Debugging Help
Central Plugin Repository
Central Templates Repository


Top
 Profile  
 
 Post subject: Need some SNMP information
PostPosted: Mon Jun 05, 2006 7:22 am 
Offline

Joined: Mon Jun 05, 2006 7:10 am
Posts: 1
Hello,
My question is not about Cacti, but SNMP. I have to make a similar project about Printer management and I would like to ask you if you could help me with some links/docs about Printer management orver SNMP. Also I couldn't found a Printer v2 MIB. My email is: lucian.furtos@codemart.ro

Thank you for your time and please excuse me.

Lucian.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 05, 2006 7:53 am 
Offline
Developer
User avatar

Joined: Thu Dec 02, 2004 2:46 am
Posts: 22461
Location: Muenster, Germany
I'm not aware of any link that may help. AFAIK, manufacturers like to provide their own MIBs. And from some examples I deduced, that often SNMP support is less complete as e.g. http configuration, but that depends
Reinhard

_________________
Official Cacti Documentation
Official Debugging Help
Central Plugin Repository
Central Templates Repository


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 25, 2006 11:52 am 
Offline
Developer
User avatar

Joined: Thu Dec 02, 2004 2:46 am
Posts: 22461
Location: Muenster, Germany
That depends on the way you want to get things graphed. When using a COUNTER, you will get differences between polling intervals (perhaps normalized to a minute or so). That's your current settings.
But you may change to GAUGE to get those "increasing" values. So it depends on your likings
Reinhard

_________________
Official Cacti Documentation
Official Debugging Help
Central Plugin Repository
Central Templates Repository


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 25, 2006 2:18 pm 
Offline

Joined: Thu Jun 15, 2006 11:36 am
Posts: 48
I just found that out ;-)
You have to go to Console -> Data Templates -> Host MIB -> Get Printer Total Pages and change the Data Source Type to Gauge

That's nice that it is to every bodies preference but it doesn't show total pages anywhere. That should be fixed.

Our kyocera printers don't have 1.3.6.1.2.1.43.11.1.1.1 so I had to change the <oid_index>.1.3.6.1.2.1.43.11.1.1.1</oid_index> to <oid_index>.1.3.6.1.2.1.43.11.1.1.2</oid_index> in printer_supply.xls. Even though I was able to choose the toner from printer_supply table it still won't show on graph.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 25, 2006 4:36 pm 
Offline

Joined: Thu Jun 15, 2006 11:36 am
Posts: 48
As I said in previous reply mine snmp query for printer supply was not working until i changed printer_supply.xml. Now even though I am able to choose which supply I want to monitor the graph is not created. I get this in cacti log:
Code:
07/25/2006 03:59:53 PM - CACTID: Poller[0] Host[12] DS[24] SNMP: v1: 192.168.11.164, dsname: supply_total, oid: .1.3.6.1.2.1.43.11.1.1.8.1, value: U
07/25/2006 03:59:53 PM - CACTID: Poller[0] Host[12] DS[24] WARNING: Result from SNMP not valid. Partial Result: ...


the oid is missing a 1 at the end it should be .1.3.6.1.2.1.43.11.1.1.8.1.1

when I walk the .1.3.6.1.2.1.43.11 I get this:
Code:
SNMPv2-SMI::mib-2.43.11.1.1.2.1.1 = INTEGER: 1
SNMPv2-SMI::mib-2.43.11.1.1.2.1.2 = INTEGER: 1
SNMPv2-SMI::mib-2.43.11.1.1.3.1.1 = INTEGER: 0
SNMPv2-SMI::mib-2.43.11.1.1.3.1.2 = INTEGER: 0
SNMPv2-SMI::mib-2.43.11.1.1.4.1.1 = INTEGER: 3
SNMPv2-SMI::mib-2.43.11.1.1.4.1.2 = INTEGER: 4
SNMPv2-SMI::mib-2.43.11.1.1.5.1.1 = INTEGER: 3
SNMPv2-SMI::mib-2.43.11.1.1.5.1.2 = INTEGER: 4
SNMPv2-SMI::mib-2.43.11.1.1.6.1.1 = STRING: "Toner Container"
SNMPv2-SMI::mib-2.43.11.1.1.6.1.2 = STRING: "Waste Toner Box"
SNMPv2-SMI::mib-2.43.11.1.1.7.1.1 = INTEGER: 7
SNMPv2-SMI::mib-2.43.11.1.1.7.1.2 = INTEGER: 7
SNMPv2-SMI::mib-2.43.11.1.1.8.1.1 = INTEGER: 20000
SNMPv2-SMI::mib-2.43.11.1.1.8.1.2 = INTEGER: -2
SNMPv2-SMI::mib-2.43.11.1.1.9.1.1 = INTEGER: 20000
SNMPv2-SMI::mib-2.43.11.1.1.9.1.2 = INTEGER: -3


even though mine walk looks similar to mazevedo's (his misses the 1.3.6.1.2.1.43.11.1.1.1 entries too) the data query doesn't work unless i change <oid_index> in printer_supply.xml, so it has 2 at the end instead of 1.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 27, 2006 2:30 pm 
Offline
Developer
User avatar

Joined: Thu Dec 02, 2004 2:46 am
Posts: 22461
Location: Muenster, Germany
imro wrote:
I just found that out ;-)
You have to go to Console -> Data Templates -> Host MIB -> Get Printer Total Pages and change the Data Source Type to Gauge

That's nice that it is to every bodies preference but it doesn't show total pages anywhere. That should be fixed.
To be precise, after changing the rrdtool option, you'll have to "rrdtool tune" all existing rrd files to mimic the wanted behaviour.
And by using the Summing function (see manual), it is well possible to get the totals (relative tpo the timespan of the current graph) displayed. You you may get daily total, weekly total ...

Quote:
Our kyocera printers don't have 1.3.6.1.2.1.43.11.1.1.1 so I had to change the <oid_index>.1.3.6.1.2.1.43.11.1.1.1</oid_index> to <oid_index>.1.3.6.1.2.1.43.11.1.1.2</oid_index> in printer_supply.xls. Even though I was able to choose the toner from printer_supply table it still won't show on graph.
The first one belongs entirely to the printer manufacturers. As to your error, I would like to get the DEBUG code (the whole rrdtool graph statement) found from the Graph Management as well as the whole Data Template for this (including all OIDs you're using)
Reinhard

_________________
Official Cacti Documentation
Official Debugging Help
Central Plugin Repository
Central Templates Repository


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 04, 2006 10:31 am 
Offline

Joined: Thu Jun 15, 2006 11:36 am
Posts: 48
I have used everything just as mazevedo has posted but I had to change the xml:

Code:
<interface>
   <name>Get Printer Supply Information</name>
   <index_order_type>numeric</index_order_type>
   <oid_index>.1.3.6.1.2.1.43.11.1.1.[b]2[/b]</oid_index>

   <fields>
      <prtMarkersSupplyIndex>
         <name>Index</name>
         <method>walk</method>
         <source>value</source>
         <direction>input</direction>
         <oid>.1.3.6.1.2.1.43.11.1.1.[b]2[/b]</oid>
      </prtMarkersSupplyIndex>
      <prtMarkersSupplyDesc>
         <name>Description</name>
         <method>walk</method>
         <source>value</source>
         <direction>input</direction>
         <oid>.1.3.6.1.2.1.43.11.1.1.6</oid>
      </prtMarkersSupplyDesc>
      <prtMarkersSupplyUnits>
         <name>Supply Units</name>
         <method>walk</method>
         <source>value</source>
         <direction>input</direction>
         <oid>.1.3.6.1.2.1.43.11.1.1.7</oid>
      </prtMarkersSupplyUnits>

      <prtMarkersSupplySize>
         <name>Total Capacity</name>
         <method>walk</method>
         <source>value</source>
         <direction>output</direction>
         <oid>.1.3.6.1.2.1.43.11.1.1.8.[b]1[/b]</oid>
      </prtMarkersSupplySize>
      <prtMarkersSupplyUsed>
         <name>Total Used</name>
         <method>walk</method>
         <source>value</source>
         <direction>output</direction>
         <oid>.1.3.6.1.2.1.43.11.1.1.9.[b]1[/b]</oid>
      </prtMarkersSupplyUsed>
   </fields>
</interface>


The changes are in bold.

I know you said that OIDs depend on printer manufacturer, but as you can see mazevedo's snmp walk looks identical to mine - both are missing the index entries (.1.3.6.1.2.1.43.11.1.1.1). Have is it then that only I was having problem.

Also after I have changed the XML file the graph is working


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 27, 2006 4:31 pm 
Offline

Joined: Thu Oct 26, 2006 11:57 am
Posts: 13
I think i imported everything in fine.. but i get this error when i try to add a printer device with snmp enabled

Warning: file(c:/Inetpub/wwwroot/cacti/resource/snmp_queries/printer_supply.xml) [function.file]: failed to open stream: Permission denied in c:\Inetpub\wwwroot\cacti\lib\data_query.php on line 79

Warning: implode() [function.implode]: Bad arguments. in c:\Inetpub\wwwroot\cacti\lib\data_query.php on line 79


any help?


Top
 Profile  
 
 Post subject:
PostPosted: Sun Oct 29, 2006 4:34 am 
Offline
Cacti User
User avatar

Joined: Wed Aug 17, 2005 8:51 am
Posts: 427
Location: UK
Would this also work for OKI printers? I've already created my own here..


Attachments:
File comment: XML files for snmp_queries
archive.zip [1.78 KiB]
Downloaded 1781 times
File comment: OKI Host template
cacti_host_template_oki_printer.xml [44.23 KiB]
Downloaded 1651 times
Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 70 posts ]  Go to page 1, 2, 3, 4, 5  Next

All times are UTC - 5 hours


Who is online

Users browsing this forum: pocobor and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Protected by Anti-Spam ACP Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group