|
|
BROWSE
All Titles WordPress Web Services SOA BPEL Web Graphics & Video Web Development RAW Portugues, Espanol, Italiano, French PHP/MySQL Oracle Open Source Networking & Telephony Moodle Microsoft & .NET Linux Servers jQuery Joomla! JBoss Java e-Learning e-Commerce Dynamics Drupal CRM Cookbook Content Management Beginner Guides Architecture and Analysis AJAX Future Titles Recently Published Titles Want to know more about Packt's Article Network? Interested in contributing your article ideas? Please visit our FAQ for more information. See More In this second part of this two part article series by Ankur Shah, we will learn how Simple Network Management Protocol (SNMP) helps CUPS discover the printer and help other networking tools such as Cacti in managing printers. See More |
Monitoring CUPS- part1
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 CommandThe 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 To check whether the CUPS server is running, use the -r option. $lpstat -r 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: The command above will show the device to which cupsprinter1 is attached. If no printers are specified, then the output will list all printers along with device-uri information. device for cupsprinter2: ipp://cupsserver.cupsgroup.org/printers/cupsprinter2 This shows a status summary for all printers and classes on the network. The summary includes the default destination, a list of classes and their member printers, and a list of printers and their associated devices. The output is equivalent to using the -d, -c, and -v options simultaneously. system default destination: cupsclass This command shows if printers are currently accepting jobs. If no printers are specified, then it will list all printers. cupsprinter1 accepting requests since Mon 16 Jun 2008 02:28:14 PM IST This shows whether the printer cupsprinter1 is enabled and if it is currently printing a job. If no printers are specified then all the printers are listed. printer cupsprinter1 is idle. enabled since Mon 16 Jun 2008 02:28:14 PM IST This shows the job queues on the specified destinations. If no destinations are specified then all jobs are shown. $lpstat -t This displays status information for all printers, which is equivalent to using the -r, -d, -c, -v, -a, -p, and -o options. scheduler is running This command displays printers, classes, or jobs in a long list. $lpstat -u This shows a list of print jobs queued by the specified users. If no users are specified, it lists the jobs queued by the current user. cupsprinter2-5711 kajol 1449984 Wed 18 Jun 2008 03:12:55 PM IST The above command specifies an alternative server for CUPS. It uses the port number that is specified along with the server. If no port is specified, then it will connect to the default port 631. $lpstat -U username You can specify an alternative username with the -U option $lpstat -R : $lpstat -W all This shows the ranking of print jobs. This command specifies which jobs to show, complete, incomplete (the default), or all. This option must appear before the -o option and any printer names: $lpstat -W completed -o cupsprinter2 The output will be as follows cupsprinter2-5709 kajol 483328 Wed 18 Jun 2008 03:10:45 PM IST This command forces encryption when connecting to a print server. Overview of the access_log FileThe 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. 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"
192.168.0.35 - - [18/Jun/2008:10:46:37 +0530] Overview of the error_log FileThe error_log file displays messages from the scheduler such as "warnings", "errors", and so on:
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 : I [05/Jun/2008:15:23:46 +0530] Job 224 queued on 'cupsprinter' by 'hritik'. How SNMP Helps Search for Network PrintersMost of the network printers that CUPS uses, use one of these three TCP/IP-based protocols:
Now apart from these protocols, CUPS also uses another networking protocol—SNMP that is used to search for networked printers. In future, CUPS will support other networking protocols such as multicast DNS service for the same purpose. First, we will discuss how the configuration of SNMP is done within CUPS (/etc/cups/snmp.conf), and then we will check how it actually works in the web interface. Before we start discussing the snmp.conf file, let us see the some of the key terms related to the file. The SNMP stands for "Simple Network Management Protocol" and consists of three key components:
Overview of snmp.confSince 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 to MIB. MIB stands for Management Information Base, which is a collection of information organized hierarchically. It is accessed using a protocol such as SNMP. There are two types of MIBs:
AddressThis directive specifies a broadcast address to be used when discovering printers. We can also specify multiple address lines to scan different subnets. The following examples show various values that can be given along with this directive. The value @LOCAL denotes broadcasting across all LANs. The value @LOCAL is also the default value for this directive, while @IF broadcasts to the named interface. You can also provide the broadcast address or the IP address with the directive for which broadcasting needs to be done. Address @LOCAL CommunityThe directive Community is used to specify a community name that can be used while discovering printers. The default value for this directive is public. You can specify multiple lines to scan different SNMP communities. Community public DebugLevelThe DebugLevel directive denotes the specified debugging level to be used when searching for network printers. This directive can have four debugging levels. It starts from 0 and ends with 3: DebugLevel 0 In the above example: Level 0: It is used to disable debugging, and hence does not produce any debugging information. It is also the default level of debugging. Level 1: It generates basic debugging information. Level 2: It also prints the SNMP messages along with the basic debugging information. Level 3: This level adds a hexadecimal code dump of the network data. DeviceURIThe directive DeviceURI is used to specify a regular expression, which is enclosed in double quotes. This URI is checked with the SNMP device description OID returned by a printer. OID stands for Object Identifier. These uniquely identify the objects managed in the MIB hierarchy. This hierarchy can be depicted as a tree, the levels of which are assigned by different organizations. If the given description matches the regular expression, the CUPS backend will list each of the device URIs that follow by regular expression. The following are some examples that show DeviceURI directives along with the regular expression and the actual device URI. Please note that here any occurrence of %s is replaced by the device's IP address or hostname. Here xx, yyy, and zzzz are a part of the regular expressions. We can use the make and model of the printer for these. If no URIs are listed within this directive, then the requested device will be ignored. These directives are processed serially in the order specified in the snmp.conf file, until a match is found. The following are some of the examples of the directive: DeviceURI "xx.*" socket://%s HostNameLookupsThis directive is used to specify whether the printer addresses are converted to hostnames, or remain as numeric IP addresses. The default value for this directive is off. HostNameLookups off MaxRunTimeThe MaxRunTime directive specifies the maximum time (in seconds) spent by the SNMP backend searching for printers across the network. As the following example shows, it can contain any integer value. The default value for this directive is 10 seconds. MaxRunTime 10 SummaryIn this article, we have covered the usage of lpstat Command. We also learnt about snmp.conf in detail, got an overview of the access_log file and error_log file. If you have read this article you may be interested to view : CUPS Administrative Guide
About the AuthorAnkur 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. Books from Packt
|
|
| ||||||||