root / pykota / trunk / README @ 2348

Revision 2348, 26.7 kB (checked in by jerome, 19 years ago)

Rewording

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