root / pykota / trunk / README @ 1575

Revision 1575, 17.8 kB (checked in by jalet, 20 years ago)

PCLXL support now works !

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