Operating System - HP-UX
1832567 Members
5110 Online
110043 Solutions
New Discussion

Number of pages printed in HPUX

 
SOLVED
Go to solution
R.O.
Esteemed Contributor

Number of pages printed in HPUX

Hello,

I have an HPUX 11.00, with some remote and net printers. I want to make a report with:
- Number of pages printed by printer
- bytes transmitted
- jobs printed

Does anybody knows how to do this??

regards
"When you look into an abyss, the abyss also looks into you"
3 REPLIES 3
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: Number of pages printed in HPUX

One method would be to add a function to each interface file in /var/spool/lp/interface/printername.

The args supplied to each interface are
$1 - printer name
$2 - request id
$3 - user
$4 - title
$5 - number of copies
$6 - options

file1 file2 ....

you could use wc on each file to count bytes BUT this fails if stdin is used because you are now reading from a pipe. You would have to detect if the file is not a regular file and then use the tee command to feed wc and the rest of the normal lp stuff.

NOTE: UNIX has absolutely no concept of pages; you would have to either count lines or detect FF's (if they occur before your pagelength is reached).

Now the really bad news - all of this utterly fails if thrown binary/raw data; the bottom line: there is no way to do this without making some very limiting assumptions.
If it ain't broke, I can fix that.
Bill Douglass
Esteemed Contributor

Re: Number of pages printed in HPUX

For page counts, it would be best to get it directly from the printer. For LaserJets, You could grap this using lynx to pull it from the printer's web interface.

# of jobs transmitted can be determined from the log files /var/adm/lp/log and /var/adm/lp/ld.log (if enabled).

For bytes transferred, you would need to modify your printer scripts to record the file size in the log files.
Bill Hassell
Honored Contributor

Re: Number of pages printed in HPUX

As mentioned, the concept of pages is totally meaningless with today's printers. Back in the good old days of line printers with green bar paper, all that was printed was plain ASCII (or EBCDIC) text. This you could look through the text and predict the number of pages by counting lines. However, today's laser and inkjet printers don't print 6 or 8 lpi, 66 or 88 lines per page. Instead, application programs send pictures, fonts of varying sizes and non-printing data like macros.

So the printer is the only choice for the page count. And the byte count is not meaningful at all. There might be 10Kbytes of fonts loaded into the printer as part of the job but only a few characters on one page will be printed.

Note that a remote printer will be impossible to monitor from a client (ie, HP-UX sending a print job to an NT server) and only the very newest printers HP JetDirect cards have a web interface. Many deskjet printers do not return page information and older LaserJet printers cannot return any stats at all.

I'm sure that this is a request by management to monitor costs and perhaps send a bill at the end of the month. The effort to provide an accurate bill for each printer sorted by user will be enormous, thus eliminating any savings that such bills might produce. This is really a social engineering problem where user education and peer pressure is a lot more effective.

The alternative is to create a single print server with commercial billing software but now all jobs must go through the billing server--which means this server cannot go down!


Bill Hassell, sysadmin