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

Regular expression to strip dash between two numbers

Votes:

0

Hello,

I am extracting a software version value through SNMP and would like to remove a dash in the returned value. The SNMP oid returns a value in this format: 1000-2000 and I would like to remove the dash so that I can use the output in a sensor factory sensor.

The scenario is like this: We have a test firewall on which we use rest api calls to extract the installed and latest software versions through xml, this works fine. In the xml rest sensor I can use the option "Characters to remove" and specify the dash, this works perfectly.

But my issue arises when I want to match the extracted latest software version against a value which I extracted from our production firewalls through SNMP. We would like to avoid using the rest api on the production devices because some performance and security issues arise when using the rest api.

So in short my question is: Can I easily remove the dash in between two number outputted by an SNMP oid? (So 1000-2000 should become 10002000)

My regular expression knowledge is very limited, I can separate both numbers in two capture groups but I need both numbers, not one half of the full version number. As far as my understanding goes I would need a replace regex construction to achieve my desired result or is there an easier solution?

prtg regular-expression snmp xml-rest-value

Created on Oct 8, 2013 11:55:14 AM



2 Replies

Votes:

0

Hello,

thank you very for your KB-Post. I'm very sorry, this is not possible in PRTGs native sensors in the moment. Please use a Custom Exe/Script Sensor to do this.

best regards.

Created on Oct 10, 2013 1:38:26 PM by  Torsten Lindner [Paessler Support]

Last change on Oct 10, 2013 3:57:02 PM by  Torsten Lindner [Paessler Support]



Votes:

0

PTF.SNMPGet

This is possible with new Custom Sensor SNMPGet

The sensor retrieves the OID value using SNMP and filters the result by removing given characters.

Parameters used:

-s=    IP or hostname of the device to check.
-o=    The OID to get the value from
-c=    Optional, community string, default=public.
-v=    Optional, SNMP version (1,2,3), default=1.
-rc=   Optional, characters to remove from the OID return value.

The sensor can be downloaded from this page.

Created on Oct 11, 2013 11:35:52 AM




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.