root / pykota / trunk / README @ 1483

Revision 1475, 16.8 kB (checked in by jalet, 21 years ago)

Code simplifications

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