<%NUMBERING1%>.<%NUMBERING2%>.<%NUMBERING3%> PRTG Manual: Define Lookups

PRTG uses lookups for some sensor types with custom channels. In general, lookups map status values as returned by a device (usually integers) to more informative expressions that show you the status of a monitored device as a clear message. Additionally, lookups can define the sensor status that will be shown for certain status codes (similar as sensor channel limits can define a sensor status, too). For example, for a printer, PRTG can show a sensor in a yellow Warning status with channel values like "Toner Low" instead of simple status codes.

Lookups can be customized individually; you can define your own texts that will be shown in a sensor's channel. See section Customizing Lookups below.

Note: If a channel uses lookups, we strongly recommend you to control the sensor status only via the lookup definition and not to use channel limits! See also section Sensor Channels Settings.

Note: Lookups do not change data in PRTG's database, but they merely change the way sensor channels are shown. Any change to lookup definition files will apply to historic data as well as to live data.

Requirement: Channel Unit "Custom"

All channels with enabled Value Lookup need to use the channel Unit "Custom". For details, refer to section Sensor Channels Settings.

Gauges of Lookup Channels

PRTG can display gauges for channels which use lookups. We recommend staying below 120 lookup values in order to display informative gauges for primary channels. Non-primary channels have an upper limit of around 40 lookup values.

A Gauge Showing the Status of a Lookup Channel

A Gauge Showing the Status of a Lookup Channel

Lookups Directory and Format

Lookups are defined in XML format in files ending in .ovl. PRTG's standard lookup files are located in the PRTG program directory in a sub folder named lookups. These files are maintained by PRTG itself. In each of the files lookups are defined for one or more sensors. Furthermore, the lookups folder contains a sub folder named custom to store your customized lookups.

The files follow a basic principle. For each numeric value you can define:

  • A message that will be looked up and shown instead of the value
  • The status the sensor will show

Example

The following code illustrates the lookup definition for the toner status of the SNMP HP LaserJet Hardware sensor:

<?xml version="1.0" encoding="UTF-8"?>
<ValueLookup id="oid.paessler.hplaserjet.tonerstatus" desiredValue="1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="PaeValueLookup.xsd">
 <Lookups>
         <SingleInt state="Ok" value="0">
                 Toner Okay
         </SingleInt>
         <SingleInt state="Warning" value="1">
                 Toner Low
                      </SingleInt>
         <SingleInt state="Error" value="2">
                 No Toner Cartridge Loaded
         </SingleInt>
 </Lookups>
</ValueLookup>

 

The schema in the example provides an insight how lookups are defined:

  • The <?xml> tag in the first line defines the content as XML.
  • The <ValueLookup> tag in the second line contains:
    • The ID which will be shown in the Sensor Channels Settings.
    • The desiredValue attribute contains the value which will be used for the calculation of the "Coverage". In this example, 1 is defined.
    • The xsi attributes refer to PRTG's predefined XML schema definitions (which allow easy editing of lookup files with supported editors). We recommend using the default value.
  • Between the tags <Lookups> and </Lookups> the particular lookups for the sensor data are defined:
    • A lookup entry starts with a tag containing the type of the status value, the lookup type (in this example, this is always <SingleInt>).
    • Separated by whitespace, the state attribute defines the status the sensor will show. Allowed values are: Ok, Warning, Error, and None ("None" will not trigger a status change).
    • The value attribute defines which numeric value will trigger the lookup. This is the value that PRTG will receive from the device.
    • The text defines the substitution text that will be shown instead of the value. For example, this can be a status message.
  • The same way all other possible lookups are defined. The lookup definitions are closed by the tag </Lookups>. The file closes with </ValueLookup>.

 
In our example, the lookup file will have the following effect:

Value as Reported from HP Printer

Value Shown in PRTG (Sensor Channel)

Sensor Status Shown by PRTG

0

Toner Okay

led_green_big

Up

1

Toner Low

led_yellow_big

Warning

2

No Toner Cartridge Loaded

led_red_big

Down

The XML Schema

An overall schema of the XML files containing the lookups definitions can be sketched like this:

<?xml version="1.0" encoding="UTF-8"?>
<ValueLookup id="..." desiredValue="..." xmlns="..." xsi="...">
 <Lookups>
         <SingleInt state="..." value="...">
                 status text
         </SingleInt>
         <BitField state="..." value="...">
                 status text
         </BitField>
         <Range state="..." from="..." to="...">
                 status text
         </Range>
         
         [several other lookup definitions]
 
 </Lookups>
</ValueLookup>

Element

Description

Attributes, Value Assignment, and Content

<?xml>
content

This is the XML declaration. Every XML file begins with it.

  • version and encoding are "1.0" resp. "UTF-8"
  • content: <ValueLookup>contentValueLookup</ValueLookup>

<ValueLookup>
contentValueLookup
</ValueLookup>

Defines the ID of the channel, what desiredValue is used, and links to PRTG's predefined schema definitions, which allow easy editing of lookup files with supported editors.

  • id: specifies how the name of the lookup file is shown in the Sensor Channels Settings
  • desiredValue: please see below
  • xmlns:xsi/xsi: refers to predefined XML schema definition
  • contentValueLookup: lookup definitions
    <Lookups>contentLookups</Lookups>

<Lookups>
contentLookups
</Lookups>

Defines the particular lookups for the sensor data.

  • contentLookups: one or more lookup entries, see below

<SingleInt>
status text
</SingleInt>

<BitField>
status text
</BitField>

<Range>
status text
</Range>

Each element defines one lookup entry. There can be one or more entries in this format. SingleInt, BitField, and Range are lookup types.

  • state: defines the state the sensor will show; allowed values: Ok, Warning, Error, None
  • value: defines the value which triggers the lookup. Please enter an integer value. Note: Range needs always both values "from" and "to".
  • status text: defines a status text that will be used as substitution text and shown instead the integer value. For example, a status message.

Since all the XML files containing lookup definitions are delivered in a pre-given schema as indicated above, it will be easy and comprehensible for you to customize lookups.

Customizing Lookups

There is a subfolder named \lookups\custom located in the PRTG program directory. In order to customize existing lookups, copy the desired lookup file from the lookups folder to the custom folder or create a new .ovl file there. When using the same ID in the ValueLookup tag, the files in the \lookups\custom folder will have a higher priority than the original files in the lookups folder. This way, your customizations will be handled preferably by PRTG instead of the original lookup settings. If you want to use custom lookup definitions in addition to the existing lookups, define a new ID in the lookup file which is not used by another lookup file. PRTG identifies lookup definitions via this ID, it does not use the file name.

Open the file with an XML or text editor and adjust the lookups to your personal preferences. You can define your own messages as well as you can customize sensor states for the particular return values. For example, if you do not want an "Error" status (i.e. a sensor Down status) for the return value "2" but only a warning, then you can replace "Error" with "Warning".

Note: The possible states are given in the LookupState.xsd file in the custom directory. Following the schema of the XML files that are delivered with PRTG enables you to edit the lookups in a safe way.
 

Example for Lookups Customization

For example (just for illustration purposes), imagine you would like to add the status "None" to the example above and change the status for the return value "2" from "Down" to "Warning". Then do the following:

  • Copy the file oid.paessler.hplaserjet.tonerstatus to the \lookups\custom subfolder of your PRTG installation.
  • Open this file with an editor.
  • Leave the ID value unchanged to prioritize the customized lookup to the original file.
  • Replace "Error" with "Warning" for value "2".
  • Add a a "SingleInt" element with status "None" for the (hypothetical) return value "3".
  • Save the file and reload the custom lookup folder in PRTG.

The customized lookup file will finally look like this:

<?xml version="1.0" encoding="UTF-8"?>
<ValueLookup id="oid.paessler.hplaserjet.tonerstatus" desiredValue="1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="PaeValueLookup.xsd">
 <Lookups>
         <SingleInt state="Ok" value="0">
                 Toner Okay
         </SingleInt>
         <SingleInt state="Warning" value="1">
                 Toner Low
                      </SingleInt>
         <SingleInt state="Warning" value="2">
                 No Toner Cartridge Loaded
         </SingleInt>
         <SingleInt state="None" value="3">
                 Unknown status of toner
         </SingleInt>
 </Lookups>
</ValueLookup>

 

desiredValue Attribute

It is necessary to define a desiredValue in the lookup files. The desiredValue corresponds to a status value triggering a lookup. PRTG calculates the percentage of time this specific state has been monitored. The result is displayed for all data tables and graphs that show averaged values.

Considering the example above where the desiredValue is "1", PRTG will calculate the percentage of time the toner status has been "Warning". If in a time span of five minutes four of five sensor scans returned a "Warning" status, PRTG would show an average of 80% for this time span, because in 80% of the time the sensor showed a "Warning".

Lookup Types: SingleInt, BitField, Range

Beside the lookup type SingleInt as seen above, there are two other lookup types: BitField and Range. Using these types you can define lookup values beyond simple integers.

Lookup Type

Description

Syntax

SingleInt

Uses an integer to define a lookup for one status value.

value="int"

BitField

Uses a bitfield for multiple status values.

Should only be used if you have basic knowledge about bitmasks. Please see More below for a general introduction. Note: Every value has to equal a power of two (e.g., 1, 2, 4, 8, 16, 32, 64, etc.).

Range

Uses an inter range from-to to define a lookup for several status values.

from="int" to="int"

Note: Using ranges, the parameters "from" and "to" always have to be defined. If you want to query only one single value in a range file, this value must be set as parameter for "from" and "to" (e.g., from="2" to="2").

Note: You can use only one kind of lookup type in one lookup file. For example, only SingleInts, BitField, or Ranges. Different lookup types in one file are not allowed.

Define Lookup Files in Sensor Channel Settings

For each sensor with a custom channel you can define a lookup file that will be used. This is done in a sensor's channel settings with an option called "Value Lookup". This option is visible for many SNMP sensors, some application sensors, and always for the following sensor types:

For details, please see the Sensor Channel Settings section.

Loading Lookups

You can (re)load the defined lookups in the custom folder by clicking the Load Lookups button. This button can be found in PRTG under Setup | System Administration | Administrative Tools.

Debugging—What will happen if...?

  • A return value is defined in the lookups that never will be returned by a device because the value is not assigned: The value will never be triggered, so PRTG will simply ignore this entry.
  • PRTG receives a return value that is not defined for lookups: No substitution message can be found. PRTG will just show the return value.
  • Different lookup types are in one lookup file: This is not allowed and PRTG will discard this lookup definition. If you use miscellaneous lookup types in one file, for example, ranges and singleInts together, the PRTG system will create a ticket when loading lookups or restarting the PRTG server with the following error message: Value lookup file "[...]" could not be loaded ("" is not a valid integer value)".
  • Incorrect XML code: PRTG will create a new ticket when loading lookups or restarting the PRTG server with a corresponding error message and discard this lookups definition.

More

Wikipedia: Masks (computing)

 

 

Advanced Topics

Keywords: Lookups,SNMP,SNMP Lookups,Value Mapping,Value Mapping Lookups