root / pykota / trunk / README @ 1689

Revision 1689, 19.4 kB (checked in by jalet, 20 years ago)

Typo

  • 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
22READ SPECIAL LICENSING AND REDISTRIBUTION TERMS IN THE FILE 'LICENSE'
23
24====================================================================
25
26PyKota features :
27-----------------
28
29    Operating systems :
30   
31        - Any Unix-like system as print server.
32           
33        - Any operating system as client.
34           
35    Printing systems :
36   
37        - Supports both CUPS and LPRng as the printing system.
38       
39    Databases :
40   
41        - Supports PostgreSQL as the Quota Storage backend.
42          Complete database creation script in SQL is included.
43       
44        - Supports OpenLDAP as the Quota Storage backend.
45          Complete LDAP schema and sample empty tree are included.
46          Plugging PyKota into your existing LDAP infrastructure
47          is really easy thanks to PyKota's great configurability.
48           
49    Printers :       
50   
51        - Hardware or Software accounting methods are completely
52          configurable.
53         
54        - Supports any printer which can report its internal
55          page counter. Can ask printers for their internal
56          page counter via SNMP, Netatalk, PJL, PS, or any
57          other way.
58          This is completely configurable.
59         
60        - Supports DSC compliant and binary PostScript, PDF, PCL5,
61          PCLXL (aka PCL6) and ESC/P2 printers natively for software
62          accounting methods. More formats to come.
63         
64        - Hewlett-Packard Deskjet printers are currently NOT supported. 
65           
66    Quota systems :       
67   
68        - Supports printers and printers groups quotas.
69       
70        - Supports users and users groups quotas.
71       
72        - Supports page quotas.
73          Page quotas can be set differently on a per printer
74          and per user/group basis.
75       
76        - Supports account balance quotas in any currency.
77          Account balance quotas can be set on a per user
78          basis. The account balance is shared amongst
79          all printers. The history of payments (positive
80          or negative credits to an user account) is kept.
81         
82        - Page quotas and account balance can be set/reset
83          independantly.
84         
85        - Page quotas and account balances can be set on
86          a per user or per group basis.
87         
88        - Price per page and per job can be set differently 
89          on any printer.
90       
91        - Low level of page quota or account balance are
92          configurable.
93         
94        - Both soft and hard limit with configurable grace delay 
95          can be set for page quota.
96         
97        - Possibility to disable quota enforcement for any user
98          or group, while still keeping page accounting.
99             
100    Administration :       
101   
102        - Powerful administration tools can be used to
103          automate setting or resetting of quotas or
104          account balances at specific intervals.
105         
106        - Administration tools can modify several users, 
107          groups, or printers at once.
108         
109        - Account balances can be set, incremented, or 
110          decremented. History of payments is kept.
111         
112        - Both printers and users can be automatically added on
113          first print in a completely configurable way.
114         
115        - Quota report generator available either from the 
116          command line or in any web browser.
117          The web-based quota report generator can be
118          user/password protected.
119         
120        - Print quote generator can tell users how much 
121          a print job will cost them in advance.
122         
123        - Policy with regard to unregistered users can   
124          be configured for each printer to either deny
125          printing, allow printing, or delegate the
126          decision to any external tool.
127         
128        - Warning and error messages can be automatically 
129          sent via email to the administrator, the user,
130          both, or none.
131         
132        - Warning and error messages' content is completely
133          configurable.
134         
135        - Configuration can be changed without needing to 
136          restart the printing system.
137       
138        - Complete print job history is kept. This can be
139          disabled if needed.
140         
141        - Automated low quota or balance remainder can be
142          scheduled regularly or launched manually.
143         
144    User Interface :         
145   
146        - All the command line tools accept the -h | --help
147          command line option which prints all the available
148          options and show usage examples.
149         
150        - Completely internationalized. Actually supports the 
151          English, French, Spanish, Portuguese, Brasilian, Swedish,
152          Thai, Greek, German, and Italian languages. More to come.
153
154====================================================================
155       
156Planned features are described in the TODO file.
157
158Actually two (or an infinity of) page accounting methods are
159implemented :
160
161  - The 'hardware' method consists in querying the printer (via SNMP
162    or Netatalk or any other method of your choice) for its total pages
163    counter.
164   
165    This is done both at the beginning and at the end of a
166    print job. The counters difference is then immediately used to
167    decrease the user's account balance or increase his quota usage.
168   
169  - The 'software' method consists in delegating the computation of the
170    job's size in number of pages to any external command of your choice.
171    The command can read the job's data from its standard input and MUST
172    output the job's size on its standard output. Changes to the user
173    account are reported immediately.
174   
175PyKota is known to work fine with most laser printers, either with
176software accounting, or with hardware accounting if the printer
177supports this.
178
179============================================================
180
181INSTALLATION:
182=============
183
184NB :
185====
186
187  You may learn more about PyKota, if it fits your own organization,
188  its internal working, and some potential performance drawbacks and
189  how to avoid them, in a WiKi administered by Ryan Suarez at :
190 
191    http://webcrossing.macosxlabs.org/webx?14@30.QAu3a5k0c4z.7@.26bf4661
192
193  You may also find the following document interesting :
194 
195    http://es.tldp.org/Tutoriales/doc-openldap-samba-cups-python/
196   
197  This document, written in Spanish by Sergio Gonzalez Gonzalez, 
198  describes the integration of PyKota into an OpenLDAP + Samba
199  + CUPS installation. Even for people who can't read spanish
200  this document is really interesting, and contains lots of
201  screenshots.
202 
203Prerequisite :
204--------------
205   
206  You need to have the following tools installed on the CUPS Server :
207 
208    - CUPS or LPRng
209    - Python v2.1 or above
210    - eGenix' mxDateTime Python extension
211    - SNMP tools (specifically the snmpget command) if you plan to
212      request your printer's lifetime page counter via SNMP.
213    - Netatalk (specifically the pap command) if you plan to
214      request your printer's lifetime page counter via AppleTalk.
215    - PostgreSQL's PygreSQL Python extension and the PostgreSQL client
216      libraries if you plan to use PostgreSQL as the Quota Storage
217      backend.
218 or     
219    - python-ldap Python module and the OpenLDAP client libraries 
220      if you plan to use OpenLDAP as the Quota Storage backend.
221   
222  On Intel i386 architecture, and for performance reasons if you
223  print in PCL5 or PCL6 format, it is strongly suggested that you 
224  install the Python accelerator Psyco, available at :
225 
226      http://psyco.sourceforge.net
227     
228  Under Debian :   
229 
230      $ apt-get install python-psyco
231     
232  Other architectures may be supported as well in the future, check   
233  this on Psyco's website.
234 
235  Installing Psyco is not mandatory, but it will speedup PCL5 parsing
236  by almost 3 times. PostScript and PDF parsing can also benefit,
237  but in an almost unnoticeable manner since this part of the code
238  is already optimal. For PCL5 this is a completely different matter,
239  and if you install Psyco you will never regret it !
240  Same remark applies for PCL6 (aka PCLXL) : the parser is completely
241  different, but the performance gain with Psyco is impressive.
242 
243  You may also benefit from having the following tools installed to
244  deal with some printers :
245 
246    - npadmin
247    - netcat
248    - ghostscript
249   
250  You need to have the following tools installed on the Quota Storage 
251  Server :
252 
253    - PostgreSQL
254   
255  or 
256 
257    - OpenLDAP
258   
259NB :   
260
261  PygreSQL must be linked with the PostgreSQL client libraries on
262  the Print Server. The PostgreSQL client libraries' version must
263  match the PostgreSQL version used on the Quota Storage Server.
264 
265or 
266
267  python-ldap must be linked with the OpenLDAP client libraries on the
268  Print Server. The OpenLDAP client libraries' version must match the
269  OpenLDAP version used on the Quota Storage Server.
270 
271  This list of prerequisite software may change in the future, when
272  PyKota will support more functionnalities you will be given
273  alternatives.
274 
275  Of course the Print Server and the Quota Storage Server can be the
276  very same machine if you've got a tiny network, or you can have
277  multiple Print Servers all storing their quotas on the same Quota
278  Storage Server if you've got a bigger network.
279 
280Then :   
281------
282 
283Download the latest PyKota version from the CVS tree on :
284
285    http://savannah.nongnu.org/projects/pykota
286
287Just type :
288
289    python setup.py install
290
291You may need to be logged in with sufficient privileges (e.g. root)
292
293The installation script will now automatically check if some software
294is missing and ask you if you still want to proceed with the
295installation or abort it completely.
296
297Go to the initscripts subdirectory of PyKota's sources, and choose
298the appropriate storage backend for your configuration. Read carefully
299the associated README file and execute the initialization script
300to create an empty PyKota Storage. Upgrade scripts may be
301provided as well.
302
303Copy the conf/pykota.conf.sample and  conf/pykotadmin.conf.sample
304sample configuration files to /etc/pykota/pykota.conf and
305/etc/pykota/pykotadmin.conf (the installation script tries to do
306this for you if needed and you agreed to this action). You need to
307adapt these files to your own needs. Especially you may have to create
308sections named after your own printers, and change the
309administrator's email address which by default is root@localhost.
310Read and try to understand these two very well commented files,
311so that you'll encounter less problems later.
312
313Also be sure to double check that commands that query printers
314for their internal page counter work from the command line
315before using them in PyKota's configuration.
316
317The rest of the installation depends on your printing system :
318
319  - CUPS Printing System :
320 
321    Once and for all :
322   
323        Create a symbolic link to the cupspykota backend
324        in CUPS's backend directory :
325       
326          $ cd /usr/lib/cups/backend
327          $ ln -s /usr/share/pykota/cupspykota cupspykota
328         
329        Restart CUPS so that the new backend can be detected.
330       
331          $ /etc/init.d/cupsys restart
332         
333        or :   
334     
335          $ /etc/rc.d/init.d/cupsysrestart
336         
337        or any similar command depending on your operating system. 
338         
339    For new printers :
340   
341        Go to CUPS management interface (http://localhost:631)
342        and choose the appropriate PyKota managed device depending
343        on the type of printer you use. For example, if your
344        printer is waiting on :
345       
346            socket://myprinter.example.com:9100
347           
348        Then choose :   
349       
350            cupspykota:socket://myprinter.example.com:9100
351           
352        Configure your printer as usual.   
353       
354        Now double check /etc/pykota/pykota.conf
355       
356        You should manually create a section named after the
357        printer you've just added, unless you have set
358        all options globally.
359       
360        The new pkhint command can help you with correct settings
361        for your printers, but don't rely on it because it is still
362        experimental work. To use pkhint, you have to feed it with
363        CUPS' printers.conf file this way :
364       
365          $ pkhint </etc/cups/printers.conf
366       
367        pkhint will try to tell you what is the best accounting
368        method for each printer and will print some lines you'll
369        just have to copy&paste in the appropriate sections in
370        /etc/pykota/pykota.conf
371       
372        That's all.
373   
374    For existing printers :
375   
376        If you had already installed a version of PyKota earlier
377        than 1.16alpha7, then remove the *cupsFilter lines in your
378        PPD files for each printer already managed printers. Each
379        line to remove is of the form :
380       
381          *cupsFilter: "application/vnd.cups-postscript 0 /usr/share/pykota/pykota"
382       
383        This means that each time the pstops filter will be executed, it will
384        pass the job's data through the pykota filter which is present in
385        /usr/share/pykota
386       
387        Don't touch anything else, especially any other *cupsFilter line.
388        Then save each of these files.
389       
390        Then, the easiest is to directly modify the DeviceURI lines
391        in /etc/cups/printers.conf, you just have to put
392        'cupspykota:' in front of what is already on these lines.
393        For example, replace :
394   
395            DeviceURI socket://myprinter.example.com:9100
396       
397        with :   
398   
399            DeviceURI cupspykota:socket://myprinter.example.com:9100
400           
401        or :   
402       
403            DeviceURI cupspykota://socket://myprinter.example.com:9100
404       
405        Save the file and restart CUPS.
406       
407        Here too, you may find it interesting to use the pkhint command as
408        described above to help with manual configuration of the file
409        /etc/pykota/pykota.conf
410
411  - LPRng Printing System :
412 
413    For each printer on which you want to use PyKota :
414   
415        Modify the printer's entry in /etc/printcap : you have to add
416        the three following lines :
417       
418          :achk=true:\
419          :as=/usr/share/pykota/lprngpykota:\
420          :ae=/usr/share/pykota/lprngpykota:\
421         
422        This will tell LPRng to activate accounting, and use the lprngpykota
423        accounting filter both at the start and at the end of printing.
424       
425    When all modifications are done, just save the /etc/printcap file and   
426    restart LPRng :
427   
428          $ /etc/init.d/lprng restart
429         
430        or :   
431     
432          $ /etc/rc.d/init.d/lprng restart
433         
434        or any similar command depending on your operating system. 
435       
436    NB : the pkhint command can't be used with LPRng for now, so you   
437         have to modify /etc/pykota/pykota.conf carefully. The comments
438         in this file will help you.
439     
440Now you can begin to populate the PyKota's database with printers,
441users and groups :
442 
443Add printers and users to the quota system and set their quota values :
444
445Starting from version 1.18alpha2, the preferred command to manage
446printers is named pkprinters
447
448    $ pkprinters --help
449   
450    will tell you how to create, manage or delete printers and
451    printers groups.
452   
453    $ pkprinters --add --charge 0.05 hp2100
454   
455    would add the printer named hp2100 with a price per page
456    of 0.05 unit.
457
458Now set quotas for users on this printer :     
459
460    $ edpykota --add -P hp2100 -S 40 -H 50 user1 ... userN
461       
462    launching edpykota without any argument or with the --help
463    command line option will show you all the possibilities.
464   
465    by default, each user is limited by "quota", this means that on
466    each printer he can have a different soft and hard limit.
467    You may want to limit the user by his account balance value,
468    in which case, the print quota is shared between all printers
469    instead of being different. To do this, use the following :
470   
471    $ edpykota --add -P hp2100 --limitby balance --balance 10 user1 ... userN
472   
473    This will put 10 $ (or Euros, PyKota doesn't care) on each user's account
474    balance, and tell PyKota to limit them by their account balance value.
475    Whenever they print on any printer, their account balance value is
476    decreased by an amount which depends on the particular price per page
477    and per job that you may have defined on the printer with edpykota's
478    --charge command line option.
479    Soft and Hard limits are not used if "--limitby balance" is used,
480    but you can define a "poorman"'s threshold in /etc/pykota/pykota.conf
481    to obtain a similar result (warning message when quota is low).
482
483Restart CUPS or LPRng, for example under Debian GNU/Linux systems :         
484
485    $ /etc/init.d/cupsys restart
486   
487  or :
488 
489    $ /etc/init.d/lprng restart
490       
491Your users now should be able to print but not exceed their
492printing quota.
493
494To see printer quota usage, you can use :
495
496    $ repykota --printer lp
497   
498or :
499
500    $ repykota
501   
502    which will print quota usage for all users on all printers,
503    along with totals, if you are the root user. If you are
504    a regular user, only your own quota report will be produced.
505   
506Quota reports are also available remotely by using the CGI script
507printquota.cgi provided in the cgi-bin/ subdirectory. You can
508also use the CSS stylesheet present in the stylesheets/ subdirectory
509and put it at your web server's DocumentRoot, to benefit from a nicer
510look, especially quota violations will appear in different colors.
511
512For different security concerns, please give a look at the SECURITY
513file which is part of this software.
514           
515============================================================
516
517Mailing list :
518--------------
519
520  A mailing list is dedicated to Pykota, you can subscribe to it
521  or consult its archives at :
522 
523    http://cgi.librelogiciel.com/mailman/listinfo/pykota
524   
525  The mailing list is the preferred way to obtain support, because 
526  all members can help and can also benefit from the solutions
527  proposed by other members.
528 
529  Posts by non-members are usually rejected.
530 
531  The mailing list language is english and only english.
532   
533IRC :   
534-----
535
536  You can also chat with us :
537 
538        /server irc.freenode.net
539        /join #pykota
540       
541  Preferred language on this channel is english, but french     
542  is also accepted. Try to avoid exposing complex problems
543  in french because english speaking people on the channel
544  wouldn't benefit from the solutions.
545 
546  PyKota's main author is known as 'tamere' on IRC.
547   
548============================================================
549   
550Please e-mail bugs to the mailing list at : pykota@librelogiciel.com
551or to the main author at : alet@librelogiciel.com (Jerome Alet)
Note: See TracBrowser for help on using the browser.