root / pykota / trunk / README @ 1475

Revision 1475, 16.8 kB (checked in by jalet, 20 years ago)

Code simplifications

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