What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general.

Learn more

PRTG Network Monitor

Intuitive to Use. Easy to manage.
More than 500,000 users rely on Paessler PRTG every day. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free Download

Top Tags


View all Tags

Can I graph text values?

Votes:

0

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

Last change on Jul 9, 2019 6:48:21 AM by  Maike Guba [Paessler Support] (2,404) 2 1



Best Answer

Accepted Answer

Votes:

0

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 only display the Response Time because only numeric values (1, 2, 3, -5, 4.56, 0, ...) can be assigned to channels.

This sensor only generates 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 sets the sensor to the Down status. However, it does 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 looks like the following:

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

This is obviously not one numeric 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 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 is 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 must be created using a text editor (as it is an XML-like file). It tells the sensor:

  • which string(s) to expect,
  • which sensor status corresponds 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 generates alerts, and displays the received string as well. The Value channel displays the received string mapped to a state. For an example, see the article Monitor and "lookup" an 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 numeric 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 displays 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 PRTG Manual: Define Lookups.

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]

Last change on Jan 4, 2023 2:47:25 PM by  Brandy Greger [Paessler Support]



9 Replies

Votes:

0

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]



Votes:

0

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

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



Accepted Answer

Votes:

0

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 only display the Response Time because only numeric values (1, 2, 3, -5, 4.56, 0, ...) can be assigned to channels.

This sensor only generates 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 sets the sensor to the Down status. However, it does 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 looks like the following:

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

This is obviously not one numeric 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 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 is 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 must be created using a text editor (as it is an XML-like file). It tells the sensor:

  • which string(s) to expect,
  • which sensor status corresponds 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 generates alerts, and displays the received string as well. The Value channel displays the received string mapped to a state. For an example, see the article Monitor and "lookup" an 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 numeric 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 displays 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 PRTG Manual: Define Lookups.

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]

Last change on Jan 4, 2023 2:47:25 PM by  Brandy Greger [Paessler Support]



Votes:

0

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



Votes:

0

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]



Votes:

0

Hi, i would like to ask if is possible to monitor custom string using Push HTTP Data Advanced Sensor, in particular if is possible to put custom string in the value parameter in the request, if is not there an any works around that i can use to monitor custom string using the Push Sensor?

Created on Apr 21, 2023 12:48:44 PM



Votes:

0

Hello Marco,

can you be more specific what you exactly want to monitor? Compare a string with a fixed value? Return a string instead of a numeric value as sensor data? Or something else?

Created on Apr 25, 2023 5:34:10 PM by  Arne Seifert [Paessler Support]



Votes:

0

Hi, I need to return the string value of a parameter that would probably change in the time, and i need to monitor those changes (for example i need to monitor tha names of databases that the sensor is monitoring), i saw in the documentation that this is not possible using the value parameter(i'm using a lookup file for boolean value but for the string that i need to monitor is not possible), so i'm now using the text parameter of the request to send all the strings. Is there a way to log all the messages that i sent at the sensor? Thanks

Created on Apr 28, 2023 10:52:24 AM



Votes:

0

Hello Marco,

arbitrary strings cannot be logged as part of the historic sensor data. Only a list of pre-defined strings can be, mapped to numbers, be monitored.

Created on May 2, 2023 8:48:29 AM by  Arne Seifert [Paessler Support]




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.