root / pykota / trunk / README @ 1408

Revision 1408, 17.1 kB (checked in by jalet, 20 years ago)

Note about pkhint

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