root / pykota / trunk / README @ 1561

Revision 1561, 16.9 kB (checked in by jalet, 20 years ago)

Modified features list

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