>Date: Wed, 23 Sep 1998 21:40:38 -0500
>From: "Daryl L. Biberdorf" <darylb@superserve.com>
>To: samba@samba.anu.edu.au
>Subject: Pages printed
>Message-ID: <3.0.5.32.19980923214038.00816310@pop.a001.sprintmail.com>
>
>We have the need to track printer usage (pages used).
>Right now, my Samba printer share defines the print command
>as "print command = lpr -Pprinter.domain.edu -r %s"
>(The printer is a LaserJet 4000N, with the JetDirect card and
>its built-in LPD server.)
>
>What is the best way to figure out how much paper a given
>user printed?
>
>Daryl
>Daryl Biberdorf darylb@superserve.com
>
Hi daryl,
ok here's the problem. The number of pages printed is a pain b/c
nothing knows that until the printer's has finished. you can setup a
print command to log the file size the user printed and you can do some
guestimations on that but if you are using samba as a printing pass thru
(meaning your lpd just redirects to the lpd of the hp4000N) then there
aren't many good ways of knowing how much someone is printing.
if you are using linux there might be one way to do it.
there is a program called npadmin. (it's available under the GPL from cisco)
It can get the pagecount number from the printer (direct over snmp)
you can set up a script that gets the current num of pages printed, then
gets prints the doc, then gets the num of pages printed and subtracts b/t
the two to check how many pages were printed. The reason this will work is
that the lpd on the hp only allows 1 connection at a time. So you do all
this work at one point. You may have to play around with delays and such but
I see no reason why it shouldn't work.
it would look at little like this.
#!/bin/sh
#pagecounter
BEFOREPAGES=`npadmin --pagecount {printer ipaddress)`
lpr -Pprintername -r %s
AFTERPAGES=`npadmin --pagecount {printer ipaddress)`
TOTAL = `expr $BEFOREPAGES - $AFTERPAGES`
then you echo out TOTAL with usersnames etc etc to a log (with logger
preferrably)
that should help somewhat.
good luck
-sv