Trouble Shooting Wiki

Basic Debugging in CUPS-SNMP

From TroubleshootingWiki

Jump to: navigation, search
CUPS
Official Page
Project Documentation
Download


Source Book
200px-1847192580.jpg
ISBN 978-1-847192-58-
Publisher Packt Publishing
Author(s) Ankur Shah
Source Book
200px-Abc.jpg
ISBN 978-1-847191-44-1
Publisher Packt Publishing
Author(s) Tessa Blakeley Silver

Contents

[edit] LogLevel (Directive of cupsd.conf)

This directive defines the log behaviours in the error_log file. If the value is set to none, then it will log nothing. If it is set to info, then the server will log general information such as all request and state changes in error_log. This is the default value for this directive. The following are the examples of this directive:

LogLevel none

LogLevel info

If you need to troubleshoot a problem with CUPS, then it should be set to debug or debug2. The difference between these two directives is that the first one logs the most important logs, while the latter logs everything. These directives will be displayed as:

LogLevel debug

LogLevel debug2

The value warn logs all the errors and the warning, while the error will log only errors.

LogLevel warn

LogLevel error

The other options include emerg,alert,crit, and notice. Here are some examples:

LogLevel emerg

LogLevel alert

LogLevel crit

LogLevel notice

emerg - It logs the emergency conditions that prevent the server from running

alert - It logs the alerts that must be handled immediately

crit - It will log the critical errors that don't prevent the server from running

notice - It logs temporary error conditions

[edit] Error on adding printer

On adding a Samba printer using the lpadmin command, If you receive an error-client-not-possible message, then it is likely that there is a typo in the URI or that the symbolic link to the smbspool is missing or pointing to the wrong location.

After adding the printer, it needs to be enabled before it can accept any print jobs. The default status of a printer added with the above lpadmin command is stopped, rejecting jobs. Use the following commands cupsenable and accept to start the printer, and tell it to accept jobs:

$sudo cupsenable cupsprinter

$sudo accept cupsprinter

You can check the status of all the printers with the following command:

$lpstat a

It should show that the printer is accepting jobs. At this point, try to print using the lpr command. If that doesn't work, try restarting CUPS.

If the problem continues, set the directive LogLevel to debug in the cupsd.conf file. It should be in the /etc/cups/ directory. After doing this, restart CUPS, and read the /var/log/cups/error_log file. The log file can usually explain the problem you are having.

[edit] DebugLevel (Directive of snmp.conf)

The 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

DebugLevel 1

DebugLevel 2

DebugLevel 3

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.

[edit] 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/snmp when using the Bourne, Bash, Z, or Korn shells. The following command will output verbose debugging information into the cupssnmp.log file when using those shells:

$CUPS_DEBUG_LEVEL=1 /usr/lib/cups/backend/snmp 2>&1 | tee cupssnmp.log

On Mac OS X, the SNMP backend is located /usr/libexec/cups. The following command will be used:

$CUPS_DEBUG_LEVEL=1 /usr/libexec/cups/backend/snmp 2>&1 | tee cupssnmp.log

If you are using the C or Tcsh shells, you can use the following command:

$(setenv CUPS_DEBUG_LEVEL 1; /usr/lib/cups/backend/snmp) |& tee cupssnmp.log

An example of the output might look like this:

DEBUG: Scanning for devices in "public" via "@LOCAL"...

DEBUG: 0.000 Sending 46 bytes to 192.168.0.255...

DEBUG: 0.001 Received 50 bytes from 192.168.0.250...

DEBUG: community="public"

DEBUG: request-id=1213875587

DEBUG: error-status=0

DEBUG: 1.001 Scan complete!

The above output shows that doesn't find any printer at the specified DeviceURI. The above shows the output at the basic debugging level; more information can be found if we use level 2 or 3.

[edit] Additional References

  • For instructions on Installing CUPS, Click here

[edit] Source

The source of this content is Chapter 5: CUPS Server Management of CUPS Administrative Guide by Ankur Shah (Packt Publishing, 2008).

Personal tools