New Question
 
 
PRTG Network Monitor

Intuitive to Use.
Easy to manage.

200.000 administrators have chosen PRTG to monitor their network. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free PRTG
Download >>

 

What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general. You are invited to get involved by asking and answering questions!

Learn more

 

Top Tags


View all Tags


Can I graph text values?

Votes:

0

Your Vote:

Up

Down

I would like to graph a binary SNMP value - it returns either "backoff" or "normal".

Using the SNMP Custom String sensor, I see that the string value is displayed:

  • in the "message" column when I view the all sensors on the device
  • in the "message" column of the Log tab of the specific sensor. Neither of these is graphable.

It is really important for me to be able to see on a graph when this value goes from "normal" to "backoff" and back again.

I guess I could use the Lookup feature to convert "backoff" to "1" and "normal" to "0", but then I get a graph with random numerical values.

Any suggestions?

graphs lookup snmp string string-lookup

Created on Feb 7, 2017 1:22:03 PM by  trunq (10) 1

Last change on Jul 9, 2019 6:48:21 AM by  Maike Behnsen [Paessler Support]



Best Answer

Accepted Answer

Votes:

0

Your Vote:

Up

Down

Hello Trung,
thank you for your question and no worries.
PRTG cannot graph strings, but it offers a lot of other approaches and one of them will usually fit your requirements.

Monitoring Strings with PRTG

Working with strings in PRTG can be somewhat tricky; however, there are several possibilities.

Regular String Monitoring

The SNMP Custom String sensor allows you to poll any string. However, the respective channels will only display the Response Time because only numerical values (1, 2, 3, -5, 4.56, 0, ...) can be assigned to channels.

This sensor will only generate alerts by default if the string or OID becomes unreachable or unavailable. Otherwise, the sensor allows you to check the result against an expected string or get notifications via Change Triggers if the value changes. Note that a matching string will set the sensor to a Down status. However, it will not modify existing channels or create additional channels.

Regular String Monitoring with Regex

With the SNMP Custom String sensor, you can also modify the sensor's settings to use regular expressions to extract values from within these strings. For instance, you can obtain CPU load from a Linux system via SNMP, which will look like the following:

5 Sec (3.49%), 1 Min (3.555%), 5 Min (3.90%)

This is obviously not one numerical value, it contains a couple of values. In this case, the following regular expression can be used to extract any of the three relevant values:

(\d+\.\d+).*?(\d+\.\d+).*?(\d+\.\d+)

The Index of Capturing Group controls which of the matches will go into the newly created Extracted Value channel of the sensor. You can read more about it here:

String via Lookup

The SNMP Custom String Lookup sensor will be very handy if the OID that you are monitoring provides well-known responses or strings, for example, "active" or "inactive" (for a cluster or node status). The lookup has to be created using a text editor (as it is an XML-like file). It will tell the sensor:

  • which string(s) to expect,
  • which sensor status will correspond to which string (active = ok, inactive = warning), and
  • the desired value.
    In other words, this sensor turns the string into something that PRTG can easily parse and use, that will generate alerts, and display the received string as well. The Value channel will display the received string mapped to a state. For an example, see the article Monitor and "Lookup" a SNMP String value.

The Issue with Status Averages

In a lookup file, the desiredValue attribute is sometimes underrated but it is useful when it comes to the representation of averages. Keep in mind that PRTG is designed to work with numerical values (response time, traffic, disk use, and others). In this case, however, we are talking about a status. Have a look at the following scenario:

The sensor is polled every 60 seconds. The Live Data tab of the sensor is displaying the following:

Date TimeValue
08.02.2017 08:02:221(Active)
08.02.2017 08:01:221(Active)
08.02.2017 08:00:221(Active)
08.02.2017 07:59:222(Inactive)
08.02.2017 07:58:222(Inactive)

On the 2 days, 30 days, and 365 days tabs, PRTG always displays average values. If this average was an ordinary number, this would be very easy. The average (from 07:58:22 to 08:02:22) is 1,4. However, we are talking about a status and not a value. So what is the status average of 3x active and 2x inactive?
Because there is no real answer, PRTG uses the desiredValue attribute from the lookup file to calculate this. In this particular case, if the desired value was active, PRTG would tell you that during that period, the value was the desired value 60% of the time.

To sum it all up, make sure that your desired value is correctly set and that PRTG can generate a meaningful value from it. For more information on lookups, see section Define Lookups in the PRTG Manual.

Custom Approach

As PRTG is highly customizable, it should not be too hard to put together a script/exe file that:

  • is run by PRTG with every sensor scan (this means every scanning interval),
  • reads the parameters forwarded by the sensor (%host, %snmpcommunity),
  • performs the query using NET-SNMP's binaries (snmpwalk.exe or snmpget.exe) or other binary/dll of your choice,
  • parses the result according to your wishes (you can use a case statement to match strings to values),
  • formats the output in a single or multi-channels PRTG API-compliant format (XML/JSON), and
  • lets PRTG read and display the values provided by the script.

Here are some examples of PowerShell/NET-SNMP-based custom sensors:


Best Regards,
Luciano Lingnau [Paessler Support]

Created on Feb 8, 2017 7:17:57 AM by  Luciano Lingnau [Paessler Support]

Last change on Jul 10, 2019 10:47:53 AM by  Maike Behnsen [Paessler Support]



5 Replies

Votes:

0

Your Vote:

Up

Down

Hi there,
thank you for your KB-Post.

  • What OID are you polling?
  • Are you able to share a screenshot from the settings and overview tab of your sensor? Please note that it's not possible to host images on the KB, you'll have to host them elsewhere and share the link here.

Best Regards,
Luciano Lingnau [Paessler Support]

Created on Feb 7, 2017 1:41:03 PM by  Luciano Lingnau [Paessler Support]



Votes:

0

Your Vote:

Up

Down

Hi Luciano

Many thanks for the quick reply. I should have been more specific - it's not a problem particularly with this sensor... It's that with many sensors in PRTG i'd like to be able to graph text-based values.
e.g. i could make a table so that:

  • 1 = dinosaur
  • 2 = rabbit

and then on my graph i would be able to see when the graph changes state from "dinosaur" to "rabbit" At the moment this doesnt seem to be possible.

Cheers,

Trunq

Created on Feb 7, 2017 1:48:30 PM by  trunq (10) 1

Last change on Feb 7, 2017 2:44:21 PM by  Luciano Lingnau [Paessler Support]



Accepted Answer

Votes:

0

Your Vote:

Up

Down

Hello Trung,
thank you for your question and no worries.
PRTG cannot graph strings, but it offers a lot of other approaches and one of them will usually fit your requirements.

Monitoring Strings with PRTG

Working with strings in PRTG can be somewhat tricky; however, there are several possibilities.

Regular String Monitoring

The SNMP Custom String sensor allows you to poll any string. However, the respective channels will only display the Response Time because only numerical values (1, 2, 3, -5, 4.56, 0, ...) can be assigned to channels.

This sensor will only generate alerts by default if the string or OID becomes unreachable or unavailable. Otherwise, the sensor allows you to check the result against an expected string or get notifications via Change Triggers if the value changes. Note that a matching string will set the sensor to a Down status. However, it will not modify existing channels or create additional channels.

Regular String Monitoring with Regex

With the SNMP Custom String sensor, you can also modify the sensor's settings to use regular expressions to extract values from within these strings. For instance, you can obtain CPU load from a Linux system via SNMP, which will look like the following:

5 Sec (3.49%), 1 Min (3.555%), 5 Min (3.90%)

This is obviously not one numerical value, it contains a couple of values. In this case, the following regular expression can be used to extract any of the three relevant values:

(\d+\.\d+).*?(\d+\.\d+).*?(\d+\.\d+)

The Index of Capturing Group controls which of the matches will go into the newly created Extracted Value channel of the sensor. You can read more about it here:

String via Lookup

The SNMP Custom String Lookup sensor will be very handy if the OID that you are monitoring provides well-known responses or strings, for example, "active" or "inactive" (for a cluster or node status). The lookup has to be created using a text editor (as it is an XML-like file). It will tell the sensor:

  • which string(s) to expect,
  • which sensor status will correspond to which string (active = ok, inactive = warning), and
  • the desired value.
    In other words, this sensor turns the string into something that PRTG can easily parse and use, that will generate alerts, and display the received string as well. The Value channel will display the received string mapped to a state. For an example, see the article Monitor and "Lookup" a SNMP String value.

The Issue with Status Averages

In a lookup file, the desiredValue attribute is sometimes underrated but it is useful when it comes to the representation of averages. Keep in mind that PRTG is designed to work with numerical values (response time, traffic, disk use, and others). In this case, however, we are talking about a status. Have a look at the following scenario:

The sensor is polled every 60 seconds. The Live Data tab of the sensor is displaying the following:

Date TimeValue
08.02.2017 08:02:221(Active)
08.02.2017 08:01:221(Active)
08.02.2017 08:00:221(Active)
08.02.2017 07:59:222(Inactive)
08.02.2017 07:58:222(Inactive)

On the 2 days, 30 days, and 365 days tabs, PRTG always displays average values. If this average was an ordinary number, this would be very easy. The average (from 07:58:22 to 08:02:22) is 1,4. However, we are talking about a status and not a value. So what is the status average of 3x active and 2x inactive?
Because there is no real answer, PRTG uses the desiredValue attribute from the lookup file to calculate this. In this particular case, if the desired value was active, PRTG would tell you that during that period, the value was the desired value 60% of the time.

To sum it all up, make sure that your desired value is correctly set and that PRTG can generate a meaningful value from it. For more information on lookups, see section Define Lookups in the PRTG Manual.

Custom Approach

As PRTG is highly customizable, it should not be too hard to put together a script/exe file that:

  • is run by PRTG with every sensor scan (this means every scanning interval),
  • reads the parameters forwarded by the sensor (%host, %snmpcommunity),
  • performs the query using NET-SNMP's binaries (snmpwalk.exe or snmpget.exe) or other binary/dll of your choice,
  • parses the result according to your wishes (you can use a case statement to match strings to values),
  • formats the output in a single or multi-channels PRTG API-compliant format (XML/JSON), and
  • lets PRTG read and display the values provided by the script.

Here are some examples of PowerShell/NET-SNMP-based custom sensors:


Best Regards,
Luciano Lingnau [Paessler Support]

Created on Feb 8, 2017 7:17:57 AM by  Luciano Lingnau [Paessler Support]

Last change on Jul 10, 2019 10:47:53 AM by  Maike Behnsen [Paessler Support]



Votes:

0

Your Vote:

Up

Down

Hi Luciano

This is probably the best answer i've ever received for any question ever. you even answered questions about PRTG that have been lurking in the back of my head but hadn't even verbalised yet! haha

It's exactly what i needed.

Thanks!

Trunq

Created on Feb 8, 2017 1:02:41 PM by  trunq (10) 1



Votes:

0

Your Vote:

Up

Down

Awesome! This was also the best feedback I got in a while, so cheers!

Best Regards,
Luciano Lingnau [Paessler Support]

Created on Feb 8, 2017 1:57:40 PM by  Luciano Lingnau [Paessler Support]



Please log in or register to enter your reply.


Disclaimer: The information in the Paessler Knowledge Base comes without warranty of any kind. Use at your own risk. Before applying any instructions please exercise proper system administrator housekeeping. You must make sure that a proper backup of all your data is available.