in reply to Re: Where is the bug in this Net::SNMP code?
in thread Where is the bug in this Net::SNMP code?

monarch
Prompt how to take data from .1.3.6.1.2.1.25.3.5.1.2 if it OCTET STRING
hrPrinterDetectedErrorState OBJECT-TYPE SYNTAX OCTET STRING MAX-ACCESS read-only STATUS current DESCRIPTION "This object represents any error conditions detected by the printer. The error conditions are encoded as bits in an octet string, with the following definitions: Condition Bit # lowPaper 0 noPaper 1 lowToner 2 noToner 3 doorOpen 4 jammed 5 offline 6 serviceRequested 7 inputTrayMissing 8 outputTrayMissing 9 markerSupplyMissing 10 outputNearFull 11 outputFull 12 inputTrayEmpty 13 overduePreventMaint 14 Bits are numbered starting with the most significant bit of the first byte being bit 0, the least significant bit of the first byte being bit 7, the most significant bit of the second byte being bit 8, and so on. A one bit encodes that the condition was detected, while a zero bit encodes that the condition was not detected. This object is useful for alerting an operator to specific warning or error conditions that may occur, especially those requiring human intervention." -- 1.3.6.1.2.1.25.3.5.1.2 ::= { hrPrinterEntry 2 }
It is possible an example of a code?
Please help me out. thanks in advance.

Replies are listed 'Best First'.
Re^3: Where is the bug in this Net::SNMP code?
by monarch (Priest) on Oct 10, 2006 at 11:52 UTC
    It appears you have little understanding of SNMP in general. The hrPrinterDetectedErrorState object is defined in RFC1759 (the RFC is more readable at this link).

    I presume you wish to poll printer information using SNMP.

    I assume that

    • the IP address you're polling is that of a printer
    • you don't need to know the name of the printer
    • you just want the information from the printer

    You want to poll two objects. From the RFC:

    This is a table, indexed by two integers.

    To read this table I would do the following:

    The output I get when querying the printer on my local LAN is:

    C:\temp>perl -w checkprintercover.pl Cover description: Copier cover status: doorClosed(4) Cover description: Finisher cover status: doorClosed(4)
      extracted from rfc2790.txt
      Hi all. I neew you wisdom. I'm going to pool status information from network printers. I'm using code:
      foreach my $k (@ips) { my $hostname = "10.0.0.$k"; my $password = "public"; my ( $session, $error ) = Net::SNMP->session ( Hostname => $hostname, +Community => $password , Version => 1 ); if (!defined($session)) { printf("ERROR: %s.\n", $error); next; } }
      in @ips I have last octet of IP's The problem is if one of the printer is swiched off the programm break Could you tell me what I'm doing wrong? Thanks in advance!