LPRng-HOWTO: Status Monitoring and Logging

Next Previous Contents

## 13. Status Monitoring and Logging

Options used:

- `stalled_time#`time after which to report a stalled active job

The most commonly used tool for LPRng status is LPQ. However, the LPC command can be used, and you can also get real time logging of status to a remote host.

## 13.1 LPQ status reporting

The LPQ status display produced by LPRng has three formats.

## 13.2 LPQ Short Format (lpq -s)

This is one line per spool queue:

    % lpq -sa
    t1@astart110  (printing disabled) 1 job
    t2@astart110  (routed/bounce to t1@astart110.astart.com) 0 jobs
    t3@astart110  (forwarding to t3a@astart110.astart.com)
    t3a@astart110  (forwarding to t2@astart110.astart.com)
    t4@astart110  (subservers t5, t6)  0 jobs
    t5@astart110  (serving t4) 0 jobs
    t6@astart110  (serving t4) 0 jobs

Note that the name of the printer/host is first, followed by optional status information, followed by the number of jobs. Only printcap entries with spool queues have a jobs word in the last position. The `-a` option forces status for all queues or the queues in the `all` printcap entry to be returned.

The `stalled_time` (default 120 seconds) printcap option can be used to set a time after which active jobs will be reported as stalled.

## 13.3 LPQ Long Format (lpq default)

This is the default status display. It is a nicely formatted, extremely verbose format that is suitable for humble human interpretation. For example:

    % lpq -a
    Printer: t1@astart110  'Test Printer 1' (printing disabled)
     Queue: 1 printable job
     Server: no server active
     Status: finished operations at 09:44:00
     Rank   Owner/ID                   Class Job  Files               Size Time
    1       papowell@astart110+202228663    A 10663 /tmp/hi               3 20:22:29
    Printer: t2@astart110  'Test Printer 2' (routed/bounce to t1@astart110.astart.com)
     Queue: no printable jobs in queue
     Status: finished operations at 16:30:08
    Printer: t3@astart110  (forwarding to t3a@astart110.astart.com)
    Printer: t3a@astart110  (forwarding to t2@astart110.astart.com)
    Printer: t4@astart110  (subservers t5, t6)
     Queue: no printable jobs in queue
     Status: finished operations at 09:44:06
    Server Printer: t5@astart110  (serving t4)
     Queue: no printable jobs in queue
     Status: finished operations at 09:44:06
    Server Printer: t6@astart110  (serving t4)
     Queue: no printable jobs in queue
     Status: finished operations at 09:10:00

## 13.4 LPQ Verbose Format (lpq -v)

This uses an extension to the RFC1179 protocol, and is supported only by LPRng. The amount of information displayed is the brutal, and in effect does a total database dump of the LPD. This has been developed in order to provide diagnostic and status information for databases that need to keep track of job progress through a spool queue.

    % lpq -v
    Printer: t1@astart110
     Comment: Test Printer 1
     Printing: no
     Spooling: yes
     Queue: 1 printable job
     Server: no server active
     Status: accounting at end 'papowell@astart110+094352860' at 09:44:00
     Status: printing 'papowell@astart110+094352860', closing device at 09:44:00
     Status: printing 'papowell@astart110+094352860', finished  at 09:44:00
     Status: subserver status 'JSUCC' for 'papowell@astart110+094352860' \
                on attempt 1 at 09:44:00
     Status: finished operations at 09:44:00
     Job: papowell@astart110+202228663 status= 1
     Job: papowell@astart110+202228663 CONTROL=
     - Hastart110.astart.com
     - Ppapowell
     - J/tmp/hi
     - CA
     - Lpapowell
     - Apapowell@astart110+202228663
     - Qt1
     - fdfA010663astart110.astart.com
     - N/tmp/hi
     - UdfA010663astart110.astart.com
     Job: papowell@astart110+202228663 HOLDFILE=
     - active 0
     - done 0
     - hold 0
     - move 0
    ....

## 13.5 lpc status

The LPC status command is used to show the status of the queues currently being managed by the LPRng server. Note that this form of the command is supported only by LPRng, and is not backwards compatible with BSD LPR implementations.

    %lpc status all
     Printer           Printing Spooling Jobs  Server   Slave Redirect Status/Debug
    lw4@astart4         enabled  enabled    0    none    none
    lw5@astart4         enabled  enabled    0    none    none

The status display has a heading line and summary of the server status.

## 13.6 Remote Logger Operation

Several sites have wanted a way to provide central logging of job status and/or information. In order to do this, the following functionality is provided with LPRng.

### Logger Network Communication

Options used:

- `default_logger_port=`default destination port for logging information
- `default_logger_protocol=`default protocol for logging information
- `logger_destination=`logger information destination

The printcap/configuration variable `logger_destination` specifies a destination in the following format:

    host[%port][/(TCP|UPD)]

Host is the destination host, and can be a name or IP address. Port is the port on the destination host; if not specified the `default_logger_port` (default 2001) is used. TCP or UDP is the protocol to be used; if not specified the `default_logger_protocol` (default TCP) is used.

### Logger Message Format

Messages are sent to the logger with the following format. They are written as a single TCP write or UDP message.

    IDENTIFIER id AT timestamp
    STATUS | TRACE | FILTER_STATUS PID nnnn
      ... data
    .

Examples:

    IDENTIFIER papowell@astart1+560 at Sat Aug 31 08:47:19 1996
    STATUS
    printing 'cfA560astart1.astart.com', sending trailer
    .
    IDENTIFIER papowell@astart1+560 at Sat Aug 31 08:47:19 1996
    STATUS
    accounting at end 'cfA560astart1.astart.com'
    .
    IDENTIFIER papowell@astart1+560 at Sat Aug 31 08:47:19 1996
    STATUS
    job 'cfA560astart1.astart.com', closing device
    .
    IDENTIFIER papowell@astart1+560 at Sat Aug 31 08:47:19 1996
    FILTER_STATUS PID 2564
    FINISHED
    .
    IDENTIFIER papowell@astart1+560 at Sat Aug 31 08:47:19 1996
    STATUS
    job 'cfA560astart1.astart.com' finished
    .
    IDENTIFIER papowell@astart1+560 at Sat Aug 31 08:47:19 1996
    STATUS
    subserver status 'SUCCESS' for 'papowell@astart1+560' on attempt 1
    .
    IDENTIFIER papowell@astart1+560 at Sat Aug 31 08:47:19 1996
    TRACE
    t1@astart1.astart.com: job printed
    .

The IDENTIFIER line reports the job identifier and timestamp for the following message. The STATUS, TRACE, and FILTER_STATUS messages identify the information that follows.

### LPR -mhost%port and user logging support

The `lpr -m` option is used to request that `lpd` send mail to the user when a job has completed. LPRng extends this to allow mail addresses of the form `host[%port][/(TCP|UPD)]` to request that logging information be sent to the user as well.

The administrator should be aware that this is a possible security loophole, and that the `allow_user_logging` flag must be enabled to allow this operation.

Next Previous Contents