root / pykota / trunk / README @ 2391

Revision 2391, 27.1 kB (checked in by jerome, 19 years ago)

New feature

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1# $Id$
2
3PyKota - Print Quota for CUPS and LPRng
4
5(c) 2003-2004 Jerome Alet <alet@librelogiciel.com>
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.
10
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.
15
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19
20====================================================================
21
22READ SPECIAL LICENSING AND REDISTRIBUTION TERMS IN THE FILE 'LICENSE'
23
24====================================================================
25
26PyKota features :
27-----------------
28
29    Free Software :
30   
31        - Licensed under the terms of the GNU General Public License.
32       
33    Commercially Supported :   
34   
35        - Support Contracts are available from http://www.librelogiciel.com/techsupport/
36       
37    Operating systems :
38   
39        - Any Unix-like system as print server.
40           
41        - Any operating system as client.
42           
43    Printing systems :
44   
45        - Supports both CUPS and LPRng as the printing system.
46       
47    Databases :
48   
49        - Supports PostgreSQL as the Quota Storage backend.
50          Complete database creation script in SQL is included.
51       
52        - Supports any LDAP server as the Quota Storage backend.
53          Complete LDAP schema and sample empty tree are included.
54          Plugging PyKota into your existing LDAP infrastructure
55          is really easy thanks to PyKota's great configurability.
56         
57        - The print jobs history can be stored in any database 
58          of your choice (or in plain text files) if needed.
59           
60    Printers :       
61   
62        - Hardware or Software accounting methods are completely
63          configurable.
64         
65        - Supports any printer which can report its internal
66          page counter. Can ask printers for their internal
67          page counter via SNMP, Netatalk, PJL, PS, or any
68          other way.
69          This is completely configurable.
70         
71        - Supports DSC compliant and binary PostScript, PDF, PCL5 (up to),
72          PCLXL (aka PCL6), ESC/P2, DVI, TIFF, OpenOffice.org Writer and
73          OpenOffice.org Impress printers (or virtual printers) natively
74          (through the direct use of pkpgcounter's code) for software
75          accounting methods. More formats to come.
76         
77        - Supports any other Page Description Language for which you 
78          have a parser which can be scripted.
79           
80    Quota systems :       
81   
82        - Supports printers and printers groups quotas.
83       
84        - Supports users and users groups quotas.
85       
86        - Supports page quotas.
87          Page quotas can be set differently on a per printer
88          and per user/group basis.
89       
90        - Supports account balance quotas in any currency.
91          Account balance quotas can be set on a per user
92          basis. The account balance is shared amongst
93          all printers. The history of payments (positive
94          or negative credits to an user account) is kept.
95         
96        - Supports high granularity periodic print quotas : down
97          to one minute intervals if needed.
98       
99        - Page quotas and account balance can be set/reset
100          independantly.
101         
102        - Page quotas can be set on a per user or per group basis
103          for a particular printer.
104         
105        - Price per page and per job can be set differently 
106          on any printer.
107       
108        - Low level of page quota or account balance are
109          configurable.
110         
111        - Both soft and hard limit with configurable grace delay 
112          can be set for page quota.
113         
114        - Possibility to disable quota enforcement for any user
115          or group, while still keeping page accounting.
116         
117        - Each user can have an overcharging (or undercharging) factor, 
118          which is applied whenever PyKota computes the cost of a
119          print job.
120         
121        - Specific pages and credits counters can be defined per billing code,
122          and can be reset independantly of the printing history.
123       
124    Administration :       
125   
126        - Powerful delegation of administrative priviledges.
127       
128        - Powerful administration tools can be used to
129          automate setting or resetting of quotas or
130          account balances at specific intervals.
131         
132        - Administration tools can modify several users, 
133          groups, or printers at once with the use of
134          powerful wildcard characters.
135         
136        - Account balances can be set, incremented, or 
137          decremented. History of payments is kept.
138         
139        - Number of pages used can be set, incremented, or 
140          decremented.
141         
142        - Both printers and users can be automatically added on
143          first print in a completely configurable way.
144         
145        - Quota report generator available either from the 
146          command line or in any web browser.
147          The web-based quota report generator can be
148          user/password protected.
149         
150        - Print quote generator can tell users how much 
151          a print job will cost them in advance.
152         
153        - Policy with regard to unregistered users can   
154          be configured for each printer to either deny
155          printing, allow printing, or delegate the
156          decision to any external tool.
157         
158        - Warning and error messages can be automatically 
159          sent via email or via any other mean to the administrator,
160          the user, both, or none.
161         
162        - Warning and error messages' content is completely
163          configurable.
164         
165        - Configuration can be changed without needing to 
166          restart the printing system.
167       
168        - Complete print job history is kept. This can be
169          disabled if needed.
170         
171        - Automated low quota or balance remainder can be
172          scheduled regularly or launched manually.
173         
174        - Starting and Ending personalized dynamic banners can be
175          generated on the fly, and accounted for or not, depending
176          on some configuration settings.
177          Banners can still be enabled even if the print job is denied.
178          NB : Banners are a CUPS only feature for now.
179         
180        - Duplicate print jobs can be forbidden automatically. The decision
181          can be left to any script to decide this on a per job basis.
182         
183        - Powerful data dumper to export datas to other
184          software (spreadsheets for example). Actually
185          supported formats are :
186         
187            - Comma separated values ;
188           
189            - Semicolon separated values ;
190           
191            - Tab separated values ;
192           
193            - XML.
194           
195            - CUPS' page_log format, to easily interface in
196              real time with third party apps like phpPrintAnalyzer
197              and similar tools.
198         
199    User Interface :         
200   
201        - All the command line tools accept the -h | --help
202          command line option which prints all the available
203          options and show usage examples.
204         
205        - Completely internationalized. Actually supports the 
206          English, French, Spanish, Portuguese, Brazilian, Swedish,
207          Thai, Greek, German, Italian, Norwegian (Bokm�, Turkish
208          and traditional Chinese languages.
209          More to come.
210         
211        - Web enabled print quota monitor, data dumper, and quote
212          generator.
213       
214        - An On Screen Display X-Window print quota monitor is included.
215       
216        - An email gateway to allow users to retrieve their print quota
217          information by sending an email message to a dedicated address
218          is included.
219       
220        - A cross-platform print quota monitor will soon be available
221          as an purchaseable add-on.
222         
223        - Third party web based management tools are available.
224
225====================================================================
226       
227Planned features are described in the TODO file.
228
229Actually two (or an infinity of) page accounting methods are
230implemented :
231
232  - The 'hardware' method consists in querying the printer (via SNMP
233    or Netatalk or any other method of your choice) for its total pages
234    counter.
235    This is done both at the beginning and at the end of a
236    print job. The counters difference is then immediately used to
237    decrease the user's account balance or increase his quota usage.
238   
239  - The 'software' method consists in delegating the computation of the
240    job's size in number of pages to any external command of your choice.
241    The command can read the job's data from its standard input and MUST
242    output the job's size on its standard output. Changes to the user
243    account are reported immediately.
244   
245    PyKota featured an internal software accounting method which handles
246    several Page Description Languages : DSC compliant and binary PostScript,
247    PDF, PCLXL (aka PCL6), PCL3/4/5, ESC/P2, DVI, TIFF, OpenOffice.org Writer
248    and OpenOffice.org Impress. This software is now distributed separately
249    as 'pkpgcounter', and not included anymore in PyKota, so you must now
250    download and install it before running PyKota.
251   
252PyKota is known to work fine with most laser printers, either with
253software accounting, or with hardware accounting if the printer
254supports this.
255
256============================================================
257
258SUPPORT CONTRACTS:
259==================
260
261  You can now purchase 8x5x365@NextBusinessDay Technical
262  Support Contracts from us. The yearly fee is computed with 
263  the following formula :
264
265  (100.0 * NbPrintServers) + (2.5 * NbPrinters) + (0.04 * NbUsers) EUROS.
266 
267  This fee includes the VAT, a free subscription to official 
268  PyKota packages, and the latest documentation on paper.
269
270  Please send an email to alet@librelogiciel.com if you're
271  interested in purchasing such a contract.   
272
273  Remember that purchasing a support contract for Free Software like PyKota
274  is a great way to show your appreciation for the work already being done
275  on this project, and will help to improve this software in the future.
276
277============================================================
278
279INSTALLATION:
280=============
281
282NB :
283====
284
285  You may learn more about PyKota, if it fits your own organization,
286  its internal working, and some potential performance drawbacks and
287  how to avoid them, in a document created by Ryan Suarez at :
288 
289    http://archive.macosxlabs.org/forum/webcrossing_archive/documentation/Pykota_and_CUPS/Pykota_and_CUPS.html
290
291  You may also find the following document interesting :
292 
293    http://es.tldp.org/Tutoriales/doc-openldap-samba-cups-python/
294   
295  This document, written in Spanish by Sergio Gonzalez Gonzalez, 
296  describes the integration of PyKota into an OpenLDAP + Samba
297  + CUPS installation. Even for people who can't read spanish
298  this document is really interesting, and contains lots of
299  screenshots.
300 
301  Finally, SuSe users may find the following document to best describe
302  how to install PyKota on their favorite distribution. It's a Spanish
303  document written by Dennis Romero :
304 
305    http://www.cvr.espol.edu.ec/people/dennis/Pykota1.19-SuSE9.1.pdf
306 
307 
308Prerequisite :
309--------------
310   
311  You need to have the following tools installed on the CUPS Server :
312 
313    - CUPS (http://www.cups.org) or LPRng (http://www.lprng.com)
314    - Python v2.1 or above (http://www.python.org)
315    - eGenix' mxDateTime Python extension (http://www.egenix.com)
316    - The pkpgcounter command line tool, version 1.56 or higher. This
317      tool is now mandatory for PyKota to work.
318      (http://www.librelogiciel.com/software/)
319    - The JAXML Python module to be able to dump datas in the XML format.
320      (http://www.librelogiciel.com/software/)
321    - The Python-SNMP module to query printers for their page counter.
322      (http://pysnmp.sourceforge.net).
323      IMPORTANT : version 3.4.3 (or 3.4.2) is REQUIRED. Versions 2.x or
324      4.x won't work for now.
325    - The Python-OSD module to use the graphical print quota reminder.
326      (http://repose.cx/pyosd/)
327    - SNMP tools (specifically the snmpget command) if you prefer to
328      use your own script to request query printers.
329      (http://www.net-snmp.org)
330    - Netatalk (specifically the pap command) if you plan to
331      request your printer's lifetime page counter via AppleTalk.
332      (http://netatalk.sourceforge.net)
333    - The ReportLab Python module (http://www.reportlab.org) if you want 
334      to have PyKota generate nice banners for you.
335    - The Python Imaging Library (aka PIL) module
336      (http://www.pythonware.com/downloads) if you want to have PyKota
337      generate nice banners for you.
338    - PostgreSQL's PygreSQL Python extension and the PostgreSQL client
339      libraries if you plan to use PostgreSQL as the Quota Storage
340      backend.
341      (http://www.postgresql.org and http://www.pygreql.org)
342 or     
343    - python-ldap Python module and the OpenLDAP client libraries 
344      if you plan to use an LDAP server as the Quota Storage backend.
345      (http://www.openldap.org and http://python-ldap.sourceforge.net)
346   
347  On Intel i386 architecture, and for performance reasons, it is
348  strongly suggested that you install the Python accelerator Psyco,
349  available at :
350 
351      http://psyco.sourceforge.net
352     
353  Under Debian :   
354 
355      $ apt-get install python-psyco
356     
357  Other architectures may be supported as well in the future, check   
358  this on Psyco's website.
359 
360  Installing Psyco is not mandatory, but it will speedup PCL5 parsing
361  by almost 3 times. PostScript and PDF parsing can also benefit,
362  but in an almost unnoticeable manner since this part of the code
363  is already optimal. For PCL5 this is a completely different matter,
364  and if you install Psyco you will never regret it !
365  Same remark applies for PCL6 (aka PCLXL) : the parser is completely
366  different, but the performance gain with Psyco is impressive.
367 
368  You may also benefit from having the following tools installed to
369  deal with some printers :
370 
371    - npadmin
372    - netcat
373    - ghostscript
374   
375  You need to have the following tools installed on the Quota Storage 
376  Server :
377 
378    - PostgreSQL (http://www.postgresql.org)
379   
380  or 
381 
382    - OpenLDAP, or any other LDAP server (http://www.openldap.org)
383   
384NB :   
385
386  PygreSQL must be linked with the PostgreSQL client libraries on
387  the Print Server. The PostgreSQL client libraries' version must
388  match the PostgreSQL version used on the Quota Storage Server.
389 
390or 
391
392  python-ldap must be linked with the OpenLDAP client libraries on the
393  Print Server. The OpenLDAP client libraries' version should match the
394  OpenLDAP version used on the Quota Storage Server, if applicable.
395 
396  This list of prerequisite software may change in the future, when
397  PyKota will support more functionnalities you will be given
398  alternatives.
399 
400  Of course the Print Server and the Quota Storage Server can be the
401  very same machine if you've got a tiny network, or you can have
402  multiple Print Servers all storing their quotas on the same Quota
403  Storage Server if you've got a bigger network.
404 
405Hint : 
406------
407
408  - The Debian GNU/Linux distribution is to our knowledge the
409    easiest distribution to install PyKota on, because all
410    of PyKota dependencies are already included, excepted
411    for the PySNMP (http://pysnmp.sourceforge.net) module
412    and the pkpgcounter utility which for now have to be downloaded
413    and installed separately.
414
415Then :   
416------
417 
418Download the latest PyKota version from the Subversion tree :
419
420    $ svn co svn://svn.librelogiciel.com/pykota/trunk pykota
421
422You can now check if the dependencies are correct by typing :
423
424    $ python checkdeps.py
425   
426    An availability report for all the software needed by PyKota
427    will be displayed : you'll have to install the missing
428    software if you want PyKota to work correctly.
429   
430To install the software, just type :
431
432    $ python setup.py install
433
434You may need to be logged in with sufficient privileges (e.g. root)
435
436Create a system user for PyKota :
437
438    $ adduser --system --group --home /etc/pykota --gecos PyKota pykota
439   
440Put the user your printing system is run as in the pykota system group :
441
442    $ adduser lp pykota
443   
444    NB : on our system, the CUPS printing system runs as system user 'lp'.
445    Please adapt this to your own system.
446
447Go to the initscripts subdirectory of PyKota's sources, and choose
448the appropriate storage backend for your configuration. Read carefully
449the associated README file and execute the initialization script
450to create an empty PyKota Storage. Upgrade scripts may be
451provided as well. NB : if you use PostgreSQL, a good way to
452make PyKota work first time is to modify PostgreSQL's pg_hba.conf
453to allow the 'trust' database connection mode. However once PyKota
454works it is HIGHLY RECOMMENDED TO CHANGE THIS TO A MORE SECURE
455VALUE.
456
457Copy the conf/pykota.conf.sample and  conf/pykotadmin.conf.sample
458sample configuration files to /etc/pykota/pykota.conf and
459/etc/pykota/pykotadmin.conf 
460The installation script usually copies these files into /usr/share/pykota
461
462NB : You can move PyKota's configuration files elsewhere, they will
463be searched first in user pykota's home directory.
464
465You need to adapt these files to your own needs. Especially you may
466have to create sections named after your own printers, and change
467the administrator's email address which by default is
468root@localhost. Read and try to understand these two very well
469commented files, so that you'll encounter less problems later.
470
471Also be sure to double check that commands that query printers
472for their internal page counter work from the command line
473before using them in PyKota's configuration.
474
475The rest of the installation depends on your printing system :
476
477  - CUPS Printing System :
478 
479    Once and for all :
480   
481        Create a symbolic link to the cupspykota backend
482        in CUPS's backend directory :
483       
484          $ cd /usr/lib/cups/backend
485          $ ln -s /usr/share/pykota/cupspykota cupspykota
486         
487        Restart CUPS so that the new backend can be detected.
488       
489          $ /etc/init.d/cupsys restart
490         
491        or :   
492     
493          $ /etc/rc.d/init.d/cupsys restart
494         
495        or any similar command depending on your operating system. 
496         
497    For new printers :
498   
499        Go to CUPS management interface (http://localhost:631)
500        and choose the appropriate PyKota managed device depending
501        on the type of printer you use. For example, if your
502        printer is waiting on :
503       
504            socket://myprinter.example.com:9100
505           
506        Then choose :   
507       
508            cupspykota:socket://myprinter.example.com:9100
509           
510        Configure your printer as usual.   
511       
512        Now double check /etc/pykota/pykota.conf
513       
514        You should manually create a section named after the
515        printer you've just added, unless you have set
516        all options globally.
517       
518        The new pkhint command can help you with correct settings
519        for your printers, but don't rely on it because it is still
520        experimental work. To use pkhint, you have to feed it with
521        CUPS' printers.conf file this way :
522       
523          $ pkhint </etc/cups/printers.conf
524       
525        pkhint will try to tell you what is the best accounting
526        method for each printer and will print some lines you'll
527        just have to copy&paste in the appropriate sections in
528        /etc/pykota/pykota.conf
529       
530        That's all.
531   
532    For existing printers :
533   
534        If you had already installed a version of PyKota earlier
535        than 1.16alpha7, then remove the *cupsFilter lines in your
536        PPD files for each already managed printer. Each
537        line to remove is of the form :
538       
539          *cupsFilter: "application/vnd.cups-postscript 0 /usr/share/pykota/pykota"
540       
541        This means that each time the pstops filter will be executed, it will
542        pass the job's data through the pykota filter which is present in
543        /usr/share/pykota
544       
545        Don't touch anything else, especially any other *cupsFilter line.
546        Then save each of these files.
547       
548        Then, the easiest is to directly modify the DeviceURI lines
549        in /etc/cups/printers.conf, you just have to put
550        'cupspykota:' in front of what is already on these lines.
551        For example, replace :
552   
553            DeviceURI socket://myprinter.example.com:9100
554       
555        with :   
556   
557            DeviceURI cupspykota:socket://myprinter.example.com:9100
558           
559        or :   
560       
561            DeviceURI cupspykota://socket://myprinter.example.com:9100
562       
563        Save the file and restart CUPS.
564       
565        Here too, you may find it interesting to use the pkhint command as
566        described above to help with manual configuration of the file
567        /etc/pykota/pykota.conf
568
569  - LPRng Printing System :
570 
571    For each printer on which you want to use PyKota :
572   
573        Modify the printer's entry in /etc/printcap : you have to add
574        the three following lines :
575       
576          :achk=true:\
577          :as=/usr/share/pykota/lprngpykota:\
578          :ae=/usr/share/pykota/lprngpykota:\
579         
580        This will tell LPRng to activate accounting, and use the lprngpykota
581        accounting filter both at the start and at the end of printing.
582       
583    When all modifications are done, just save the /etc/printcap file and   
584    restart LPRng :
585   
586          $ /etc/init.d/lprng restart
587         
588        or :   
589     
590          $ /etc/rc.d/init.d/lprng restart
591         
592        or any similar command depending on your operating system. 
593       
594    NB : the pkhint command can't be used with LPRng for now, so you   
595         have to modify /etc/pykota/pykota.conf carefully. The comments
596         in this file will help you.
597     
598Now you can begin to populate the PyKota's database with printers,
599users and groups :
600 
601Add printers and users to the quota system and set their quota values :
602
603Starting from version 1.18alpha2, the preferred command to manage
604printers is named pkprinters
605
606    $ pkprinters --help
607   
608    will tell you how to create, manage or delete printers and
609    printers groups.
610   
611    $ pkprinters --add --charge 0.05 hp2100
612   
613    would add the printer named hp2100 with a price per page
614    of 0.05 unit.
615
616Now set quotas for users on this printer :     
617
618    $ edpykota --add -P hp2100 -S 40 -H 50 user1 ... userN
619       
620    launching edpykota without any argument or with the --help
621    command line option will show you all the possibilities.
622   
623    by default, each user is limited by "quota", this means that on
624    each printer he can have a different soft and hard limit.
625    You may want to limit the user by his account balance value,
626    in which case, the print quota is shared between all printers
627    instead of being different. To do this, use the following :
628   
629    $ edpykota --add -P hp2100 --limitby balance --balance 10 user1 ... userN
630   
631    This will put 10 $ (or Euros, PyKota doesn't care) on each user's account
632    balance, and tell PyKota to limit them by their account balance value.
633    Whenever they print on any printer, their account balance value is
634    decreased by an amount which depends on the particular price per page
635    and per job that you may have defined on the printer with edpykota's
636    --charge command line option.
637    Soft and Hard limits are not used if "--limitby balance" is used,
638    but you can define a "poorman"'s threshold in /etc/pykota/pykota.conf
639    to obtain a similar result (warning message when quota is low).
640
641Restart CUPS or LPRng, for example under Debian GNU/Linux systems :         
642
643    $ /etc/init.d/cupsys restart
644   
645  or :
646 
647    $ /etc/init.d/lprng restart
648       
649Your users now should be able to print but not exceed their
650printing quota.
651
652To see printer quota usage on printer hp2100, you can use :
653
654    $ repykota --printer hp2100
655   
656or :
657
658    $ repykota
659   
660    which will print quota usage for all users on all printers,
661    along with totals, if you are a PyKota Administator. If you are
662    a regular user, only your own quota report will be produced.
663   
664Quota reports are also available remotely by using the CGI script
665printquota.cgi provided in the cgi-bin/ subdirectory. You can
666also use the CSS stylesheet present in the stylesheets/ subdirectory
667and put it at your web server's DocumentRoot, to benefit from a nicer
668look, especially quota violations will appear in different colors.
669
670For additionnal security concerns, please give a look at the SECURITY
671file which is part of this software.
672
673To diagnose a problem when something doesn't work as expected,
674please read the very first entry in the FAQ document.
675           
676============================================================
677
678Additionnal tools :
679-------------------
680
681Some people have developped tools around PyKota, and make
682them available under the GNU General Public License :
683
684  - Kanakorn Horsiritham developped phpPykotaAdmin which is
685    a web based database independant administrative GUI,
686    written in PHP.
687 
688      http://opensource.psu.ac.th/~kanakorn/mambo/
689     
690    He was also kind enough to write an installation guide 
691    in english for CUPS and PyKota with phpPykotaAdmin on Fedora
692    Core 3. You'll find this document on the same website.
693   
694    This great software currently at version 0.3 is a wonderful
695    basis for an administrative GUI since it only depends on
696    PyKota commands to be present to successfully manage
697    PyKota's database.
698 
699Additionnal software will be listed here when they will be 
700ready.
701
702============================================================
703
704Mailing list :
705--------------
706
707  A mailing list is dedicated to Pykota, you can subscribe to it
708  or consult its archives at :
709 
710    http://cgi.librelogiciel.com/mailman/listinfo/pykota
711   
712  The mailing list is the preferred way to obtain support, because 
713  all members can help and can also benefit from the solutions
714  proposed by other members.
715 
716  Posts by non-members are usually rejected.
717 
718  The mailing list language is english and only english.
719   
720IRC :   
721-----
722
723  You can also chat with us :
724 
725        /server irc.freenode.net
726        /join #pykota
727       
728  Preferred language on this channel is english, but french     
729  is also accepted. Try to avoid exposing complex problems
730  in french because english speaking people on the channel
731  wouldn't benefit from the solutions.
732 
733  PyKota's main author is known as 'tamere' on IRC.
734   
735============================================================
736   
737Please e-mail bugs to the mailing list at : pykota@librelogiciel.com
738or to the main author at : alet@librelogiciel.com (Jerome Alet)
Note: See TracBrowser for help on using the browser.