root / pykota / trunk / README @ 1886

Revision 1886, 20.6 kB (checked in by jalet, 20 years ago)

Added URLs for PyKota dependencies

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