Uniprint technote: Checking Device Status

Uniprint checks the status of a device before sending jobs to it. This is to ensure that jobs are forwarded only to “online” devices. This document details how Uniprint determines the status of a device using the SNMP protocol in Uniprint.

Overview

Starting from 8.3, Uniprint uses the Simple Network Management (SNMP) Protocol to determine the status of a given device. SNMP is a protocol used to manage devices on an IP network.

Uniprint performs an SNMP query to determine the error state of a given device and based on the response it decides if the device is “Online” or “Offline”. This check is performed just before jobs are released to the device.

Uniprint 9.1 SP2 added support for SNMP v3.

To support SNMP, the following are required for each device:

  • SNMP is enabled on each device.
  • The hostname or IP address of the device.
  • The UDP port used for SNMP on the device. The default port value is 161.
  • The SNMP Community string if device is set to V1. The default is “public”.
  • SNMPv3 credentials (e.g. Authentication Protocol, Authentication Protocol Password, etc.)

The SNMP query requests the following SNMP variable objects for a given device. All three values are used in combination to determine the device status.

  • Operational device state “1.3.6.1.2.1.25.3.2.1.5”
  • General Printer Status “1.3.6.1.2.1.25.3.5.1.1”
  • Printer Detected Error State “1.3.6.1.2.1.25.3.5.1.2”

The Print Server uses the results of these three objects to match against a list of possible combinations to determine whether the device should be considered Online or Offline.

The above SNMP variables are referred to in the SNMP RFC as:

  • hrDeviceStatus
  • hrPrinterStatus
  • hrPrinterDetectedErrorState

SNMP Variable values

The first two of the SNMP variables return a single numeric value for each variable. The possible values for these are:

hrDeviceStatus

Unknown (1)

Running (2)

Warning (3)

Testing (4)

Down (5)

hrPrinterStatus

Other (1)

Unknown (2)

Idle (3)

Printing (4)

Warmup (5)

The third SNMP variable can have multiple values in its answer and is returned as a hexadecimal sum of all the currently relevant values. The possible values are:

hrPrinterDetectedErrorState

lowPaper

0x8000

  noPaper 0x4000

 

lowToner

0x2000

 

noToner

0x1000

 

doorOpen

0x0800

 

Jammed

0x0400

 

Offline

0x0200

 

serviceRequested

0x0100

 

inputTrayMissing

0x0080

 

outputTrayMissing

0x0040

 

markerSupplyMissing

0x0020

 

outputNearFull

0x0010

 

outputFull

0x0008

 

inputTrayEmpty

0x0004

 

overduePreventMaint

0x0002

 

(not used)

0x0001

For example, it may return : ‘Jammed’ plus ‘Offline ‘plus ‘lowToner’, which equates to :

0x0400 + 0x0200 + 0x2000 = 0x2600

so the value returned for the hrPrinterDetectedErrorState variable would be 0x2600

The first eight hrPrinterDetectedErrorState values are those which are more likely to relate to offline conditions. The second group (inputTrayMissing, etc) are less serious conditions which do not usually result in the device being considered offline.

Rules to determine Offline State

The Print Server/Secure Release Service installs with a default set of rules to match standard device responses for the three SNMP variables (described above). These rules cover the main online and offline results.

The default rules include:

  • when a device reports DeviceStatus of ‘down’ (5), PrinterStatus ‘other’ (1), plus printerDetectedErrorState which includes ‘offline’ – consider the device offline
  • when a device reports PrinterStatus of ‘warmup’ (5), then consider the device online (as a warming-up device can usually still receive jobs into its buffer for printing once the warmup has completed)
  • when a device reports DeviceStatus of ‘testing’ (4), then consider the device offline as the device is not in a state to receive print jobs
  • when a device reports a DeviceStatus of ‘warning’ (3) and a Printer Detected Error State of ‘offline’ then consider the device offline
  • when a device does not report any result for any of the variables, consider the device offline
  • for all other cases, consider the device online

The Print Server runs the online state check before releasing a job to the device. If the result of the state check matches a rule which determines the device to be offline, the job will not be released to the device.

Any time the Print Server rejects sending a job to a device because the device is reporting a state deemed to be ‘offline’, an Alert regarding the offline state of the device is raised, recording the details of the SNMP query results.

Altering the Rules

The rules for determining online or offline state can be altered to allow for devices which respond differently from the standard expected results.

An override file is installed with the Secure Release Service. This override file is an xml file and is installed into the system application data location: <applicationdata>\PharosSystems\AssetManagement\

e.g. C:\Documents and Settings\All Users\Application Data\PharosSystems\AssetManagement

This override rules file is a full replacement for the internal default online/offline rules.

The XML rules file can be edited to include new rules for specific combinations of SNMP query results, or the existing rules can be altered if necessary.

The rules file entries appear as:

- <rule>
  <hrDeviceStatus>4</hrDeviceStatus> 
  <hrPrinterStatus>ANY</hrPrinterStatus> 
  <hrPrinterDetectedErrorState>ANY</hrPrinterDetectedErrorState> 
  <Availability>OFFLINE</Availability> 
 </rule>

(This rule states that if the DeviceStatus is ‘testing’(4) then, regardless of any values in the other variables, consider the device offline.)

- <rule>
  <hrDeviceStatus>5</hrDeviceStatus> 
  <hrPrinterStatus>1</hrPrinterStatus> 
  <hrPrinterDetectedErrorState type="OR">0x0200</hrPrinterDetectedErrorState> 
  <Availability>OFFLINE</Availability> 
  </rule>

(This rule states that if the DeviceStatus is ‘Down’(5), and the PrinterStatus is ‘Other’(1), and the PrinterDetectedErrorState includes ‘Offline’(0x0200), then consider the device offline).

Override File compared to Internal Defaults

The presence of the override file replaces all rules and therefore must be a complete set of rules.

The override file installed with the system is very similar to the internal defaults. The only difference is that an additional rule is included in the override file. This additional rule determines a device reporting ‘doorOpen’ to be Online. Most devices have a memory buffer which allows a job to be submitted to the device and held until the device is able to print it. As a ‘door open’ issue is usually easily resolvable by anyone using the device, the device should not be considered offline. An example would be: a student printing to the device, walking up to the device to retrieve their job, finding the door open, closing the door, the device then printing the job out once the door has been closed.

If this rule does not match the behavior of devices on site (ie the device does not print a job out after closing the door), the rule can simply be deleted from the override file.

The rule can be replicated for other scenarios that students can resolve themselves, for example, if paper can be replenished by students, then ‘noPaper’ should also be considered an online state and a rule for such can be added to the rules file.

Important technical points for updating the rules file:

  1. The rules file is checked in order; the first matching rule that is encountered will be the one that is applied.
  2. The values can be:
  • specific values (such as ‘4’ for DeviceStatus above)
  • NULL – matched when no value was returned
  • NOTNULL – matched when some value was returned. The specific value is not significant, except in differentiating that there was some value rather than none.
  • ANY – matched regardless of result - we don’t care what, if any, value was returned for that variable. ANY covers both NULL and NOTNULL results.
  1. The printerDetectedErrorState value, by default, will expect an exact match
  • If you wish to include a rule where a particular ErrorState value is significant regardless of what other Printer Detected Error States are also reported, type=”OR” must be used in the rule, e.g.
<hrPrinterDetectedErrorState type="OR">0x0400</hrPrinterDetectedErrorState>

This line checks whether the value 0x0400 (‘Jammed’) is included within the hex result

For example, a device reports ‘Jammed, serviceRequested’ in the Printer Detected Error State variable. The rule states that ‘if jammed (ie 0x0400) is part of the result (regardless of other values such as ‘serviceRequested’), it’s a match’.

  1. The Secure Release Service must be restarted for the new rules to be applied.
  2. If the rules are overridden on one Print Server, the same override file should be copied to all other Print Servers.

Pharos Administrator Online State Check

The Pharos Administrator also uses the rules to decide whether a device is online or offline.

In the Devices context, the Run Online State Check action displays the results received for the SNMP variables and the determination of online/offline state based on the application of the rules.

The override rules file in the <application data>\PharosSystems\AssetManagement\ folder is installed by the Secure Release Service, so if the Administrator is installed on a machine where there is no Secure Release/Print Service installed, the override file will not be present and the Administrator will use the internal defaults (note the difference between the default and override mentioned above).

To update a standalone Administrator to use the override rules file when reporting online/offline state for a device, the rules file must be manually added to the <application data> \PharosSystems\ AssetManagement\ location on the Administrator machine. (The folder for this will need to be manually created.) Updated rules will be applied when the Pharos Administrator is re-opened.

Impact of the device status check

Depending on the type of printing (Direct or Secure) and the response returned by the SNMP query, jobs may be printed, deleted, or held in the Queued Jobs context for release to another printer.

The specific sequence of events for each type of printing is detailed below.

Direct Printing

A user sends print job(s) to a Queue (associated with a Direct Print Group).

  1. Uniprint executes an SNMP query on the device to determine if the device is “online” or “offline”.
  2. SNMP sends a response to the query.
  3. The Uniprint Print Server determines the state of the device based on the response and a match to an online/offline rule, and processes the jobs based on the result:
  • If the result is “Online”, the jobs are sent to the device.
  • If the result is “Offline”, the jobs are deleted.

If the SNMP results match an ‘Online’ state rule, the Print Server will submit the job to the device via LPR. The following table provides scenarios of how jobs are processed when a device is considered to be ‘online’ for Direct Printing.

Direct Printing behavior

Device State Print Server Job Status

Online

SNMP query result matches a rule that says result should be considered ‘online’

Job sent to device via LPR. If LPR succeeds, the job is printed.

Online

Job sent to device via LPR. If LPR fails, the job is listed in the Printed Jobs context.

Offline

(because the device is not contactable)

SNMP query result matches a rule that says result should be considered ‘offline’. Print Server considers device as Offline, job is not sent to device.
  1. The job is deleted by PrintJobArrive.
  2. A Deleted Print transaction is created.
  3. If the PrintEndJob script is configured, the user is notified that the job failed to print (via balloon box).
  4. The Job is deleted and an alert is raised.

Offline

(because the device is jammed)

Secure Printing

Secure Printing is different from direct printing in that jobs are held until the user releases it from a Release Station.

  1. A user sends print job(s) to a Queue (associated with a Secure Printing Print Group).
  2. The job(s) are held in the Uniprint Print Server.
  3. The user goes to a release station (attached to the device) and releases the job(s).
  4. Uniprint will perform an SNMP query on the device.

The Print Server will determine the device state based on matching the response from the SNMP query to an online/offline rule, and process the jobs based on the result.

  • If the result is “Online”, the job(s) will be printed on the device.
  • If the response is “Offline”, the job(s) remain held in the Queued Jobs context. They can be released to another device by an administrator user, or released on the same device once the error condition is rectified (e.g. paper replenished).

The following table shows what happens to print jobs for Secure Printing.

Device State Print Server Job Status

Online

SNMP query result matches a rule that says result should be considered ‘online’

Job sent to device via LPR. If LPR succeeds, the job is printed.

Online

Job sent to device via LPR. If LPR fails, the job is listed in the Printed Jobs context.

Offline

(because the device is not contactable)

SSNMP query result matches a rule that says result should be considered ‘offline’. Print Server considers device as Offline, job is not sent to device. Job is not released and remains in the Queued Jobs context. This can be released on the same device by the user once the error condition is resolved (eg paper replenished), or printed by a Uniprint administrator and sent to another printer in the system.

Offline

(because the device is jammed)

Implementation Details

Devices Context in Pharos Administrator

Every device in the Pharos system requires the following properties for the SNMP check.

  • Network address
  • SNMP Community
  • SNMP Port for the SNMP check

These properties are configured per device in the Output Management > Devices context. They are also used in retrieving the Make/Model values of a device.

Warning/Informational messages for different device states

The Pharos Administrator shows the full details received from the SNMP query along with a statement of whether the device is considered online or offline. The purpose of the message is to inform the Uniprint administrator of any issues which are preventing print jobs from being released to a given device.

Displaying warning messages is particularly important when the device is used for Direct printing as it might not be obvious to the end-user why print jobs have not been printed because they have little or no direct interaction with the device (use of Notify balloons or message box can resolve this problem). The display of a warning message about the state of a device will be visible on both the Devices and the Output Management > Overview contexts.

The following image shows a device reporting an offline state, along with the full set of results received from the SNMP status query.

Configuring Device Status Check

Device status check is enabled by default. The Execute Online State Check before printing property can be configured at the device level.

Disabling Device Status Check

It is possible to disable the status check per device. This is important for devices that do not support SNMP, for example. Setting the “Execute Online State Check before printing” property to “No” disables the status check.

When you disable the status check, the Print Service assumes that the printer is online. Therefore, in situations where SNMP is not supported on a device, it is best to disable the status check; otherwise the printer will be assumed to be permanently offline.

Print Server

The Print Server will perform the device state check, which takes place as part of the “SelectPrinter” event, whenever a job is about to be released in Direct and Secure printing. The Server will exclude any offline printer from the printers list in the Direct printing load balancing algorithm.

Upgrades

In an upgrade from Uniprint 8.2, the Network Addresses of existing devices are obtained during the upgrade process and the default SNMP Community and SNMP Port values are applied to each device. In an upgrade from Uniprint 8.1, the SNMP community string values of existing devices, if any were supplied, will be carried over to version 8.3 or higher.

Post upgrade: Log on to Pharos Administrator, select all the devices in the Devices context and click the “Run Online State Check” action to view the device state.