Operating System - HP-UX
1748119 Members
3298 Online
108758 Solutions
New Discussion юеВ

Re: Determine if IP address belongs to printer

 
Mel Burslan
Honored Contributor

Determine if IP address belongs to printer

I need to sift through a huge list of IP addresses, in the order of 1000 or slightly more and determine if any one of these belong to a printer, mostly, an HP printer.

I have snmpwalk command available but without specifying an output class, the information it gives out is extremely large. I tried

snmpwalk system on a couple of the IP addresses but did not come up with a pattern which can tell me if this address belongs to a printer or not.

Is there a way to easily accomplish this ? I am okay downloading a piece of opensource software if the need be. Or if there is any other way to obtain this information, other than snmpwalk, I am okay with that too.

Thanks for all the answers in advance.
________________________________
UNIX because I majored in cryptology...
5 REPLIES 5
TTr
Honored Contributor

Re: Determine if IP address belongs to printer

Take a look at the "rptrcfg node/ip" command in /opt/hpnpl/bin. It uses snmp and reports a printer status. Its output might be easier to deal with than that of snmpwalk.
Mel Burslan
Honored Contributor

Re: Determine if IP address belongs to printer

Maybe it is my system but I can not find any executable named rptrcfg under /opt/hpnpl/bin. Do you know by any chance where you got yours ?
________________________________
UNIX because I majored in cryptology...
Autocross.US
Trusted Contributor

Re: Determine if IP address belongs to printer

I'm not that familiar with snmpwalk, but running this on my system:

/opt/OV/bin/snmpwalk system

returns several lines of which the words JETDIRECT and printer are returned. With that, i wrote a little perl script:

#!/bin/perl

# File w/ list of IP addresses
$IPLIST = "./iplist";

open(IPLIST, "< $IPLIST");
while () {
chomp;
chomp($SNMPWALK = `/opt/OV/bin/snmpwalk $_ system 2> /dev/null`);
if ($SNMPWALK =~ /JETDIRECT|printer/i) {
print "$_ is printer\n";
}
}
close(IPLIST);

It seemed to work for the 3 printers in my test. HTH,
I drive way too fast to worry about calories.
TTr
Honored Contributor

Re: Determine if IP address belongs to printer

The rptrcfg is part of hppi which is the jetadmin software for HP-UX. I assumed that since you have jetdirect printers you have hppi installed. The hppi software is at

http://h20000.www2.hp.com/bizsupport/TechSupport/Home.jsp?locale=en_US&prodTypeId=18972&prodSeriesId=27349
Bill Hassell
Honored Contributor

Re: Determine if IP address belongs to printer

> Maybe it is my system but I can not find any executable named rptrcfg under /opt/hpnpl/bin. Do you know by any chance where you got yours ?

Are you running a very old copy of hppi? A reasonably current version is E.10.34 and will have rptrcfg. However, it is really designed for printer-specific features. Just use hpnpadmin (also in /opt/hpnpl/bin) and run through all the addresses. If there is an HP printer (or printers that support the HP JetDirect protocol), you will see:

# hpnpadmin hplj4
Printer State : ready to print

This is the simplest output. Or for more details, check the man page for hpnpadmin. NOTE: All versions of hppi and even the obsolete jetadmin software have the hpnpadmin command. If you get: command not found, update your PATH in .profile or for everyone, in /etc/PATH, with: /opt/hpnpl/bin

hpnpadmin will return immediately for JetDirect interfaces, but will timeout for computers and non-HP interfaces. Check the man page for all the information that can be gathered. hpnpadmin -v gives a *lot* of information. Note that not every printer (especially older models) will report detailed descriptions:

# hpnpadmin -i hplj4
Printer Description:
--------------------

Printer ID : 3


Bill Hassell, sysadmin