Cacti (home)ForumsRepositoryDocumentation
Cacti: offical forums and support  

 FAQFAQ   SearchSearch   MemberlistMemberlist    RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in    


SNMP Printer Template
Goto page 1, 2, 3  Next
 
Post new topic   Reply to topic    Cacti Forum Index -> Scripts and Templates
Author Message
mazevedo



Joined: 12 Apr 2006
Posts: 3

PostPosted: Wed Apr 12, 2006 1:50 pm    Post subject: SNMP Printer Template Reply with quote

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!



SNMP Printer.zip
 Description:

Download
 Filename:  SNMP Printer.zip
 Filesize:  22.07 KB
 Downloaded:  103789 Time(s)

Back to top
gandalf
Developer


Joined: 02 Dec 2004
Posts: 11371
Location: Muenster, Germany

PostPosted: Thu Apr 13, 2006 8:33 am    Post subject: Re: SNMP Printer Template Reply with quote

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
Back to top
mazevedo



Joined: 12 Apr 2006
Posts: 3

PostPosted: Thu Apr 13, 2006 1:25 pm    Post subject: Re: SNMP Printer Template Reply with quote

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?
Back to top
gandalf
Developer


Joined: 02 Dec 2004
Posts: 11371
Location: Muenster, Germany

PostPosted: Thu Apr 13, 2006 2:43 pm    Post subject: Re: SNMP Printer Template Reply with quote

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
Back to top
mazevedo



Joined: 12 Apr 2006
Posts: 3

PostPosted: Fri Apr 14, 2006 7:35 am    Post subject: Re: SNMP Printer Template Reply with quote

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!
Back to top
gandalf
Developer


Joined: 02 Dec 2004
Posts: 11371
Location: Muenster, Germany

PostPosted: Fri Apr 14, 2006 9:04 am    Post subject: Reply with quote

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
Back to top
lucian.furtos



Joined: 05 Jun 2006
Posts: 1

PostPosted: Mon Jun 05, 2006 7:22 am    Post subject: Need some SNMP information Reply with quote

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.
Back to top
gandalf
Developer


Joined: 02 Dec 2004
Posts: 11371
Location: Muenster, Germany

PostPosted: Mon Jun 05, 2006 7:53 am    Post subject: Reply with quote

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
Back to top
/usr/local/dick



Joined: 11 May 2006
Posts: 3

PostPosted: Tue Jul 25, 2006 12:33 am    Post subject: Reply with quote

I've imported the templates and I was able to pull values from my Xerox Phaser 7750. I needed to change two OID's in printer_supply.xml to get the proper values though:

<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.1</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.1</oid>
</prtMarkersSupplyUsed>

As you can see, an extra digit was added.

However, the total number of pages graph here looks a bit strange.
I would expect a graph that would gradually climb, but mine has spikes like it is some sort of "amount/time" graph. Any idea why this is?

FYI my current no. of pages is indeed in OID .1.3.6.1.2.1.43.10.2.1.4.1.1 and is now about 220.000



totalpages.png
 Description:
total printer pages pic
 Filesize:  17.49 KB
 Viewed:  27623 Time(s)

totalpages.png


Back to top
gandalf
Developer


Joined: 02 Dec 2004
Posts: 11371
Location: Muenster, Germany

PostPosted: Tue Jul 25, 2006 11:52 am    Post subject: Reply with quote

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
Back to top
imro



Joined: 15 Jun 2006
Posts: 23

PostPosted: Tue Jul 25, 2006 2:18 pm    Post subject: Reply with quote

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.
Back to top
imro



Joined: 15 Jun 2006
Posts: 23

PostPosted: Tue Jul 25, 2006 4:36 pm    Post subject: Reply with quote

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.
Back to top
gandalf
Developer


Joined: 02 Dec 2004
Posts: 11371
Location: Muenster, Germany

PostPosted: Thu Jul 27, 2006 2:30 pm    Post subject: Reply with quote

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
Back to top
imro



Joined: 15 Jun 2006
Posts: 23

PostPosted: Fri Aug 04, 2006 10:31 am    Post subject: Reply with quote

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
Back to top
jokerz



Joined: 26 Oct 2006
Posts: 13

PostPosted: Fri Oct 27, 2006 4:31 pm    Post subject: Reply with quote

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?
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Cacti Forum Index -> Scripts and Templates All times are GMT - 5 Hours
Goto page 1, 2, 3  Next
Page 1 of 3

 



Powered by phpBB © 2001, 2005 phpBB Group