September 6, 2006

Tracking and charging for printing with PyKota

Author: Frank Tuzi

PyKota is a robust Linux-based open source print quota and print accounting system that runs via LDAP, MySQL, or PostgreSQL on the back end and CUPS and Samba on the front end. At our school, we have found it to be a powerful application capable of managing printers, users, groups, and accounting information using any currency.

In the spring of last year, the technology committee at Tokyo Christian University, where I work, investigated the possibility of managing the printing system of the college's computer labs. The committee hoped to capture usage data and also begin charging students for the printing services. After investigating the possible options, we decided upon the GPL-licensed PyKota.

As with any application, it is wise to have a well-thought-out plan for implementation. If you plan on incorporating PyKota into your system, I recommend you plan your implementation and do a pilot installation before the live installation

The installation process is by far the most difficult part of using PyKota. You can get access to the official, stable release only by purchasing a pass to the Web site for a $25 or €25 fee, or you can download the development release via CVS for free. I began with the CVS version, but because I needed assistance, I opted to purchase an account, and downloaded the stable ISO.

With PyKota, you need to install three main components:

  • The back end. You can use LDAP, MySQL or PostgreSQL.
  • The dependencies. PyKota depends on 17 other packages.
  • The PyKota application itself.

While the PyKota package comes bundled as RPM or DEB packages, the binary packages install only the PyKota Python scripts, and do not test to ensure all the dependency packages are installed. Installing the 17 dependencies did not go well on our Fedora Core 5 system. PyKota provide all the dependencies in an ISO file, but since all distributions tweak file and package names and locations, some of packages that PyKota provided would not install. It took me several hours to track down and install the Fedora versions of these packages.

After installing the dependencies, PyKota installed without incident. We chose PostgreSQL as our back end and CUPS as our print server. PyKota provided scripts to set up the database and instructions for connecting CUPS to PostgreSQL. The final step was to initialize the system and populate it with users and printers, which is completed with a few command-line instructions.

Setting up and using the system

Before using PyKota, you need to specify a number of options. For example, PyKota can be set to force users to prepay for a given number of printed pages at the beginning of the semester. When their quota gets close to zero pages, PyKota can warn the users. PyKota can charge per page and per job for each printer. PyKota can also set limitations based on users and groups, and can charge some users more or charge nothing at all. PyKota can also limit who has access to specific printers it manages.

We chose to bill students at the end of the school year, so we set up PyKota to keep an accounting of the pages each student printed, and send a usage report to the business office for billing purposes. Faculty and staff were not charged for printing, but we used PyKota to track the number of pages each non-paying person printed for later analysis.

PyKota does not operate via a GUI; all commands are entered via the command line. By using about seven different commands, PyKota administrators can manage printers and users, monitor the system, export data to the business office, and even print invoices. For example, to generate an on-screen usage report for all users, I enter repykota. By using command-line arguments, I can limit the report by printer, user, and group. I can manage printers with pkprinters and users with pkusers. PyKota is extremely powerful, and has a large number of options for each command. Each command has a man page and a help screen to assist users in using the commands, though I found them to be cryptic at times. Still, management of the system is a relatively easy process. There was a small learning curve for the command-line options, but after spending time deciphering the documentation and trying the commands, I now have no problems with the system.

In addition to the standard commands to monitor and manage printers and users, PyKota allows users to monitor their own print usage. Users can see reports of their printing activities while in the lab or from the Internet. They can also determine the cost of a print job before they print it. These simple commands are also available via the command prompt.

All systems have flaws, and PyKota is no exception. For example, at one point last spring, the print server stopped authorizing users to print. Because there is no PyKota GUI, I needed to go log file diving. I reset the CUPS log level to debug and discovered that access to the PostgreSQL server was denied. I submitted a request for information on the PyKota mailing list. The responses I received indicated that the problem was not a PyKota problem, but a PostgreSQL one. They pointed me in the right direction, and I fixed the problem, but I learned that PyKota must work in tandem with a variety of other applications to work successfully.

We have encountered few problems with PyKota; it works well and we are happy with its capabilities. But PyKota requires having people on staff with knowledge of the back end and the print server. We chose PostgreSQL as our back end even though no one here had used it before.


PyKota, with its ability to manage printers and users, has filled a gap for us. The college now has a way to monitor its printer and paper usage, equitably bill students for paper, and manage printers throughout the campus. In the future, we will integrate PyKota and CUPS with Samba to allow our Windows and Apple users access to the printing system. We would recommend PyKota to anyone interested in monitoring or charging for printer usage.


  • Enterprise Applications
Click Here!