root / pykota / trunk / README @ 1571

Revision 1571, 17.6 kB (checked in by jalet, 20 years ago)

Additionnal note about psyco

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
RevLine 
[695]1# $Id$
2
[952]3PyKota - Print Quota for CUPS and LPRng
[695]4
[1257]5(c) 2003-2004 Jerome Alet <alet@librelogiciel.com>
[873]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.
[695]10
[873]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.
[695]15
[873]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
[761]20====================================================================
[695]21
[1491]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
[1052]32READ SPECIAL LICENSING AND REDISTRIBUTION TERMS IN THE FILE 'LICENSE'
[761]33
34====================================================================
35
[1154]36PyKota features :
37-----------------
[695]38
[1154]39    Operating systems :
40   
41        - Any Unix-like system as print server.
42           
43        - Any operating system as client.
44           
45    Printing systems :
46   
[1283]47        - Supports both CUPS and LPRng as the printing system.
[1561]48       
49          NB : LPRng support is currently being rewritten, so
50          LPRng is actually not supported in latest CVS versions.
[1154]51           
52    Databases :
53   
54        - Supports PostgreSQL as the Quota Storage backend.
[1283]55          Complete database creation script in SQL is included.
[1043]56       
[1154]57        - Supports OpenLDAP as the Quota Storage backend.
[1475]58          Complete LDAP schema and sample empty tree are included.
[1160]59          Plugging PyKota into your existing LDAP infrastructure
60          is really easy thanks to PyKota's great configurability.
61           
[1154]62    Printers :       
63   
[1475]64        - Hardware or Software accounting methods are completely
65          configurable.
66         
[1154]67        - Supports any printer which can report its internal
[1475]68          page counter. Can ask printers for their internal
[1561]69          page counter via SNMP, Netatalk, PJL, PS, or any
70          other way.
[1475]71          This is completely configurable.
[1154]72         
[1561]73        - Supports PostScript, PDF and PCL5 printers natively
74          for software accounting methods. More formats to come.
[1154]75           
76    Quota systems :       
77   
[1260]78        - Supports printers and printers groups quotas.
[739]79       
[1260]80        - Supports users and users groups quotas.
81       
[1154]82        - Supports page quotas.
83          Page quotas can be set differently on a per printer
84          and per user/group basis.
[739]85       
[1154]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
[1561]89          all printers. The history of payments (positive
90          or negative credits to an user account) is kept.
[980]91         
[1154]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.
[794]100       
[1154]101        - Low level of page quota or account balance are
102          configurable.
[739]103         
[1154]104        - Both soft and hard limit with configurable grace delay 
105          can be set for page quota.
[900]106         
[1154]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.
[925]115         
[1154]116        - Administration tools can modify several users, 
117          groups, or printers at once.
[925]118         
[1154]119        - Account balances can be set, incremented, or 
120          decremented.
[1153]121         
[1273]122        - Both printers and users can be automatically added on
123          first print in a completely configurable way.
[1154]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.
[739]147       
[1154]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         
[1155]154    User Interface :         
155   
[1154]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.
[1155]159         
160        - Completely internationalized. Actually supports the 
[1402]161          English, French, Spanish, Portuguese, Brasilian, Swedish
162          and Italian languages. More to come.
[1154]163
164====================================================================
165       
[739]166Planned features are described in the TODO file.
167
[1507]168Actually two (or an infinity of) page accounting methods are
[980]169implemented :
[695]170
[1475]171  - The 'hardware' method consists in querying the printer (via SNMP
[1181]172    or Netatalk or any other method of your choice) for its total pages
[1186]173    counter.
[980]174   
[1186]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
[1402]181    of one print job, but this is generally ok.
[1186]182   
[1475]183  - The 'software' method consists in delegating the computation of the
[980]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
[1186]186    output the job's size on its standard output. Changes to the user
187    account are reported immediately, both with CUPS and LPRng.
[980]188   
[919]189PyKota is known to work fine with HP Laserjet 2100 and 2200, and
[980]190Apple LaserWriter 16/600 PS, both with CUPS and LPRng, under
[1402]191Debian GNU/Linux (Sarge and Sid) operating systems. It should work
192fine with most network printers.
[724]193
[695]194============================================================
195
196INSTALLATION:
197=============
198
[1186]199NB :
200====
[887]201
[1397]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
[1034]207
[714]208Prerequisite :
209--------------
210   
211  You need to have the following tools installed on the CUPS Server :
212 
[952]213    - CUPS or LPRng
[809]214    - Python v2.1 or above
[714]215    - eGenix' mxDateTime Python extension
[919]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.
[1043]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.
[714]226   
[1571]227  On Intel i386 architecture, and for performance reasons if you
228  print in PCL format, it is strongly suggested that you install
229  the Python accelerator Psyco, available at :
[1570]230 
231      http://psyco.sourceforge.net
232     
[1571]233  Under Debian :   
234 
235      $ apt-get install python-psyco
236     
237  Other architectures may be supported as well in the future, check   
238  on Psyco's website.
239 
[1570]240  Installing Psyco is not mandatory, but it woud speedup PCL parsing
241  by almost 3 times. PostScript and PDF parsing can also benefit,
242  but in an almost unnoticeable manner since this part of the code
243  is already optimal. For PCL this is a completely different matter,
244  and if you install Psyco you will never regret it !
245 
[1186]246  You may also benefit from having the following tools installed to
247  deal with some printers :
248 
249    - npadmin
250    - netcat
251    - ghostscript
252   
[714]253  You need to have the following tools installed on the Quota Storage 
254  Server :
255 
256    - PostgreSQL
257   
[1043]258  or 
259 
260    - OpenLDAP
261   
[1086]262NB :   
263
264  PygreSQL must be linked with the PostgreSQL client libraries on
265  the Print Server. The PostgreSQL client libraries' version must
266  match the PostgreSQL version used on the Quota Storage Server.
[1402]267  BEWARE : under Debian Sarge, as of March 15th 2004, there's a
268  problem with python2.2-pygresql and python-2.3-pygresql, so please
269  install python2.1-pygresql and use Python 2.1 to install and run
270  PyKota. This is not a bug in PyKota, and this should be fixed
271  by Debian in a few days I hope.
[714]272 
[1043]273or 
274
[1086]275  python-ldap must be linked with the OpenLDAP client libraries on the
276  Print Server. The OpenLDAP client libraries' version must match the
277  OpenLDAP version used on the Quota Storage Server.
[1043]278 
[714]279  This list of prerequisite software may change in the future, when
280  PyKota will support more functionnalities you will be given
281  alternatives.
282 
[952]283  Of course the Print Server and the Quota Storage Server can be the
[851]284  very same machine if you've got a tiny network, or you can have
[952]285  multiple Print Servers all storing their quotas on the same Quota
[851]286  Storage Server if you've got a bigger network.
287 
[714]288Then :   
289------
290 
[724]291Download the latest PyKota version from the CVS tree on :
[695]292
[725]293    http://savannah.nongnu.org/projects/pykota
[695]294
[714]295Just type :
[695]296
[725]297    python setup.py install
[695]298
299You may need to be logged in with sufficient privileges (e.g. root)
300
[878]301The installation script will now automatically check if some software
302is missing and ask you if you still want to proceed with the
303installation or abort it completely.
304
[695]305Go to the initscripts subdirectory of PyKota's sources, and choose
306the appropriate storage backend for your configuration. Read
307the associated README file and execute the initialization script
[878]308to create an empty PyKota Storage. Upgrade scripts may be
309provided as well.
[695]310
[1186]311Copy the conf/pykota.conf.sample and  conf/pykotadmin.conf.sample
[1107]312sample configuration files to /etc/pykota/pykota.conf and
[1186]313/etc/pykota/pykotadmin.conf. The installation script tries to do
314this for you if needed and you agreed to this action. You need to
315adapt these files to your own needs. Especially you have to create
316sections named after your own printers, and change the
317administrator's email address which by default is root@localhost.
318Read and try to understand these two very well commented files,
319so that you'll encounter less problems later.
[1198]320
321Also be sure to double check that commands that query printers
[1186]322for their internal page counter work from the command line
323before using them in PyKota's configuration.
[695]324
[1186]325The rest of the installation depends on your printing system :
326
[1185]327  - CUPS Printing System :
[952]328 
[1185]329    Once and for all :
[952]330   
[1185]331        Create a symbolic link to the cupspykota backend
332        in CUPS's backend directory :
333       
334          $ cd /usr/lib/cups/backend
[1345]335          $ ln -s /usr/share/pykota/cupspykota cupspykota
[1185]336         
337        Restart CUPS so that the new backend can be detected.
338       
339          $ /etc/init.d/cupsys restart
340         
341    For new printers :
[952]342   
[1185]343        Go to CUPS management interface (http://localhost:631)
344        and choose the appropriate PyKota managed device depending
345        on the type of printer you use. For example, if your
346        printer is waiting on :
347       
[1354]348            socket://myprinter.example.com:9100
[1185]349           
350        Then choose :   
351       
[1354]352            cupspykota:socket://myprinter.example.com:9100
[1185]353           
354        Configure your printer as usual.   
355       
[1186]356        Now double check /etc/pykota/pykota.conf
357        This file should contain a section named after the
[1402]358        printer you've just added, unless you have set
359        all options globally.
[1408]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        incomplete.
[1186]363       
[1185]364        That's all.
[952]365   
[1185]366    For existing printers :
367   
[1186]368        If you had already installed a version of PyKota earlier
369        than 1.16alpha7, then remove the *cupsFilter lines in your
370        PPD files for each printer already managed printers. Each
371        line to remove is of the form :
[1185]372       
[1345]373          *cupsFilter: "application/vnd.cups-postscript 0 /usr/share/pykota/pykota"
[1185]374       
[1345]375        This means that each time the pstops filter will be executed, it will
376        pass the job's data through the pykota filter which is present in
377        /usr/share/pykota
378       
[1185]379        Don't touch anything else, especially any other *cupsFilter line.
[1186]380        Then save each of these files.
[1185]381       
382        Then, the easiest is to directly modify the DeviceURI lines
383        in /etc/cups/printers.conf, you just have to put
384        'cupspykota:' in front of what is already on these lines.
385        For example, replace :
386   
[1354]387            DeviceURI socket://myprinter.example.com:9100
[1185]388       
389        with :   
390   
[1354]391            DeviceURI cupspykota:socket://myprinter.example.com:9100
[1345]392           
393        or :   
[1185]394       
[1354]395            DeviceURI cupspykota://socket://myprinter.example.com:9100
[1345]396       
[1185]397        Save the file and restart CUPS.
[695]398
[1185]399  - LPRng Printing System :
[952]400 
[1500]401      For now LPRng support in PyKota is deactivated. Please be patient.
402     
[1186]403Now you can begin to populate the PyKota's database with printers,
404users and groups :
[952]405 
[716]406Add printers and users to the quota system and set their quota values :
[695]407
[1345]408Starting from version 1.18alpha2, the preferred command to manage
409printers is named pkprinters
410
411    $ pkprinters --help
412   
413    will tell you how to create, manage or delete printers and
414    printers groups.
[1402]415   
416    $ pkprinters --add --charge 0.05 hp2100
417   
418    would add the printer named hp2100 with a price per page
419    of 0.05 unit.
[1345]420
[1402]421Now set quotas for users on this printer :     
422
[1086]423    $ edpykota --add -P hp2100 -S 40 -H 50 user1 ... userN
[724]424       
[725]425    launching edpykota without any argument or with the --help
426    command line option will show you all the possibilities.
[1086]427   
428    by default, each user is limited by "quota", this means that on
429    each printer he can have a different soft and hard limit.
430    You may want to limit the user by his account balance value,
[1107]431    in which case, the print quota is shared between all printers
[1086]432    instead of being different. To do this, use the following :
433   
434    $ edpykota --add -P hp2100 --limitby balance --balance 10 user1 ... userN
435   
436    This will put 10 $ (or Euros, PyKota doesn't care) on each user's account
437    balance, and tell PyKota to limit them by their account balance value.
438    Whenever they print on any printer, their account balance value is
439    decreased by an amount which depends on the particular price per page
440    and per job that you may have defined on the printer with edpykota's
441    --charge command line option.
[1107]442    Soft and Hard limits are not used if "--limitby balance" is used,
443    but you can define a "poorman"'s threshold in /etc/pykota/pykota.conf
444    to obtain a similar result (warning message when quota is low).
[695]445
[990]446Restart CUPS or LPRng, for example under Debian GNU/Linux systems :         
[695]447
[725]448    $ /etc/init.d/cupsys restart
[990]449   
450  or :
451 
452    $ /etc/init.d/lprng restart
[695]453       
454Your users now should be able to print but not exceed their
455printing quota.
456
[1149]457To see printer quota usage, you can use :
[794]458
459    $ repykota --printer lp
460   
461or :
462
463    $ repykota
464   
465    which will print quota usage for all users on all printers,
[1107]466    along with totals, if you are the root user. If you are
467    a regular user, only your own quota report will be produced.
[794]468   
[1107]469Quota reports are also available remotely by using the CGI script
[1345]470printquota.cgi provided in the cgi-bin/ subdirectory. You can
471also use the CSS stylesheet present in the stylesheets/ subdirectory
[1402]472and put it at your web server's DocumentRoot, to benefit from a nicer
473look, especially quota violations will appear in different colors.
[990]474
[980]475For different security concerns, please give a look at the SECURITY
476file which is part of this software.
[741]477           
[695]478============================================================
479
[958]480Mailing list :
481--------------
482
483  A mailing list is dedicated to Pykota, you can subscribe to it
484  or consult its archives at :
485 
486    http://cgi.librelogiciel.com/mailman/listinfo/pykota
487   
[1181]488IRC :   
489-----
490
491  You can also chat with us :
492 
493        /server irc.freenode.net
494        /join #pykota
495   
[958]496============================================================
497   
[1107]498Please e-mail bugs to the mailing list at : pykota@librelogiciel.com
499or to the main author at : alet@librelogiciel.com (Jerome Alet)
Note: See TracBrowser for help on using the browser.