root / pykota / trunk / README @ 3506

Revision 3506, 19.0 kB (checked in by jerome, 15 years ago)

Removed all support for pysnmp v3.x
Applied the patch from Ilya Etingof and Börje Sennung to fix #47.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
RevLine 
[695]1# $Id$
2
[3259]3PyKota - Print Quotas for CUPS
[695]4
[3481]5(c) 2003-2009 Jerome Alet <alet@librelogiciel.com>
[3259]6This program is free software: you can redistribute it and/or modify
[873]7it under the terms of the GNU General Public License as published by
[3259]8the Free Software Foundation, either version 3 of the License, or
[873]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
[3259]17along with this program.  If not, see <http://www.gnu.org/licenses/>.
[873]18
[761]19====================================================================
[695]20
[1052]21READ SPECIAL LICENSING AND REDISTRIBUTION TERMS IN THE FILE 'LICENSE'
[761]22
23====================================================================
24
[1154]25PyKota features :
26-----------------
[695]27
[3038]28        http://www.pykota.com/software/pykota/features/
[2638]29
[1154]30====================================================================
[3413]31
[739]32Planned features are described in the TODO file.
33
[3104]34Actually three (or an infinity of) page accounting methods are
[980]35implemented :
[695]36
[1475]37  - The 'hardware' method consists in querying the printer (via SNMP
[3413]38    or Netatalk or any other method of your choice) for its internal
[3104]39    pages counter.
[1600]40    This is done both at the beginning and at the end of a
[3413]41    print job. The counters difference is then used to
[1186]42    decrease the user's account balance or increase his quota usage.
[3413]43
[1475]44  - The 'software' method consists in delegating the computation of the
[980]45    job's size in number of pages to any external command of your choice.
46    The command can read the job's data from its standard input and MUST
[1186]47    output the job's size on its standard output. Changes to the user
[3104]48    account are reported immediately. PyKota by default internally
[3282]49    uses the code from pkpgcounter which can handle a large number
50    of Page Description Languages, and can parse documents produced
51    either by GhostScript or by a number of native printer drivers.
[3104]52    Of course this means you have to install pkpgcounter if you want to
53    use the default PDL parser.
[3282]54    An up-to-date list of supported Page Description Languages and their
55    level of support is available from :
[3413]56
[3282]57      http://www.pykota.com/software/pkpgcounter/
[3413]58
59  - The 'ink' method consists in using pkpgcounter's code to compute
[3104]60    how much of each page is covered by ink in each color of a particular
61    colorspace chosen between CMYK, CMY, RGB, and BW (grayscale).
62    These values are then summed up together and multiplied by a set
63    of coefficients defined in PyKota's configuration files.
[3413]64
[3104]65PyKota is known to work with most printers, excepted GDI ones (Windows
66only). At least one of the accounting methods above should work
67for you. If it's not the case, please report the problem : tell us
68the exact brand and model of the printer, if possible the driver used,
69and send some test files.
[724]70
[695]71============================================================
72
[2001]73SUPPORT CONTRACTS:
74==================
75
76  You can now purchase 8x5x365@NextBusinessDay Technical
[3413]77  Support Contracts from us. The yearly fee is computed with
[2126]78  the following formula :
[2001]79
80  (100.0 * NbPrintServers) + (2.5 * NbPrinters) + (0.04 * NbUsers) EUROS.
[3413]81
[2542]82  This fee includes the VAT, and a free subscription to Official
83  PyKota packages.
[2001]84
85  Please send an email to alet@librelogiciel.com if you're
[3413]86  interested in purchasing such a contract.
[2001]87
[2126]88  Remember that purchasing a support contract for Free Software like PyKota
[3413]89  is a great way to show your appreciation for the work already being done
[2126]90  on this project, and will help to improve this software in the future.
91
[2001]92============================================================
93
[695]94INSTALLATION:
95=============
96
[1186]97NB :
98====
[887]99
[2714]100  PyKota's documentation is available as DocBook SGML sources
101  files in the pykota/docs directory. If you obtained an
102  Official package, in the same directory you'll also find
[3104]103  the documentation in HTML and PDF formats. Otherwise you
104  have to compile it into HTML or PDF yourself by using
105  the appropriate tools as installed on your system.
[3413]106
[2714]107  PyKota's collaborative documentation is available from :
[3413]108
[2909]109    http://www.pykota.com/wiki/
[3413]110
[1397]111  You may learn more about PyKota, if it fits your own organization,
112  its internal working, and some potential performance drawbacks and
[2054]113  how to avoid them, in a document created by Ryan Suarez at :
[3413]114
[2005]115    http://archive.macosxlabs.org/forum/webcrossing_archive/documentation/Pykota_and_CUPS/Pykota_and_CUPS.html
[1034]116
[1651]117  You may also find the following document interesting :
[3413]118
[1651]119    http://es.tldp.org/Tutoriales/doc-openldap-samba-cups-python/
[3413]120
121  This document, written in Spanish by Sergio Gonzalez Gonzalez,
[1651]122  describes the integration of PyKota into an OpenLDAP + Samba
[3413]123  + CUPS installation. Even for people who can't read spanish
[1651]124  this document is really interesting, and contains lots of
125  screenshots.
[3413]126
127
128Prerequisite :
[714]129--------------
[3413]130
[2714]131  See :
[3413]132
[2909]133    http://www.pykota.com/wiki/Dependencies
[3413]134
[2714]135  for an up-to-date list, or see below (maybe not up-to-date) :
[3413]136
[714]137  You need to have the following tools installed on the CUPS Server :
[3413]138
[3282]139    - CUPS (http://www.cups.org). PyKota v1.27 requires CUPS v1.3.4 or higher.
[3473]140    - Python v2.4 or higher (http://www.python.org)
[1886]141    - eGenix' mxDateTime Python extension (http://www.egenix.com)
[2345]142    - The pkpgcounter command line tool, version 1.56 or higher. This
[3413]143      tool is now mandatory for PyKota to work.
[2909]144      (http://www.pykota.com/software/pkpgcounter)
[3413]145    - The pkipplib Python library (http://www.pykota.com/software/pkipplib)
[1771]146    - The JAXML Python module to be able to dump datas in the XML format.
[1886]147      (http://www.librelogiciel.com/software/)
[3413]148    - The Python-PAM module if you need the pknotify command to be able
[3006]149      to check usernames and passwords. (http://www.pangalactic.org/PyPAM)
[1771]150    - The Python-SNMP module to query printers for their page counter.
[3413]151      (http://pysnmp.sourceforge.net)
[3506]152      IMPORTANT : version v4.x is now REQUIRED.
153      Versions 3.x or earlier are not supported anymore.
[1771]154    - The Python-OSD module to use the graphical print quota reminder.
[2189]155      (http://repose.cx/pyosd/)
[1771]156    - SNMP tools (specifically the snmpget command) if you prefer to
[3287]157      use your own script to request query printers instead of PyKota's
[3473]158      internal SNMP handling facilities, which is not recommended...
159      (http://www.net-snmp.org). You probably don't need this.
[919]160    - Netatalk (specifically the pap command) if you plan to
161      request your printer's lifetime page counter via AppleTalk.
[3473]162      (http://netatalk.sourceforge.net). You probably don't need this.
[3413]163    - The ReportLab Python module (http://www.reportlab.org) if you want
[3473]164      to have PyKota generate nice banners, invoices or receipts in PDF for you.
[3413]165    - The Python Imaging Library (aka PIL) module
166      (http://www.pythonware.com/downloads) if you want to have PyKota
[3473]167      generate nice banners, invoices or receipts in PDF for you.
[1043]168    - PostgreSQL's PygreSQL Python extension and the PostgreSQL client
[2597]169      libraries if you plan to use PostgreSQL as the database backend.
[1886]170      (http://www.postgresql.org and http://www.pygreql.org)
[3413]171 or
172    - python-ldap Python module and the OpenLDAP client libraries
[2597]173      if you plan to use an LDAP server as the database backend.
[1886]174      (http://www.openldap.org and http://python-ldap.sourceforge.net)
[3413]175 or
[2597]176    - SQLite v3.2.7 and the SQLite libraries if you plan to use SQLite
[3413]177      as the database backend (http://www.sqlite.org). You also need the
[2597]178      PySQLite module v2.0.5 or higher (http://www.pysqlite.org)
[2638]179 or
[3413]180    - The MySQL-python bindings.
181      IMPORTANT: If you are using MySQL 4.1, then MySQL-python must be
[2638]182      version 1.2 or greater. Version 1.0 does not work correctly with 4.1.
[3413]183
184
[1771]185  On Intel i386 architecture, and for performance reasons, it is
[3408]186  suggested that you install the Python accelerator Psyco, available from :
[3413]187
[1570]188      http://psyco.sourceforge.net
[3413]189
190  Under Debian :
191
[1571]192      $ apt-get install python-psyco
[3413]193
194  Other architectures may be supported as well in the future, check
[1600]195  this on Psyco's website.
[3413]196
197  Installing Psyco is not mandatory, but may really speed the parsing
[3473]198  of some print jobs. Don't install it if you don't want or don't have a
199  supported architecture.
[3413]200
[2597]201  You need to have the following tools installed on the database
202  server :
[3413]203
[1886]204    - PostgreSQL (http://www.postgresql.org)
[3413]205
206  or
207
[1886]208    - OpenLDAP, or any other LDAP server (http://www.openldap.org)
[3413]209
210  or
211
[2597]212    - SQLite, v3.2.7 or higher (http://www.sqlite.org).
213      Beware : with SQLite the database server and the print
214      servers MUST be the very same machine.
[3413]215
216  or
217
[3104]218    - MySQL 4.1 or higher. 5.x is recommended.
[3413]219
[714]220  This list of prerequisite software may change in the future, when
[3413]221  PyKota will support more functionnalities you will be given
[714]222  alternatives.
[3413]223
224  Of course the Print Server and the database server can be the
225  very same machine if you've got a tiny network, or you can have
[2597]226  multiple Print Servers all storing their quotas on the same database
227  server if you've got a bigger network. (NB : with SQLite, the database
228  can't be shared between several print servers)
[3413]229
230Hint :
[1886]231------
232
[3413]233  - The Debian GNU/Linux distribution is to our knowledge the
[3081]234    easiest distribution to install PyKota on, because almost all
[3408]235    of PyKota dependencies are already included.
[3104]236    We recommend you to use Debian's Etch distribution or
237    more recent. PyKota works fine on Sarge, but some additional
238    dependencies are missing in Sarge and have to be installed
239    manually.
[1886]240
[3413]241Then :
[714]242------
[3413]243
[2135]244Download the latest PyKota version from the Subversion tree :
[695]245
[3377]246    $ svn co http://svn.pykota.com/pykota/trunk pykota
[695]247
[1906]248You can now check if the dependencies are correct by typing :
[695]249
[2135]250    $ python checkdeps.py
[3413]251
[2234]252    An availability report for all the software needed by PyKota
253    will be displayed : you'll have to install the missing
254    software if you want PyKota to work correctly.
[3413]255
[1906]256To install the software, just type :
257
[2135]258    $ python setup.py install
[695]259
260You may need to be logged in with sufficient privileges (e.g. root)
261
[3081]262If you use Debian or Ubuntu, and want to use PostgreSQL as the
263database backend, just type :
264
[3201]265    $ pksetup debian
266
[3413]267or :
268
[3201]269    $ pksetup ubuntu
[3413]270
[3081]271and follow the instructions to install PyKota in interactive mode, then
272skip the remaining of the section below.
273
274Otherwise, you have to setup manually :
275
[1960]276Create a system user for PyKota :
277
[2135]278    $ adduser --system --group --home /etc/pykota --gecos PyKota pykota
[3413]279
[1960]280Put the user your printing system is run as in the pykota system group :
281
[2135]282    $ adduser lp pykota
[3413]283
[1960]284    NB : on our system, the CUPS printing system runs as system user 'lp'.
285    Please adapt this to your own system.
286
[3104]287Go to the initscripts/ subdirectory of PyKota's sources, and choose
[1600]288the appropriate storage backend for your configuration. Read carefully
[3104]289the associated README file, modify the initialization script to
290change the passwords, or, in the case of the LDAP backend, adapt it
291to your own LDAP DIT, and execute the initialization script
[3413]292to create an empty PyKota database. Upgrade scripts may be
[2269]293provided as well. NB : if you use PostgreSQL, a good way to
294make PyKota work first time is to modify PostgreSQL's pg_hba.conf
295to allow the 'trust' database connection mode. However once PyKota
296works it is HIGHLY RECOMMENDED TO CHANGE THIS TO A MORE SECURE
[3104]297VALUE. Look at the SECURITY document, PyKota's Official documentation
298and PostgreSQL's documentation for details on this subject.
[695]299
[3413]300Copy the conf/pykota.conf.sample and  conf/pykotadmin.conf.sample
301sample configuration files to ~pykota/pykota.conf and
302~pykota/pykotadmin.conf
[1905]303The installation script usually copies these files into /usr/share/pykota
[1198]304
[1979]305NB : You can move PyKota's configuration files elsewhere, they will
[3104]306be searched first in user pykota's home directory, then in /etc/pykota.
[1979]307
[3413]308You need to adapt these files to your own needs. Especially you may
309have to create sections named after your own printers, and change
310the administrator's email address which by default is
311root@localhost. Read and try to understand these two very well
312commented files, so that you'll encounter less problems later.
[1905]313
[1186]314The rest of the installation depends on your printing system :
315
[1185]316  - CUPS Printing System :
[3413]317
[1185]318    Once and for all :
[3413]319
[3270]320        Modify CUPS' cupsd.conf to make CUPS listen to 127.0.0.1:631
321        INSTEAD OF to an unix domain socket, in addition to any
322        external network interface CUPS might already be listening to.
[3413]323
324        Create a symbolic link to the cupspykota backend
[1185]325        in CUPS's backend directory :
[3413]326
[1185]327          $ cd /usr/lib/cups/backend
[1345]328          $ ln -s /usr/share/pykota/cupspykota cupspykota
[3413]329
330        If you use CUPS v1.2 or higher, please do this as well :
331
[2943]332          $ chmod 700 /usr/share/pykota/cupspykota
[3413]333
[2943]334          This allows the cupspykota backend to support other
335          backends which must be run as user root, like the
336          lpd backend for example.
[3413]337
[1185]338        Restart CUPS so that the new backend can be detected.
[3413]339
[1185]340          $ /etc/init.d/cupsys restart
[3413]341
342          for example under Debian, or any similar command depending
[3104]343          on your operating system of choice.
[3413]344
[1185]345    For new printers :
[3413]346
347        Go to CUPS management interface (http://localhost:631)
[1185]348        and choose the appropriate PyKota managed device depending
349        on the type of printer you use. For example, if your
350        printer is waiting on :
[3413]351
[1354]352            socket://myprinter.example.com:9100
[3413]353
354        Then choose :
355
[1354]356            cupspykota:socket://myprinter.example.com:9100
[3413]357
358        Configure your printer as usual.
359
360        Now double check /etc/pykota/pykota.conf
361
[1600]362        You should manually create a section named after the
[1402]363        printer you've just added, unless you have set
364        all options globally.
[3413]365
366        The new pkturnkey command can help you with correct settings
[3104]367        for your printers. To have pkturnkey give you some hints
368        about what to put into pykota.conf for a particular
369        print queue, just use its --doconf command line switch :
[3413]370
[3104]371          $ pkturnkey --doconf TheNameOfThePrintQueue
[3413]372
[2468]373        pkturnkey will try to tell you what is the best accounting
[1600]374        method for each printer and will print some lines you'll
375        just have to copy&paste in the appropriate sections in
376        /etc/pykota/pykota.conf
[3413]377
[2468]378        For more informations about what pkturnkey can do for you,
379        see pkturnkey's manual page or use the --help command
380        line switch :
[3413]381
[2468]382          $ pkturnkey --help | less
[3413]383
[1185]384        That's all.
[3413]385
[3104]386    For existing print queues :
[3413]387
[3104]388        You want to route the print queue through PyKota,
389        and you can do this in several manners.
[3413]390
[3104]391          $ pkprinters --add --cups TheNameOfThePrintQueue
[3413]392
393        or
394
[3104]395          if your printer's DeviceURI is something like :
[3413]396
[3104]397              socket://myprinter.example.com:9100
[3413]398
399          then you can do this :
400
[3104]401          $ pkprinters --add TheNameOfThePrintQueue
402          $ lpadmin -p TheNameOfThePrintQueue \
403                    -v cupspykota://socket://myprinter.example.com:9100
[3413]404
405        Finally, you could do it manually by modifying the
[3104]406        the DeviceURI lines in /etc/cups/printers.conf :
[3413]407        You would have to preprend 'cupspykota://' in front
[3104]408        of what is already on these lines. For example, replace :
[3413]409
[1354]410            DeviceURI socket://myprinter.example.com:9100
[3413]411
412        with :
413
[3104]414            DeviceURI cupspykota://socket://myprinter.example.com:9100
[3413]415
416        or :
417
[1354]418            DeviceURI cupspykota://socket://myprinter.example.com:9100
[3413]419
[3104]420        Save the file and restart CUPS for the changes to take effect.
[3413]421
[2470]422        Here too, you may find it interesting to use the pkturnkey command as
[1600]423        described above to help with manual configuration of the file
424        /etc/pykota/pykota.conf
[695]425
[1186]426Now you can begin to populate the PyKota's database with printers,
427users and groups :
[695]428
[3413]429Add printers and users to the quota system and set their quota values :
430
[2470]431You can either use pkturnkey, or do the same things manually by
[2714]432using the pkprinters, pkusers and edpykota command line tools :
[1345]433
[2714]434Create printers :
435
[1345]436    $ pkprinters --help
[3413]437
[1345]438    will tell you how to create, manage or delete printers and
439    printers groups.
[3413]440
[1402]441    $ pkprinters --add --charge 0.05 hp2100
[3413]442
[1402]443    would add the printer named hp2100 with a price per page
444    of 0.05 unit.
[1345]445
[2714]446Create users :
[1402]447
[3104]448    $ pkusers --add --limitby balance --balance 10.0 jerome
[3413]449
[2714]450    would create user jerome and give him ten credits to spend
451    on any printer.
[3413]452
[2714]453Finally create print quota entries :
[695]454
[3104]455    $ edpykota --add --printer hp2100 john paul george ringo
[3413]456
457    This will create print quota entries for The Beatles on
[2714]458    printer hp2100. The print quota entry holds the number of
459    pages printed on a particular printer for a particular
460    user, as well as optional page limits to be used instead
461    of balance limits. See pkusers and edpykota's manual
462    pages for details.
[3413]463
464Your users now should be able to print but not exceed their
[695]465printing quota.
466
[2234]467To see printer quota usage on printer hp2100, you can use :
[794]468
[2234]469    $ repykota --printer hp2100
[3413]470
[794]471or :
472
473    $ repykota
[3413]474
[794]475    which will print quota usage for all users on all printers,
[2054]476    along with totals, if you are a PyKota Administator. If you are
[1107]477    a regular user, only your own quota report will be produced.
[3104]478
[3413]479You can also use these commands :
480
481    $ pkusers --list
[3104]482    $ edpykota --list
[3413]483
[3104]484    $ pkusers --list john paul george ringo
485    $ edpykota --list --printer hp2100 john paul george ringo
[3413]486
[1107]487Quota reports are also available remotely by using the CGI script
[3413]488printquota.cgi provided in the cgi-bin/ subdirectory. You can
[1345]489also use the CSS stylesheet present in the stylesheets/ subdirectory
[3413]490and put it at your web server's DocumentRoot, to benefit from a nicer
[1402]491look, especially quota violations will appear in different colors.
[990]492
[2262]493For additionnal security concerns, please give a look at the SECURITY
[980]494file which is part of this software.
[2234]495
496To diagnose a problem when something doesn't work as expected,
[3104]497please read this FAQ entry :
498
499  http://otrs.librelogiciel.com/otrs/public.pl?ID=2
[3413]500
[695]501============================================================
502
[3408]503Mailing lists :
504---------------
[1979]505
[3408]506  A mailing list is dedicated to PyKota, you can subscribe to it
[958]507  or consult its archives at :
[3413]508
[3408]509    http://lists.pykota.com/mailman/listinfo/pykota
[3413]510
511  This mailing list is the preferred way to obtain support, because
[1600]512  all members can help and can also benefit from the solutions
[3413]513  proposed by other members.
514
[3408]515  Another mailing list, dedicated to developers, is available from :
[3413]516
[3408]517    http://lists.pykota.com/mailman/listinfo/pykota-devel
[3413]518
519  In this mailing list you can discuss implementation details, bugs,
[3408]520  ideas, and so on. All commit messages are also sent to this list.
[3413]521
[3408]522  Posts by non-members are rejected.
[3413]523
[3408]524  The mailing lists language is english and only english.
[3413]525
526IRC :
[1181]527-----
528
529  You can also chat with us :
[3413]530
[1181]531        /server irc.freenode.net
532        /join #pykota
[3413]533
534  Preferred language on this channel is english, but french
[1600]535  is also accepted. Try to avoid exposing complex problems
536  in french because english speaking people on the channel
537  wouldn't benefit from the solutions.
[3413]538
[1600]539  PyKota's main author is known as 'tamere' on IRC.
[3413]540
541Bug Tracker :
[3377]542-------------
543
544  You can report bugs to our bug tracker on the development website
545  at :
[3413]546
[3377]547      http://trac.pykota.com
Note: See TracBrowser for help on using the browser.