root / pykota / trunk / README @ 2351

Revision 2351, 26.9 kB (checked in by jerome, 19 years ago)

Typo

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