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

Value extraction using Regular Expression: Custom String Sensor

Votes:

1

Hi,

I have a custom string sensor - want to do some processing of the result (either "directly" or in an offline script), but ... how do I see the last response / reply string? I can see the response timing (e.g. 15 ms), but not the string itself. And then ... how do I test string processing (seeing output based on input and processing defined)?

Thanks!

extraction message regex script snmpcustomstringsensor string value

Created on Jun 25, 2015 12:30:16 PM

Last change on Jun 29, 2015 6:38:03 AM by  Luciano Lingnau [Paessler]



3 Replies

Votes:

1

Hello
I'll try to answer this with an example.

If you create a SNMP Custom String sensor that monitors the 1.3.6.1.2.1.1.1.0 OID of an HP Switch, it will as an example show the following message:

ProCurve J9021A Switch 2810-24G, revision N.11.64, ROM N.10.01 (/sw/code/build/bass)

If you wanted to extract the revision number, you can use regular expressions to accomplish that, in this case (\d+\.\d+) with a Group Index of 2 provides the following result:

11,64

The regular expression (regex) can be entered within the Sensor's settings, under the "Extended Processing" heading. Once this has been configured the following sensor query will be processed accordingly.

Note: A result of -999999999999 indicates that the extracted value could not be converted into a number.

You can additionally check with our SNMP Tester if the monitored OID returns a String and it's value.

Thumbnail

Click for Fullscreen image

Additional links:

Manual: Custom String Sensor

Manual: Regular Expressions

External: regex101.com

Created on Jun 26, 2015 12:20:57 PM by  Luciano Lingnau [Paessler]

Last change on Aug 2, 2016 10:11:18 AM by  Luciano Lingnau [Paessler]



Votes:

0

Thanks for the example! Is there no way to see the data returned inside PRTG? For example, does it not show "ProCurve J9021A Switch 2810-24G, revision N.11.64, ROM N.10.01 (/sw/code/build/bass)" anywhere?

Thanks again.

Created on Jun 26, 2015 4:37:10 PM



Votes:

0

The "Raw" message is always displayed by default as a message within PRTG, as such it is not stored, PRTG will only store numerical values. (That can be graphed/processed)

Once the SNMP Custom String Sensor returns a valid result and a numerical value is extracted that value will be stored by PRTG (It will show up as a new channel called Extracted Value)

Image below

  1. In Blue: please see the original message that the provided OID returns, it is only displayed as a sensor message.
  2. In Red: the Sensor's channels. Channel data is stored/graphed.

Thumbnail Click for Fullscreen image

Created on Jun 29, 2015 6:36:48 AM by  Luciano Lingnau [Paessler]

Last change on Jun 29, 2015 6:42:25 AM by  Luciano Lingnau [Paessler]




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.