root / pykota / trunk / README @ 1603

Revision 1603, 19.3 kB (checked in by jalet, 20 years ago)

Rewording

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