1833758 Members
2331 Online
110063 Solutions
New Discussion

Printer Information

 
SOLVED
Go to solution
Regina Mitchell
Frequent Advisor

Printer Information

I have a N4000, OS 11i. I am asked the following information.
1. Provide a list of printers that are currently defined on this server that either:
a) are no longer valid;
b) are offline;
c) cannot be pinged.

I'm not experienced at scripting. Is there an easy way to get this information. I had planned to use lpstat -p and use all the printers that are disabled to satisfy this request. Any other ideas?
4 REPLIES 4
Geoff Wild
Honored Contributor
Solution

Re: Printer Information

Here's a script I use - called lpst

#!/bin/sh
#
# check printer status
# Geoff Wild

if [ $# -lt 1 -o \( $# -gt 1 -a $# -lt 4 \) ]
then
echo "Usage:"
echo "lpst \"printer\""
echo "Example:"
echo "lpst W052"
exit 1
fi
echo " "
/usr/sbin/ping $1 -n 2
echo " "
lpstat -p$1 -v$1
echo " "
echo "Output Requests"
echo "-----------------------------------------------------------"
lpstat -o$1
echo " "
lpstat -r
echo " "


Example:

lpst W052

PING myprinter.mydomain.com: 64 byte packets
64 bytes from 192.168.2.101: icmp_seq=0. time=7. ms
64 bytes from 192.168.2.101: icmp_seq=1. time=7. ms

----myprinter.mydomain.com PING Statistics----
2 packets transmitted, 2 packets received, 0% packet loss
round-trip (ms) min/avg/max = 7/7/7

printer W052 is idle. enabled since May 14 10:00
fence priority : 0
device for W052: /dev/null

Output Requests
-----------------------------------------------------------
no entries

scheduler is running


To tell if it is offline:

hpnpadmin -v PRINTQUEUENAME

Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Andy Torres
Trusted Contributor

Re: Printer Information

Here's a simple ping test I use to test all our JetAdmin printers.

==============================================================
lpstat -p | grep -v priority | awk '{print $2}' | while read PRINTER
do
IP=`cat /etc/lp/interface/$PRINTER | grep PERIPH= | awk -F = '{print $2}' | grep -v MODEL`
ping $IP -n 1 > /dev/null 2>&1
if [ $? = 0 ]
then echo "I can ping $PRINTER"
else echo "I cannot ping $PRINTER"
fi
done
==============================================================
Regina Mitchell
Frequent Advisor

Re: Printer Information

I was able to run a script to ping against all of the printers. A majority of the printers are network printers. I know some network printers are valid and yet they are not pingable. Some are pingable.

Could it be maybe a firewall or something that is preventing me from pinging?
Andy Torres
Trusted Contributor

Re: Printer Information

If you know a printer should be good but still can't ping it, compare it to other printers you can't get to and see if they are on the same or different subnet.

If they're on the same subnet then I'd suspect a connectivity problem with those particular printers.

If they all seem to be on the same subnet, I'd start looking for either a routing issue or something missing from network configuration.