| 189 | # In the lines below "%(printer)s" is automatically replaced |
| 190 | # at run time with your printer's Fully Qualified Domain Name |
| 191 | # for network printers. |
| 192 | # e.g. myprinter.example.com |
| 193 | # |
| 194 | # Example : |
| 195 | # |
| 196 | # accounter: hardware(/usr/bin/snmpget -v1 -c public -Ov %(printer)s mib-2.43.10.2.1.4.1.1 | cut -f 2,2 -d " ") |
| 197 | # |
| 198 | # Another untested example, using npadmin : |
| 199 | # |
| 200 | # accounter: hardware(/usr/bin/npadmin --pagecount %(printer)s) |
| 201 | # |
| 202 | # Another example, for AppleTalk printers which works fine : |
| 203 | # (You may need the pap CUPS backend installed, and copy the |
| 204 | # pagecount.ps file from untested/netatalk into /etc or any |
| 205 | # appropriate location) |
| 206 | # |
| 207 | # accounter: hardware(/usr/share/pykota/papwaitprinter.sh "MyPrinter:LaserWriter@*" && /usr/bin/pap -p "MyPrinter:LaserWriter@*" /usr/share/pykota/pagecount.ps 2>/dev/null | /bin/grep -v status | /bin/grep -v Connect | /usr/bin/tail -1) |
| 208 | # |
| 209 | # An example for parallel printers like the HP Laserjet 5MP : |
| 210 | # |
| 211 | # accounter: hardware(/bin/cat /usr/share/pykota/pagecount.pjl >/dev/lp0 && /usr/bin/head -2 </dev/lp0 | /usr/bin/tail -1) |
| 212 | # |
| 213 | # This value can be set either globally or per printer or both. |
| 214 | # If both are defined, the printer option has priority. |
| 215 | # |
| 216 | # Some examples and comments provided by Bob Martel from csuohio.edu |
| 217 | # |
| 218 | # For several printers I could not get the page count using snmpget. I |
| 219 | # resorted to snmpwalk: |
| 220 | # |
| 221 | # accounter: hardware(/opt/local/net-snmp/bin/snmpwalk -v 1 -Cc -c public %(printer)s | grep mib-2.43.10.2.1.4.1.1 | cut -d " " -f4) |
| 222 | # |
| 223 | # The last example is still more ugly, some of the printers only provided |
| 224 | # their counters without names, but at least always on the same line: |
| 225 | # |
| 226 | # accounter: hardware(/opt/local/net-snmp/bin/snmpwalk -v 1 -Cc -c public -Ov %(printer)s | grep Counter32 | tail -2 | head -1 | cut -d " " -f2) |
| 227 | # |
| 228 | # An example using netcat and a preformatted PJL job which you can find |
| 229 | # in the untested/pjl directory, which is sent to a JetDirect print |
| 230 | # server on port 9100 : |
| 231 | # |
| 232 | # accounter: hardware(/bin/nc -w 2 %(printer)s 9100 </usr/share/pykota/pagecount.pjl | /usr/bin/tail -2) |
| 233 | # |
| 234 | # An example using the contributed pagecount.pl script which does |
| 235 | # the same as above, but should work on more printers : |
| 236 | # |
| 237 | # accounter: hardware(/usr/share/pykota/pagecount.pl %(printer)s 9100) |
| 238 | # |
| 239 | # WARNING : In any case, when using an hardware accounter, please test the command line outside |
| 240 | # of PyKota before. This will save you some headaches in case it doesn't work as expected. |
| 241 | # |
| 242 | # The waitprinter.sh is there to wait until the printer is idle again. |
| 243 | # This should prevent a job to be sent to the printer while another one is |
| 244 | # not yet finished (not all pages are printed, but the complete job is in |
| 245 | # the printer) |
| 246 | # |
| 247 | # YOU ABSOLUTELY HAVE TO BE SURE YOU HAVE A SCRIPT WHICH WAITS FOR THE |
| 248 | # PRINTER BEING READY BEFORE ASKING FOR ITS INTERNAL PAGE COUNTER. |
| 249 | # |
| 250 | # PYKOTA INCLUDES SUCH SCRIPTS FOR SNMP AND APPLETALK PRINTERS, MORE TO COME |
| 251 | # |
| 252 | # SOME OF THE ABOVE EXAMPLES DON'T USE SUCH A SCRIPT, YOU HAVE BEEN WARNED |
| 253 | # |
| 254 | # |
319 | | # How to query the hpmarketing printer for its page counter. |
320 | | # THIS IS ONLY USED IF YOU HAVE SET 'accounter' TO 'hardware' |
321 | | # JUST COMMENT IT OUT IF YOU USE ANY OTHER ACCOUNTING METHOD. |
322 | | # (it would be ignored anyway) |
323 | | # |
324 | | # In the lines below "%(printer)s" is automatically replaced |
325 | | # at run time with your printer's Fully Qualified Domain Name |
326 | | # for network printers. |
327 | | # e.g. myprinter.example.com |
328 | | # |
329 | | # Only value supported is : external(... your command here...) |
330 | | # |
331 | | # Example : |
332 | | # |
333 | | # requester: external(/usr/bin/snmpget -v1 -c public -Ov %(printer)s mib-2.43.10.2.1.4.1.1 | cut -f 2,2 -d " ") |
334 | | # |
335 | | # Another untested example, using npadmin : |
336 | | # |
337 | | # requester: external(/usr/bin/npadmin --pagecount %(printer)s) |
338 | | # |
339 | | # Another example, for AppleTalk printers which works fine : |
340 | | # (You may need the pap CUPS backend installed, and copy the |
341 | | # pagecount.ps file from untested/netatalk into /etc or any |
342 | | # appropriate location) |
343 | | # |
344 | | # requester: external(/usr/share/pykota/papwaitprinter.sh "MyPrinter:LaserWriter@*" && /usr/bin/pap -p "MyPrinter:LaserWriter@*" /usr/share/pykota/pagecount.ps 2>/dev/null | /bin/grep -v status | /bin/grep -v Connect | /usr/bin/tail -1) |
345 | | # |
346 | | # An example for parallel printers like the HP Laserjet 5MP : |
347 | | # |
348 | | # requester: external(/bin/cat /usr/share/pykota/pagecount.pjl >/dev/lp0 && /usr/bin/head -2 </dev/lp0 | /usr/bin/tail -1) |
349 | | # |
350 | | # This value can be set either globally or per printer or both. |
351 | | # If both are defined, the printer option has priority. |
352 | | # |
353 | | # Some examples and comments provided by Bob Martel from csuohio.edu |
354 | | # |
355 | | # For several printers I could not get the page count using snmpget. I |
356 | | # resorted to snmpwalk: |
357 | | # |
358 | | # requester: external(/opt/local/net-snmp/bin/snmpwalk -v 1 -Cc -c public %(printer)s | grep mib-2.43.10.2.1.4.1.1 | cut -d " " -f4) |
359 | | # |
360 | | # The last example is still more ugly, some of the printers only provided |
361 | | # their counters without names, but at least always on the same line: |
362 | | # |
363 | | # requester: external(/opt/local/net-snmp/bin/snmpwalk -v 1 -Cc -c public -Ov %(printer)s | grep Counter32 | tail -2 | head -1 | cut -d " " -f2) |
364 | | # |
365 | | # An example using netcat and a preformatted PJL job which you can find |
366 | | # in the untested/pjl directory, which is sent to a JetDirect print |
367 | | # server on port 9100 : |
368 | | # |
369 | | # requester: external(/bin/nc -w 2 %(printer)s 9100 </usr/share/pykota/pagecount.pjl | /usr/bin/tail -2) |
370 | | # |
371 | | # An example using the contributed pagecount.pl script which does |
372 | | # the same as above, but should work on more printers : |
373 | | # |
374 | | # requester: external(/usr/share/pykota/pagecount.pl %(printer)s 9100) |
375 | | # |
376 | | # WARNING : In any case, when using an external requester, please test the command line outside |
377 | | # of PyKota before. This will save you some headaches in case it doesn't work as expected. |
378 | | # |
379 | | # The waitprinter.sh is there to wait until the printer is idle again. |
380 | | # This should prevent a job to be sent to the printer while another one is |
381 | | # not yet finished (not all pages are printed, but the complete job is in |
382 | | # the printer) |
383 | | # |
384 | | # YOU ABSOLUTELY HAVE TO BE SURE YOU HAVE A SCRIPT WHICH WAITS FOR THE |
385 | | # PRINTER BEING READY BEFORE ASKING FOR ITS INTERNAL PAGE COUNTER. |
386 | | # |
387 | | # PYKOTA INCLUDES SUCH SCRIPTS FOR SNMP AND APPLETALK PRINTERS, MORE TO COME |
388 | | # |
389 | | # default value |
390 | | requester: external(/usr/share/pykota/waitprinter.sh %(printer)s && /usr/bin/snmpget -v1 -c public -Ov %(printer)s mib-2.43.10.2.1.4.1.1 | cut -f 2,2 -d " ") |