root / pykota / trunk / README @ 1744

Revision 1744, 19.5 kB (checked in by jalet, 20 years ago)

Wrote some doc for dumpykota

  • 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       
[1154]44        - Supports OpenLDAP 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
143          software (spreadsheets for example).
144         
[1155]145    User Interface :         
146   
[1154]147        - All the command line tools accept the -h | --help
148          command line option which prints all the available
149          options and show usage examples.
[1155]150         
151        - Completely internationalized. Actually supports the 
[1648]152          English, French, Spanish, Portuguese, Brasilian, Swedish,
[1671]153          Thai, Greek, German, and Italian languages. More to come.
[1154]154
155====================================================================
156       
[739]157Planned features are described in the TODO file.
158
[1507]159Actually two (or an infinity of) page accounting methods are
[980]160implemented :
[695]161
[1475]162  - The 'hardware' method consists in querying the printer (via SNMP
[1181]163    or Netatalk or any other method of your choice) for its total pages
[1186]164    counter.
[980]165   
[1600]166    This is done both at the beginning and at the end of a
[1186]167    print job. The counters difference is then immediately used to
168    decrease the user's account balance or increase his quota usage.
169   
[1475]170  - The 'software' method consists in delegating the computation of the
[980]171    job's size in number of pages to any external command of your choice.
172    The command can read the job's data from its standard input and MUST
[1186]173    output the job's size on its standard output. Changes to the user
[1600]174    account are reported immediately.
[980]175   
[1600]176PyKota is known to work fine with most laser printers, either with
177software accounting, or with hardware accounting if the printer
178supports this.
[724]179
[695]180============================================================
181
182INSTALLATION:
183=============
184
[1186]185NB :
186====
[887]187
[1397]188  You may learn more about PyKota, if it fits your own organization,
189  its internal working, and some potential performance drawbacks and
190  how to avoid them, in a WiKi administered by Ryan Suarez at :
191 
192    http://webcrossing.macosxlabs.org/webx?14@30.QAu3a5k0c4z.7@.26bf4661
[1034]193
[1651]194  You may also find the following document interesting :
195 
196    http://es.tldp.org/Tutoriales/doc-openldap-samba-cups-python/
197   
198  This document, written in Spanish by Sergio Gonzalez Gonzalez, 
199  describes the integration of PyKota into an OpenLDAP + Samba
200  + CUPS installation. Even for people who can't read spanish
201  this document is really interesting, and contains lots of
202  screenshots.
203 
[714]204Prerequisite :
205--------------
206   
207  You need to have the following tools installed on the CUPS Server :
208 
[952]209    - CUPS or LPRng
[809]210    - Python v2.1 or above
[714]211    - eGenix' mxDateTime Python extension
[919]212    - SNMP tools (specifically the snmpget command) if you plan to
213      request your printer's lifetime page counter via SNMP.
214    - Netatalk (specifically the pap command) if you plan to
215      request your printer's lifetime page counter via AppleTalk.
[1043]216    - PostgreSQL's PygreSQL Python extension and the PostgreSQL client
217      libraries if you plan to use PostgreSQL as the Quota Storage
218      backend.
219 or     
220    - python-ldap Python module and the OpenLDAP client libraries 
221      if you plan to use OpenLDAP as the Quota Storage backend.
[714]222   
[1571]223  On Intel i386 architecture, and for performance reasons if you
[1575]224  print in PCL5 or PCL6 format, it is strongly suggested that you 
225  install the Python accelerator Psyco, available at :
[1570]226 
227      http://psyco.sourceforge.net
228     
[1571]229  Under Debian :   
230 
231      $ apt-get install python-psyco
232     
233  Other architectures may be supported as well in the future, check   
[1600]234  this on Psyco's website.
[1571]235 
[1578]236  Installing Psyco is not mandatory, but it will speedup PCL5 parsing
[1570]237  by almost 3 times. PostScript and PDF parsing can also benefit,
238  but in an almost unnoticeable manner since this part of the code
[1575]239  is already optimal. For PCL5 this is a completely different matter,
[1570]240  and if you install Psyco you will never regret it !
[1600]241  Same remark applies for PCL6 (aka PCLXL) : the parser is completely
242  different, but the performance gain with Psyco is impressive.
[1570]243 
[1186]244  You may also benefit from having the following tools installed to
245  deal with some printers :
246 
247    - npadmin
248    - netcat
249    - ghostscript
250   
[714]251  You need to have the following tools installed on the Quota Storage 
252  Server :
253 
254    - PostgreSQL
255   
[1043]256  or 
257 
258    - OpenLDAP
259   
[1086]260NB :   
261
262  PygreSQL must be linked with the PostgreSQL client libraries on
263  the Print Server. The PostgreSQL client libraries' version must
264  match the PostgreSQL version used on the Quota Storage Server.
[714]265 
[1043]266or 
267
[1086]268  python-ldap must be linked with the OpenLDAP client libraries on the
269  Print Server. The OpenLDAP client libraries' version must match the
270  OpenLDAP version used on the Quota Storage Server.
[1043]271 
[714]272  This list of prerequisite software may change in the future, when
273  PyKota will support more functionnalities you will be given
274  alternatives.
275 
[952]276  Of course the Print Server and the Quota Storage Server can be the
[851]277  very same machine if you've got a tiny network, or you can have
[952]278  multiple Print Servers all storing their quotas on the same Quota
[851]279  Storage Server if you've got a bigger network.
280 
[714]281Then :   
282------
283 
[724]284Download the latest PyKota version from the CVS tree on :
[695]285
[725]286    http://savannah.nongnu.org/projects/pykota
[695]287
[714]288Just type :
[695]289
[725]290    python setup.py install
[695]291
292You may need to be logged in with sufficient privileges (e.g. root)
293
[878]294The installation script will now automatically check if some software
295is missing and ask you if you still want to proceed with the
296installation or abort it completely.
297
[695]298Go to the initscripts subdirectory of PyKota's sources, and choose
[1600]299the appropriate storage backend for your configuration. Read carefully
[695]300the associated README file and execute the initialization script
[878]301to create an empty PyKota Storage. Upgrade scripts may be
302provided as well.
[695]303
[1186]304Copy the conf/pykota.conf.sample and  conf/pykotadmin.conf.sample
[1107]305sample configuration files to /etc/pykota/pykota.conf and
[1600]306/etc/pykota/pykotadmin.conf (the installation script tries to do
307this for you if needed and you agreed to this action). You need to
308adapt these files to your own needs. Especially you may have to create
[1186]309sections named after your own printers, and change the
310administrator's email address which by default is root@localhost.
311Read and try to understand these two very well commented files,
312so that you'll encounter less problems later.
[1198]313
314Also be sure to double check that commands that query printers
[1186]315for their internal page counter work from the command line
316before using them in PyKota's configuration.
[695]317
[1186]318The rest of the installation depends on your printing system :
319
[1185]320  - CUPS Printing System :
[952]321 
[1185]322    Once and for all :
[952]323   
[1185]324        Create a symbolic link to the cupspykota backend
325        in CUPS's backend directory :
326       
327          $ cd /usr/lib/cups/backend
[1345]328          $ ln -s /usr/share/pykota/cupspykota cupspykota
[1185]329         
330        Restart CUPS so that the new backend can be detected.
331       
332          $ /etc/init.d/cupsys restart
333         
[1600]334        or :   
335     
336          $ /etc/rc.d/init.d/cupsysrestart
337         
338        or any similar command depending on your operating system. 
339         
[1185]340    For new printers :
[952]341   
[1185]342        Go to CUPS management interface (http://localhost:631)
343        and choose the appropriate PyKota managed device depending
344        on the type of printer you use. For example, if your
345        printer is waiting on :
346       
[1354]347            socket://myprinter.example.com:9100
[1185]348           
349        Then choose :   
350       
[1354]351            cupspykota:socket://myprinter.example.com:9100
[1185]352           
353        Configure your printer as usual.   
354       
[1186]355        Now double check /etc/pykota/pykota.conf
[1600]356       
357        You should manually create a section named after the
[1402]358        printer you've just added, unless you have set
359        all options globally.
[1600]360       
[1408]361        The new pkhint command can help you with correct settings
362        for your printers, but don't rely on it because it is still
[1600]363        experimental work. To use pkhint, you have to feed it with
364        CUPS' printers.conf file this way :
[1186]365       
[1600]366          $ pkhint </etc/cups/printers.conf
367       
368        pkhint will try to tell you what is the best accounting
369        method for each printer and will print some lines you'll
370        just have to copy&paste in the appropriate sections in
371        /etc/pykota/pykota.conf
372       
[1185]373        That's all.
[952]374   
[1185]375    For existing printers :
376   
[1186]377        If you had already installed a version of PyKota earlier
378        than 1.16alpha7, then remove the *cupsFilter lines in your
379        PPD files for each printer already managed printers. Each
380        line to remove is of the form :
[1185]381       
[1345]382          *cupsFilter: "application/vnd.cups-postscript 0 /usr/share/pykota/pykota"
[1185]383       
[1345]384        This means that each time the pstops filter will be executed, it will
385        pass the job's data through the pykota filter which is present in
386        /usr/share/pykota
387       
[1185]388        Don't touch anything else, especially any other *cupsFilter line.
[1186]389        Then save each of these files.
[1185]390       
391        Then, the easiest is to directly modify the DeviceURI lines
392        in /etc/cups/printers.conf, you just have to put
393        'cupspykota:' in front of what is already on these lines.
394        For example, replace :
395   
[1354]396            DeviceURI socket://myprinter.example.com:9100
[1185]397       
398        with :   
399   
[1354]400            DeviceURI cupspykota:socket://myprinter.example.com:9100
[1345]401           
402        or :   
[1185]403       
[1354]404            DeviceURI cupspykota://socket://myprinter.example.com:9100
[1345]405       
[1185]406        Save the file and restart CUPS.
[1600]407       
408        Here too, you may find it interesting to use the pkhint command as
409        described above to help with manual configuration of the file
410        /etc/pykota/pykota.conf
[695]411
[1185]412  - LPRng Printing System :
[952]413 
[1600]414    For each printer on which you want to use PyKota :
415   
416        Modify the printer's entry in /etc/printcap : you have to add
417        the three following lines :
418       
[1612]419          :achk=true:\
[1600]420          :as=/usr/share/pykota/lprngpykota:\
421          :ae=/usr/share/pykota/lprngpykota:\
422         
423        This will tell LPRng to activate accounting, and use the lprngpykota
424        accounting filter both at the start and at the end of printing.
425       
426    When all modifications are done, just save the /etc/printcap file and   
427    restart LPRng :
428   
429          $ /etc/init.d/lprng restart
430         
431        or :   
[1500]432     
[1600]433          $ /etc/rc.d/init.d/lprng restart
434         
435        or any similar command depending on your operating system. 
436       
437    NB : the pkhint command can't be used with LPRng for now, so you   
438         have to modify /etc/pykota/pykota.conf carefully. The comments
439         in this file will help you.
440     
[1186]441Now you can begin to populate the PyKota's database with printers,
442users and groups :
[952]443 
[716]444Add printers and users to the quota system and set their quota values :
[695]445
[1345]446Starting from version 1.18alpha2, the preferred command to manage
447printers is named pkprinters
448
449    $ pkprinters --help
450   
451    will tell you how to create, manage or delete printers and
452    printers groups.
[1402]453   
454    $ pkprinters --add --charge 0.05 hp2100
455   
456    would add the printer named hp2100 with a price per page
457    of 0.05 unit.
[1345]458
[1402]459Now set quotas for users on this printer :     
460
[1086]461    $ edpykota --add -P hp2100 -S 40 -H 50 user1 ... userN
[724]462       
[725]463    launching edpykota without any argument or with the --help
464    command line option will show you all the possibilities.
[1086]465   
466    by default, each user is limited by "quota", this means that on
467    each printer he can have a different soft and hard limit.
468    You may want to limit the user by his account balance value,
[1107]469    in which case, the print quota is shared between all printers
[1086]470    instead of being different. To do this, use the following :
471   
472    $ edpykota --add -P hp2100 --limitby balance --balance 10 user1 ... userN
473   
474    This will put 10 $ (or Euros, PyKota doesn't care) on each user's account
475    balance, and tell PyKota to limit them by their account balance value.
476    Whenever they print on any printer, their account balance value is
477    decreased by an amount which depends on the particular price per page
478    and per job that you may have defined on the printer with edpykota's
479    --charge command line option.
[1107]480    Soft and Hard limits are not used if "--limitby balance" is used,
481    but you can define a "poorman"'s threshold in /etc/pykota/pykota.conf
482    to obtain a similar result (warning message when quota is low).
[695]483
[990]484Restart CUPS or LPRng, for example under Debian GNU/Linux systems :         
[695]485
[725]486    $ /etc/init.d/cupsys restart
[990]487   
488  or :
489 
490    $ /etc/init.d/lprng restart
[695]491       
492Your users now should be able to print but not exceed their
493printing quota.
494
[1149]495To see printer quota usage, you can use :
[794]496
497    $ repykota --printer lp
498   
499or :
500
501    $ repykota
502   
503    which will print quota usage for all users on all printers,
[1107]504    along with totals, if you are the root user. If you are
505    a regular user, only your own quota report will be produced.
[794]506   
[1107]507Quota reports are also available remotely by using the CGI script
[1345]508printquota.cgi provided in the cgi-bin/ subdirectory. You can
509also use the CSS stylesheet present in the stylesheets/ subdirectory
[1402]510and put it at your web server's DocumentRoot, to benefit from a nicer
511look, especially quota violations will appear in different colors.
[990]512
[980]513For different security concerns, please give a look at the SECURITY
514file which is part of this software.
[741]515           
[695]516============================================================
517
[958]518Mailing list :
519--------------
520
521  A mailing list is dedicated to Pykota, you can subscribe to it
522  or consult its archives at :
523 
524    http://cgi.librelogiciel.com/mailman/listinfo/pykota
525   
[1600]526  The mailing list is the preferred way to obtain support, because 
527  all members can help and can also benefit from the solutions
528  proposed by other members.
529 
530  Posts by non-members are usually rejected.
531 
532  The mailing list language is english and only english.
533   
[1181]534IRC :   
535-----
536
537  You can also chat with us :
538 
539        /server irc.freenode.net
540        /join #pykota
[1600]541       
542  Preferred language on this channel is english, but french     
543  is also accepted. Try to avoid exposing complex problems
544  in french because english speaking people on the channel
545  wouldn't benefit from the solutions.
546 
547  PyKota's main author is known as 'tamere' on IRC.
[1181]548   
[958]549============================================================
550   
[1107]551Please e-mail bugs to the mailing list at : pykota@librelogiciel.com
552or to the main author at : alet@librelogiciel.com (Jerome Alet)
Note: See TracBrowser for help on using the browser.