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

PRTG uses lookups for some sensors and for some sensors with custom channels. In general, lookups map status values as returned by a device (usually integers) to more informative expressions in words. Additionally, lookups can define a shown sensor status based on the status value returned by a device, just like sensor channel limits can define a sensor status, too. For a printer that returns the status value "1", for example, PRTG can show a sensor in a yellow Warning status with the text message "Toner Low" instead of just displaying the status value "1".

You can customize lookups by defining your own text messages that a sensor channel shows and mapping them to a certain sensor status. See section Customizing Lookups below.

If a sensor's channels use lookups, you can individually define how to control the sensor's status, either using the lookup definition or using limits for numerical values returned by the device. For details, see Sensor Channel Settings, section Alerting and Limits. It is not possible to use both definitions at the same time.

icon-i-roundLookups do not change data in the PRTG database, they merely change the way sensor channels are shown. Any change to lookup definition files applies to historic data as well as to live data.

icon-i-roundSome exceptions apply to the SNMP Custom String Lookup sensor that basically does an inverse lookup. It does not map an integer to a text message but only looks for matching strings in the lookup definition and shows a status based on this text value.

icon-prtg-on-demandCustomizing lookups is not possible on PRTG hosted by Paessler.

Here are quick links for ease of use.

Requirement: Channel Unit "Custom"

All sensor channels with an enabled Value Lookup need to use the Sensor Channel Unit "Custom". For details, see section Sensor Channel Settings.

icon-i-redThere are sensors that provide the Sensor Channel Unit "Value Lookup" in their sensor settings. Do not use the Sensor Channel Unit "Custom" for channels of these sensors if you want to use lookups. This would result in malfunctioning lookup definitions. For the following sensors, select the Sensor Channel Unit "Value Lookup" in the sensor settings and select your lookup file directly under Sensor Channel Value Lookup when adding the sensor:

Visualization of Lookup Channels

PRTG can display channels that use lookups as follows.

Lookup type

VISUALIZATION

EXAMPLE

SingleInt, Range

Gauge

A Gauge Showing the Status of a Lookup Channel

A Gauge Showing the Status of a Lookup Channel

Boolean

Switch

A Switch Showing the Status of a Boolean Lookup Channel

A Switch Showing the Status of a Boolean Lookup Channel

BitField

Toggles

Toggles Showing the Status of a BitField Lookup Channel

Toggles Showing the Status of a BitField Lookup Channel

You can view the text messages for the different lookup values by hovering over the respective color section.

Gauge Showing the Respective Lookup Message when Hovering over a Color Section

Gauge Showing the Respective Lookup Message when Hovering over a Color Section

To see at one glance which lookup value in which channel shows a Warning or Down status, check the sensor message on a sensor's Overview tab:

Sensor Message in the Overview Tab

Sensor Message in the Overview Tab

icon-i-roundWe recommend that you stay below 120 lookup values to display visually informative gauges for primary channels. Non-primary channels have an upper limit of around 40 lookup values for gauges.

Gauge Showing 120 Lookup Values

Gauge Showing 120 Lookup Values

icon-i-round-redThe various sensor states displayed in gauges always follow the clockwise order Up (green) < Warning (yellow) < Down (red) < Unknown (gray). This clockwise order by colors stays the same, no matter which numeric value is mapped to which sensor status in the lookup definition. See the following example:

<?xml version="1.0" encoding="UTF-8"?>
  <ValueLookup id="example.lookups" desiredValue="1" undefinedState="olsWarning" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="PaeValueLookup.xsd">
    <Lookups>
      <SingleInt state="Ok" value="1">
        Works
      </SingleInt>
      <SingleInt state="Ok" value="2">
        Works a bit
      </SingleInt>
      <SingleInt state="Warning" value="4">
        Is slow
      </SingleInt>
      <SingleInt state="Error" value="8">
        Does not work
      </SingleInt>
      <SingleInt state="Ok" value="16">
        Works sometimes
      </SingleInt>
    </Lookups>
  </ValueLookup>

Even though the value "8" comes before the value "16", the state "OK" (shown as an Up status) is displayed before the state "Error" (shown as a Down status).

icon-book-arrowsSee Lookups Directory and Format and The XML Schema for more information about the lookup code and format.

Lookups Directory and Format

Lookups are defined in Extensible Markup Language (XML) format in files ending with .ovl. PRTG standard lookup files are located in the PRTG program directory in the \lookups subfolder. These files are maintained by PRTG itself. In each of the files, lookups for one or more sensors are defined. Furthermore, the lookups folder contains the \custom subfolder to store your customized lookups.

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

  • A message that the sensor looks up and shows instead of the numeric value itself.
  • The status that the sensor shows.

icon-i-roundUse the SNMP Custom String Lookup sensor to map a string to a corresponding status. For this purpose, use the lookup type SingleInt.

icon-prtg-on-demandYou cannot access this directory on PRTG hosted by Paessler instances.

The XML Schema

An exemplary schema of the .xml files containing the lookup definitions can look like this:

<?xml version="1.0" encoding="UTF-8"?>
<ValueLookup id="..." desiredValue="..." undefinedState="..." xmlns="..." xsi="...">
 <Lookups>
         <SingleInt state="..." value="...">status text</SingleInt>
         <SingleInt state="..." value="...">status text</SingleInt>
         <SingleInt state="..." value="...">status text</SingleInt>
 </Lookups>
</ValueLookup>

Element

Description

Attributes, Value Assignment, and Content

<?xml>
content

This is the XML declaration that every .xml file begins with.

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

<ValueLookup>
contentValueLookup
</ValueLookup>

Defines the ID of the channel, which desiredValue is used, the status for undefined values (undefinedState), and links to the predefined schema definitions in PRTG that allow editing of lookup files with supported editors.

  • id: Specifies how the name of the lookup file is shown in the Sensor Channel Settings.
    icon-i-roundThe id is parsed as a lowercase string.
  • desiredValue: Contains the value used for the calculation of the "Coverage".
  • undefinedState: Optionally define a status for values that are not defined in the lookup file. If the target device returns a value that is not included in the lookup definition, the sensor shows this status (Ok, Warning, Error, or None) with an according message. Without a definition of "undefinedState", the sensor only shows the returned value.
  • xmlns:xsi/xsi: Refers to predefined XML schema definitions in PRTG (which allow easy editing of lookup files with supported editors).
  • 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>

<Boolean>
status text
</Boolean>

<BitField>
status text
</BitField>

<Range>
status text
</Range>

Each element defines one lookup entry. There can be one or more lookup entries from the same lookup type.

icon-i-round-redYou can use only one kind of lookup type in one lookup file. This means, only SingleInt, only Boolean, only BitField, or only Range. Different lookup types in one file are not allowed.

The notation for the different lookup types can vary:

  • <SingleInt state="..." value="...">status text</SingleInt>
  • <Boolean state="..." value="...">status text</Boolean>
  • <BitField state="..." value="...">status text</BitField>
  • <Range state="..." from="..." to="...">status text</Range>
  • state: Defines the status the sensor shows. Allowed values are Ok, Warning, Error, and None ("None" does not trigger a status change).
    icon-i-round-redState values must be capitalized for the sensor to work properly.
  • value: Defines the value that triggers the lookup. Enter an integer value.
    icon-i-round-redRange always needs both values "from" and "to".
  • status text: Defines a status text that is used as substitution text and shown instead of the integer value, for example, a status message.

icon-i-round-redThe SNMP Custom String Lookup sensor maps the status text to one of the specified states. For this sensor, use SingleInt.

Because all .xml files containing lookup definitions are delivered in a previously specified schema as indicated above, you can customize lookups accordingly.

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>

In our example, the lookup file has the following effect:

Value as Reported from HP Printer

Text Shown in PRTG (Sensor Channel)

Sensor Status Shown IN PRTG

0

Toner Okay

led_green_big

Up

1

Toner Low

led_yellow_big

Warning

2

No Toner Cartridge Loaded

led_red_big

Down

Customizing Lookups

icon-prtg-on-demandThis feature is not available in PRTG hosted by Paessler.

If you want to change the status definitions of a specific sensor channel, you basically have to do the following:

  1. Find out the (file) name of the default lookup file in the settings of the sensor channel that you want to change the behavior for.
  2. From the PRTG program directory subfolder \lookups, copy this file into the \lookups\custom subfolder (ensure that you do not change the file name!),
    —OR—
    create a new .ovl file there.
    icon-i-roundWhen using the same ID in the ValueLookup tag, the files in the \lookups\custom folder have a higher priority than the original files in the \lookups folder. This way, PRTG prefers your customizations to 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 that is not used by another lookup file. PRTG identifies lookup definitions via this ID, it does not use the file name.
  3. Open the file with an XML or text editor and customize the lookups as you like. You can define your own text messages or customize sensor states for particular return values. For example, if you do not want a sensor to show a Down status for the return value 2 but only a Warning status, replace the state "Error" with "Warning".

icon-i-roundAll possible states are specified in the LookupState.xsd file in the custom directory. Following the schema of the .xml files that are delivered with PRTG ensures that you edit lookups in a safe way.

icon-i-roundIf you imported an .oidlib file that contains lookups (you can see this in section Lookup in the MIB Importer), you can define your own sensor states for returning values. If you add an SNMP Library sensor using this .oidlib file, PRTG creatse a lookup definition file using the lookupname of the chosen library as id parameter. Override this lookup definition with your own custom lookup as described in this section. This is important because lookups that are added via an .oidlib file do not contain any status definitions and result in a Warning status of the sensor by default because of the entry undefinedState="Warning".

icon-i-roundIf you use an SNMP Custom String Lookup sensor, you can create a new custom lookup definition in the \lookups\custom directory with the expected return values. In this case, use the lookupname of the chosen library as id parameter to override the lookups from the .oidlib file.

icon-i-round-redWhen you save an edited lookup, make sure that it is saved as an .ovl file. Otherwise, the lookup might accidentally be saved as a .txt file and might not be loaded.

Example for Lookups Customization

For example (just for illustration purposes), imagine you would like

  • the sensor to show a Warning status for all undefined values that the target device might return,
  • to change the shown status for the return value "2" from Down to Warning, and
  • to add the state "None" (shown as a grey Unknown status) to the example above.

Then take the following steps:

  1. Copy the file oid.paessler.hplaserjet.tonerstatus to the \lookups\custom subfolder of your PRTG installation.
  2. Open this file with an editor.
  3. Leave the ID value unchanged to prioritize the customized lookup file.
  4. Insert the status definition for undefined values into the ValueLookup element: undefinedState="Warning"
  5. Replace the state "Error" with "Warning" for value "2".
  6. Add a SingleInt element with the state "None" for the (hypothetical) return value "3".
  7. Save the file and reload the custom lookup folder in PRTG.

The customized lookup file looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<ValueLookup id="oid.paessler.hplaserjet.tonerstatus" desiredValue="1" undefinedState="Warning" 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>

icon-book-arrowsSee also SNMP Custom String Lookup Sensor—Example for a lookup definition that maps a string value to a sensor status.

desiredValue Attribute

It is necessary to define a desiredValue in the lookup files. The desiredValue corresponds to a status value that triggers a lookup. PRTG calculates the percentage of time this specific status was 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 calculates the percentage of time the toner status showed a Warning status. If during a time span of five minutes, four of five sensor scans returned "Warning", PRTG would show an average of 80% for this time span because 80% of the time, the sensor showed a Warning status.

icon-i-round-redThe desiredValue attribute always has to be an integer value. For the lookup type range, use an integer that you defined for one of your "from" or "to" parameters in the lookup file.

icon-book-bulbFor more information, see also the Knowledge Base: Can I graph text values?

Lookup Types: SingleInt, Boolean, BitField, Range

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

Lookup Type

Description

Syntax

SingleInt

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

value="int"

icon-i-round-redThe full 32-bit integer range is supported.

Boolean

Use 0 or 1 to define a lookup for two different status values.

value="0"
value="1"

BitField

Use a bitfield for multiple status values.

Only use this lookup type if you have some basic knowledge about bitmasks. See section More below for a general introduction.

icon-i-round-redEvery value has to equal a power of two (for example, 1, 2, 4, 8, 16, 32, 64, etc.).

icon-i-round-redThe SNMP Custom String Lookup sensor does not support BitFields.

Range

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

from="int" to="int"

icon-i-round-redUsing 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 a parameter for "from" and "to" (for example, from="2" to="2"). See also the Knowledgebase: Custom value lookup range.

icon-i-round-redThe SNMP Custom String Lookup sensor does not support ranges.

icon-i-round-redThe full 32-bit integer range is supported.

icon-i-round-redYou can use only one kind of lookup type in one lookup file. This means, only SingleInt, only Boolean, only BitField, or only Range. 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 to use with the option Value Lookup in the sensor channel settings. This option is visible for many SNMP sensors, some application sensors, and always for the following sensors:

icon-book-arrowsFor details, see section Sensor Channel Settings.

Loading Lookups

You can (re)load the defined lookups in the custom folder by going to Setup | System Administration | Administrative Tools in the PRTG web interface and clicking the Go! button under Load Lookups and File Lists.

icon-i-blueA sensor whose lookup file you have modified and reloaded does not re-evaluate this lookup before the next sensor scan. For sensors with large scanning intervals, use the Scan Now option from the context menu to immediately apply the new lookup definition and to avoid an incorrect sensor status.

Debugging—What happens if...?

  • a return value is defined in the lookups that is never returned by a device because the value is not assigned: The value is never triggered, so PRTG ignores this entry.
  • PRTG receives a return value that is not defined for lookups: No substitution message can be found. PRTG just shows the return value. You can optionally define a status for unknown values with a definition of undefinedState in the ValueLookup element (see section Define Lookups—The XML Schema above).
  • different lookup types are in one lookup file: This is not allowed and PRTG discards this lookup definition. If you use miscellaneous lookup types in one file, for example, ranges and singleInts together, the PRTG system creates 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)".
  • XML code is incorrect: PRTG creates a new ticket when loading lookups or restarting the PRTG server with a corresponding error message and discards this lookup definition.
  • a lookup file has a file ending other than .ovl: The file is not loaded.
  • alerting is disabled or based on limits: "Error" and "Warning" states defined in the lookup do not apply. Make sure that you select the option Enable alerting based on lookups in the channel settings if you want to use lookup definitions to control the sensor status.
  • you define a scaling factor in channel settings: This does not modify the values that are defined by lookups. Any applied lookup always uses the raw value as retrieved from the target device. If you use a scaling factor for such a channel, you notice the scaling in data graphs, but the channel value appears unmodified in data tables.

More

Knowledge Base: Custom value lookup range

Knowledge Base: Can I graph text values?

Video Tutorial: How to configure lookups in PRTG

Wikipedia: Mask (computing)

 

Advanced Topics

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