Reader small image

You're reading from  CUPS Administrative Guide

Product typeBook
Published inSep 2008
Publisher
ISBN-139781847192585
Edition1st Edition
Tools
Concepts
Right arrow
Author (1)
Ankur Shah
Ankur Shah
author image
Ankur Shah

Ankur Shah has been working with Linux/AIX for last 4 years as a System Administrator. His previous assignment was with Packt Publishing, where he worked as System Administrator and also started implementing CUPS. He completed his graduation in Computer Engineering from Nagpur University, India. He is currently working as a SAP Basis Administrator and also started working on Governance Risk and Compliance for access Control. He is also interested in Oracle Database Administration and Security. He is the biggest fan of Kajol (a Bollywood actress) and dedicates this book to her. The day her movie releases is a day of celebration for him and he only parties once a year - 5th August - that's Kajol's birthday. It goes without saying that he watches all her movies several times - often dragging his friends and family to participate in his madness.
Read more about Ankur Shah

Right arrow

Chapter 8. Monitoring CUPS

The Common UNIX Printing System (CUPS) is actually a printer management tool, and thus monitoring CUPS always remains a very essential activity to to make the best use of the resources available. Monitoring CUPS will allow us to take action quickly should something go wrong.

Using the lpstat Command

The lpstat command displays the status of the CUPS service, printers, classes, and jobs. It supports a number of options. If the command is used without any options, it displays the job queues for the current user:

$lpstat
cupstest-3 kajol 8192 Tue Aug 05 13:24:43 2008
cupstest-4 kajol 8192 Tue Aug 05 13:25:34 2008

To check whether the CUPS server is running, use the -r option.

$lpstat -r
scheduler is running
$lpstat -d
system default destination: cupsclass

The above command gives information about the default destination printer or class. The output following the command shows that the default destination of the system is cupsclass.

$lpstat -c cupsclass

This shows the...

Using the lpstat Command


The lpstat command displays the status of the CUPS service, printers, classes, and jobs. It supports a number of options. If the command is used without any options, it displays the job queues for the current user:

$lpstat
cupstest-3 kajol 8192 Tue Aug 05 13:24:43 2008
cupstest-4 kajol 8192 Tue Aug 05 13:25:34 2008

To check whether the CUPS server is running, use the -r option.

$lpstat -r
scheduler is running
$lpstat -d
system default destination: cupsclass

The above command gives information about the default destination printer or class. The output following the command shows that the default destination of the system is cupsclass.

$lpstat -c cupsclass

This shows the printer class and the member printers belonging to that class. If a particular class is not specified, then the output shows all classes along with their member printers.

members of class cupsclass:

cupsprinter1

cupsprinter2

$lpstat -v cupsprinter2

The command above will show the device to which...

Overview of the access_log File


The access_log file lists each HTTP resource that is accessed by a web browser or a CUPS/IPP client. The file contains the lines specified in the following log format, which is an extension of the Common Log Format used by many web servers and web reporting tools.

Note

The "Common Log Format" is a standardized text file format used by web servers while generating log files. As the format is standardized, the files may be analyzed by a variety of analysis programs.

The syntax of the access_log file is :

host group user date-time \"method resource version\"
status bytes iPP-operations ipp-status
  • Hostname: The host field contains the IP address or hostname that can be seen if the "HostNameLookups" directive is enabled in the cupsd.conf file.

  • Groupname: The value always remains "-" for the group field.

  • Username: The user field is the authenticated username of the requesting user. If no authenticated username is supplied for the request, then this field contains...

Overview of the error_log File


The error_log file displays messages from the scheduler such as "warnings", "errors", and so on:

  • Level: The level field contains the type of message:

    • A: Alert message (LogLevel alert)

    • C: Critical error message (LogLevel crit)

    • D: Debugging message (LogLevel debug)

    • d: Detailed debugging message (LogLevel debug2)

    • E: Normal error message (LogLevel error)

    • I: Informational message (LogLevel info)

    • N: Notice message (LogLevel notice)

    • W: Warning message (LogLevel warn)

    • X: Emergency error message (LogLevel emerg)

  • Time of Printing: The date-time field contains the date and time when the page started printing. The format of this field is identical to the data-time field in the page_log file.

  • Message: This field contains free-form textual messages. In the following examples of the error_log files, the last field contains messages of this type.

The syntax for the error_log file is level date-time message.

The following are the some examples of entries in the error_log file ...

Overview of snmp.conf


Since CUPS is a printer management system working on networking protocols, SNMP will be an integral part of the CUPS system. The configuration file snmp.conf resides in /etc/cups, and contains various directives, which determine the behavior of the SNMP printer discovery backend. The file contains the directive name followed by its value. The number sign "#" is used to specify the comments.

Currently, the SNMPv1 protocol is being used by the SNMP backend to discover network printers in CUPS and help to determine the correct device URI and the vendor, and the driver of each printer. IT expects that the future release of CUPS will have support for all SNMP versions including, SNMPv2, v2c, and v3.

SNMP actually collects information from the MIB (Management Information Base) host along with port probes to get this information. It is expected that, in future, CUPS will start supporting the new Port monitor MIB as well. The following are some of the key definitions related...

How SNMP Behaves in the CUPS Web Interface


In the CUPS web interface under the Administration tab, the option Find New Printers is used to discover printers that support SNMPv1.

This will search and list the available network printers. The discovery of printers is based on the directive configuration done in the /etc/cups/snmp.conf file. On the basis of the search list, you can add a printer using the Add This Printer option. The process is very similar to the Add Printer wizard, which we have already discussed in Chapter 3.

Overview of Basic Debugging in CUPS-SNMP

In the snmp.conf, we started discussion about various debugging levels in CUPS support. If the directive DebugLevel is set to anything other than 0, you will get the output accordingly. The debugging mode can be made active using the following command.

As the SNMP backend supports debugging mode, the command for setting up debugging mode changes depending on the shell prompt. The SNMP backend is located at /usr/lib/cups/backend...

Overview of mailto.conf


The CUPS provides the facility to send notifications through email. It can be done by integrating the local mail server with CUPS. The configuration file is /etc/cups/mailto.conf, and contains several directives and the characteristics and behavior of the local mail server and email notification for CUPS. We normally use each of the following directives in our daily communication done through mail.

The Cc Directive

The directive Cc (carbon copy) is used to specify an additional recipient for all email notifications. By default, the value directive is not set and the email is sent only to the administrator. The following examples shows that how email IDs can be specified with this directive.

Cc kajol@cupsgrp.com
Cc Kajol Shah <ks@cupsgrp.com>
The From Directive

This directive is used to specify the sender's name in the email notifications. By default, the ServerAdmin address specified in the cupsd.conf file is used. The following are some examples that show...

Monitoring SNMP Printers


As discussed, CUPS supports SNMPv1 for discovering SNMP enabled printers. This Simple Network Management Protocol-SNMP is used for managing networking printers. We can use any network monitoring tools that supports SNMP for monitoring these SNMP-enabled printers. You can check various open-source network monitoring tools at:

http://www.openxtra.co.uk/network-management/monitor/open-source/

Note

I would recommend you to use Cacti, which is a frontend to an RRDTool (Round Robin Database Tool) that collects and stores data in a MySQL database. The frontend is completely written in PHP. The advantage of Cacti over other network monitoring tool is that it has built-in SNMP capabilities and like other monitoring tools such as Nagios, it has its internal mechanism to check certain aspects of the infrastructure. It also provides a frontend for maintaining customized scripts, which an administrator normally creates. But the most important factor is that it is much easier...

Summary


In this chapter, we have discussed how to monitor printers and print jobs using CUPS. You've seen how to use the lpstat command, the access_log file and the error_log file to help you monitor printing on your network. We have also discussed how SNMP helps CUPS to search for printers. We have seen how the setup of email helps users, and then the administrator, in conveying some important messages. Finally, we also discussed how Cacti can be used to monitor our printer with the help of SNMP.

lock icon
The rest of the chapter is locked
You have been reading a chapter from
CUPS Administrative Guide
Published in: Sep 2008Publisher: ISBN-13: 9781847192585
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime

Author (1)

author image
Ankur Shah

Ankur Shah has been working with Linux/AIX for last 4 years as a System Administrator. His previous assignment was with Packt Publishing, where he worked as System Administrator and also started implementing CUPS. He completed his graduation in Computer Engineering from Nagpur University, India. He is currently working as a SAP Basis Administrator and also started working on Governance Risk and Compliance for access Control. He is also interested in Oracle Database Administration and Security. He is the biggest fan of Kajol (a Bollywood actress) and dedicates this book to her. The day her movie releases is a day of celebration for him and he only parties once a year - 5th August - that's Kajol's birthday. It goes without saying that he watches all her movies several times - often dragging his friends and family to participate in his madness.
Read more about Ankur Shah