root / pykota / trunk / README @ 1491

Revision 1491, 17.2 kB (checked in by jalet, 20 years ago)

Note for poor LPRng users.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1# $Id$
2
3PyKota - Print Quota for CUPS and LPRng
4
5(c) 2003-2004 Jerome Alet <alet@librelogiciel.com>
6This program is free software; you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation; either version 2 of the License, or
9(at your option) any later version.
10
11This program is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with this program; if not, write to the Free Software
18Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
19
20====================================================================
21
22   NOTE FOR LPRNG USERS :
23   
24     FROM MAY 21ST 2004 ON, AND UNTIL THIS NOTE IS REMOVED
25     FROM THIS FILE, PYKOTA CAN'T BE USED ANYMORE WITH LPRNG.
26     
27     SUPPORT FOR LPRNG SHOULD BE RE-ADDED SOON WHEN A HUGE REWRITE
28     OF SOME PARTS OF PYKOTA WILL HAVE TAKEN PLACE
29
30====================================================================
31
32READ SPECIAL LICENSING AND REDISTRIBUTION TERMS IN THE FILE 'LICENSE'
33
34====================================================================
35
36PyKota features :
37-----------------
38
39    Operating systems :
40   
41        - Any Unix-like system as print server.
42           
43        - Any operating system as client.
44           
45    Printing systems :
46   
47        - Supports both CUPS and LPRng as the printing system.
48           
49    Databases :
50   
51        - Supports PostgreSQL as the Quota Storage backend.
52          Complete database creation script in SQL is included.
53       
54        - Supports OpenLDAP as the Quota Storage backend.
55          Complete LDAP schema and sample empty tree are included.
56          Plugging PyKota into your existing LDAP infrastructure
57          is really easy thanks to PyKota's great configurability.
58           
59    Printers :       
60   
61        - Hardware or Software accounting methods are completely
62          configurable.
63         
64        - Supports any printer which can report its internal
65          page counter. Can ask printers for their internal
66          page counter via SNMP, Netatalk, or any other way.
67          This is completely configurable.
68         
69        - Supports PostScript and PCL5 printers natively,
70          more formats to come.
71         
72        - Supports any other printer via GhostScript.
73          Depending on the printer some configuration may
74          be needed.
75           
76    Quota systems :       
77   
78        - Supports printers and printers groups quotas.
79       
80        - Supports users and users groups quotas.
81       
82        - Supports page quotas.
83          Page quotas can be set differently on a per printer
84          and per user/group basis.
85       
86        - Supports account balance quotas in any currency.
87          Account balance quotas can be set on a per user
88          basis. The account balance is shared amongst
89          all printers.
90         
91        - Page quota and account balance can be set/reset
92          independantly.
93         
94        - Limiting factor, page quota or account balance, 
95          can be set on a per user or per group basis.
96         
97        - Price per page and per job can be set differently 
98          on any printer.
99       
100        - Low level of page quota or account balance are
101          configurable.
102         
103        - Both soft and hard limit with configurable grace delay 
104          can be set for page quota.
105         
106        - Possibility to disable quota enforcement for any user
107          or group, while still keeping page accounting.
108             
109    Administration :       
110   
111        - Powerful administration tools can be used to
112          automate setting or resetting of quotas or
113          account balances at specific intervals.
114         
115        - Administration tools can modify several users, 
116          groups, or printers at once.
117         
118        - Account balances can be set, incremented, or 
119          decremented.
120         
121        - Both printers and users can be automatically added on
122          first print in a completely configurable way.
123         
124        - Quota report generator available either from the 
125          command line or in any web browser.
126          The web-based quota report generator can be
127          user/password protected.
128         
129        - Print quote generator can tell users how much 
130          a print job will cost them in advance.
131         
132        - Policy with regard to unregistered users can   
133          be configured for each printer to either deny
134          printing, allow printing, or delegate the
135          decision to any external tool.
136         
137        - Warning and error messages can be automatically 
138          sent via email to the administrator, the user,
139          both, or none.
140         
141        - Warning and error messages' content is completely
142          configurable.
143         
144        - Configuration can be changed without needing to 
145          restart the printing system.
146       
147        - Complete print job history is kept. This can be
148          disabled if needed.
149         
150        - Automated low quota or balance remainder can be
151          scheduled regularly or launched manually.
152         
153    User Interface :         
154   
155        - All the command line tools accept the -h | --help
156          command line option which prints all the available
157          options and show usage examples.
158         
159        - Completely internationalized. Actually supports the 
160          English, French, Spanish, Portuguese, Brasilian, Swedish
161          and Italian languages. More to come.
162
163====================================================================
164       
165Planned features are described in the TODO file.
166
167Actually three (or an infinity of) page accounting methods are
168implemented :
169
170  - The 'hardware' method consists in querying the printer (via SNMP
171    or Netatalk or any other method of your choice) for its total pages
172    counter.
173   
174    With CUPS, this is done both at the beginning and at the end of a
175    print job. The counters difference is then immediately used to
176    decrease the user's account balance or increase his quota usage.
177   
178    With LPRng, this is done just before the beginning of a job, and used
179    this to modify the *preceding* user's quota. So you're always late
180    of one print job, but this is generally ok.
181   
182  - The 'software' method consists in delegating the computation of the
183    job's size in number of pages to any external command of your choice.
184    The command can read the job's data from its standard input and MUST
185    output the job's size on its standard output. Changes to the user
186    account are reported immediately, both with CUPS and LPRng.
187   
188PyKota is known to work fine with HP Laserjet 2100 and 2200, and
189Apple LaserWriter 16/600 PS, both with CUPS and LPRng, under
190Debian GNU/Linux (Sarge and Sid) operating systems. It should work
191fine with most network printers.
192
193============================================================
194
195INSTALLATION:
196=============
197
198NB :
199====
200
201  You may learn more about PyKota, if it fits your own organization,
202  its internal working, and some potential performance drawbacks and
203  how to avoid them, in a WiKi administered by Ryan Suarez at :
204 
205    http://webcrossing.macosxlabs.org/webx?14@30.QAu3a5k0c4z.7@.26bf4661
206
207Prerequisite :
208--------------
209   
210  You need to have the following tools installed on the CUPS Server :
211 
212    - CUPS or LPRng
213    - Python v2.1 or above
214    - eGenix' mxDateTime Python extension
215    - SNMP tools (specifically the snmpget command) if you plan to
216      request your printer's lifetime page counter via SNMP.
217    - Netatalk (specifically the pap command) if you plan to
218      request your printer's lifetime page counter via AppleTalk.
219    - PostgreSQL's PygreSQL Python extension and the PostgreSQL client
220      libraries if you plan to use PostgreSQL as the Quota Storage
221      backend.
222 or     
223    - python-ldap Python module and the OpenLDAP client libraries 
224      if you plan to use OpenLDAP as the Quota Storage backend.
225   
226  You may also benefit from having the following tools installed to
227  deal with some printers :
228 
229    - npadmin
230    - netcat
231    - ghostscript
232   
233  You need to have the following tools installed on the Quota Storage 
234  Server :
235 
236    - PostgreSQL
237   
238  or 
239 
240    - OpenLDAP
241   
242NB :   
243
244  PygreSQL must be linked with the PostgreSQL client libraries on
245  the Print Server. The PostgreSQL client libraries' version must
246  match the PostgreSQL version used on the Quota Storage Server.
247  BEWARE : under Debian Sarge, as of March 15th 2004, there's a
248  problem with python2.2-pygresql and python-2.3-pygresql, so please
249  install python2.1-pygresql and use Python 2.1 to install and run
250  PyKota. This is not a bug in PyKota, and this should be fixed
251  by Debian in a few days I hope.
252 
253or 
254
255  python-ldap must be linked with the OpenLDAP client libraries on the
256  Print Server. The OpenLDAP client libraries' version must match the
257  OpenLDAP version used on the Quota Storage Server.
258 
259  This list of prerequisite software may change in the future, when
260  PyKota will support more functionnalities you will be given
261  alternatives.
262 
263  Of course the Print Server and the Quota Storage Server can be the
264  very same machine if you've got a tiny network, or you can have
265  multiple Print Servers all storing their quotas on the same Quota
266  Storage Server if you've got a bigger network.
267 
268Then :   
269------
270 
271Download the latest PyKota version from the CVS tree on :
272
273    http://savannah.nongnu.org/projects/pykota
274
275Just type :
276
277    python setup.py install
278
279You may need to be logged in with sufficient privileges (e.g. root)
280
281The installation script will now automatically check if some software
282is missing and ask you if you still want to proceed with the
283installation or abort it completely.
284
285Go to the initscripts subdirectory of PyKota's sources, and choose
286the appropriate storage backend for your configuration. Read
287the associated README file and execute the initialization script
288to create an empty PyKota Storage. Upgrade scripts may be
289provided as well.
290
291Copy the conf/pykota.conf.sample and  conf/pykotadmin.conf.sample
292sample configuration files to /etc/pykota/pykota.conf and
293/etc/pykota/pykotadmin.conf. The installation script tries to do
294this for you if needed and you agreed to this action. You need to
295adapt these files to your own needs. Especially you have to create
296sections named after your own printers, and change the
297administrator's email address which by default is root@localhost.
298Read and try to understand these two very well commented files,
299so that you'll encounter less problems later.
300
301Also be sure to double check that commands that query printers
302for their internal page counter work from the command line
303before using them in PyKota's configuration.
304
305The rest of the installation depends on your printing system :
306
307  - CUPS Printing System :
308 
309    Once and for all :
310   
311        Create a symbolic link to the cupspykota backend
312        in CUPS's backend directory :
313       
314          $ cd /usr/lib/cups/backend
315          $ ln -s /usr/share/pykota/cupspykota cupspykota
316         
317        Restart CUPS so that the new backend can be detected.
318       
319          $ /etc/init.d/cupsys restart
320         
321    For dumb printers :
322   
323        The FAQ contains both the PyKota's definition of a 'dumb'
324        printer, and how to deal with them.
325   
326    For new printers :
327   
328        Go to CUPS management interface (http://localhost:631)
329        and choose the appropriate PyKota managed device depending
330        on the type of printer you use. For example, if your
331        printer is waiting on :
332       
333            socket://myprinter.example.com:9100
334           
335        Then choose :   
336       
337            cupspykota:socket://myprinter.example.com:9100
338           
339        Configure your printer as usual.   
340       
341        Now double check /etc/pykota/pykota.conf
342        This file should contain a section named after the
343        printer you've just added, unless you have set
344        all options globally.
345        The new pkhint command can help you with correct settings
346        for your printers, but don't rely on it because it is still
347        incomplete.
348       
349        That's all.
350   
351    For existing printers :
352   
353        If you had already installed a version of PyKota earlier
354        than 1.16alpha7, then remove the *cupsFilter lines in your
355        PPD files for each printer already managed printers. Each
356        line to remove is of the form :
357       
358          *cupsFilter: "application/vnd.cups-postscript 0 /usr/share/pykota/pykota"
359       
360        This means that each time the pstops filter will be executed, it will
361        pass the job's data through the pykota filter which is present in
362        /usr/share/pykota
363       
364        Don't touch anything else, especially any other *cupsFilter line.
365        Then save each of these files.
366       
367        Then, the easiest is to directly modify the DeviceURI lines
368        in /etc/cups/printers.conf, you just have to put
369        'cupspykota:' in front of what is already on these lines.
370        For example, replace :
371   
372            DeviceURI socket://myprinter.example.com:9100
373       
374        with :   
375   
376            DeviceURI cupspykota:socket://myprinter.example.com:9100
377           
378        or :   
379       
380            DeviceURI cupspykota://socket://myprinter.example.com:9100
381       
382        Save the file and restart CUPS.
383
384  - LPRng Printing System :
385 
386    Modify the /etc/printcap file to add two lines identical to these ones :
387   
388    :achk=true
389    :as=|/usr/share/pykota/pykota
390   
391    For each printer on which you want to use print accounting.
392   
393    And then save the file and restart LPRng :
394   
395        $ /etc/init.d/lprng restart
396       
397Now you can begin to populate the PyKota's database with printers,
398users and groups :
399 
400Add printers and users to the quota system and set their quota values :
401
402Starting from version 1.18alpha2, the preferred command to manage
403printers is named pkprinters
404
405    $ pkprinters --help
406   
407    will tell you how to create, manage or delete printers and
408    printers groups.
409   
410    $ pkprinters --add --charge 0.05 hp2100
411   
412    would add the printer named hp2100 with a price per page
413    of 0.05 unit.
414
415Now set quotas for users on this printer :     
416
417    $ edpykota --add -P hp2100 -S 40 -H 50 user1 ... userN
418       
419    launching edpykota without any argument or with the --help
420    command line option will show you all the possibilities.
421   
422    by default, each user is limited by "quota", this means that on
423    each printer he can have a different soft and hard limit.
424    You may want to limit the user by his account balance value,
425    in which case, the print quota is shared between all printers
426    instead of being different. To do this, use the following :
427   
428    $ edpykota --add -P hp2100 --limitby balance --balance 10 user1 ... userN
429   
430    This will put 10 $ (or Euros, PyKota doesn't care) on each user's account
431    balance, and tell PyKota to limit them by their account balance value.
432    Whenever they print on any printer, their account balance value is
433    decreased by an amount which depends on the particular price per page
434    and per job that you may have defined on the printer with edpykota's
435    --charge command line option.
436    Soft and Hard limits are not used if "--limitby balance" is used,
437    but you can define a "poorman"'s threshold in /etc/pykota/pykota.conf
438    to obtain a similar result (warning message when quota is low).
439
440Restart CUPS or LPRng, for example under Debian GNU/Linux systems :         
441
442    $ /etc/init.d/cupsys restart
443   
444  or :
445 
446    $ /etc/init.d/lprng restart
447       
448Your users now should be able to print but not exceed their
449printing quota.
450
451To see printer quota usage, you can use :
452
453    $ repykota --printer lp
454   
455or :
456
457    $ repykota
458   
459    which will print quota usage for all users on all printers,
460    along with totals, if you are the root user. If you are
461    a regular user, only your own quota report will be produced.
462   
463Quota reports are also available remotely by using the CGI script
464printquota.cgi provided in the cgi-bin/ subdirectory. You can
465also use the CSS stylesheet present in the stylesheets/ subdirectory
466and put it at your web server's DocumentRoot, to benefit from a nicer
467look, especially quota violations will appear in different colors.
468
469For different security concerns, please give a look at the SECURITY
470file which is part of this software.
471           
472============================================================
473
474Mailing list :
475--------------
476
477  A mailing list is dedicated to Pykota, you can subscribe to it
478  or consult its archives at :
479 
480    http://cgi.librelogiciel.com/mailman/listinfo/pykota
481   
482IRC :   
483-----
484
485  You can also chat with us :
486 
487        /server irc.freenode.net
488        /join #pykota
489   
490============================================================
491   
492Please e-mail bugs to the mailing list at : pykota@librelogiciel.com
493or to the main author at : alet@librelogiciel.com (Jerome Alet)
Note: See TracBrowser for help on using the browser.