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

HTTP XML/REST Value sensor - Returns Text value

Votes:

0

I have a XML/REST Value sensor working fine, unfortunately, the XML return value is a string, not a numeric value. We would like to receive the string, and use a custom lookup to convert translate to the PRTG state.

Something like this, within the lookup .ovl file -

<SingleInt state="OK" value="Up">
  Service is UP
</SingleInt>

Is there a way to do this with the XML/REST value sensor, or should I use a different sensor?

lookups xml xml-rest-value

Created on Oct 29, 2014 4:06:50 PM



8 Replies

Votes:

0

PRTG lookups can only interpret numeric values. We have reversal lookups on our wishlist, but this may take a while. Please bear with us one this one.

In the meantime, you might need a custom PowerShell that does the evalution of the values :)

Created on Oct 31, 2014 4:04:00 PM by  Stephan Linke [Paessler Support]



Votes:

0

Ok, thanks. I had a feeling that might be the case.

I have been working on a custom SSH script that pulls the JSON encoded data, parses it, then returns a prtg-readable result. Looks like I'm on the right track.

Thanks!

Created on Oct 31, 2014 7:11:20 PM



Votes:

0

Note that we also have a XML/REST available, it also works with JSON:

https://www.paessler.com/manuals/prtg/http_xmlrest_value_sensor.htm

Maybe you can use this one before you put any work into that script :)

Created on Nov 3, 2014 12:37:31 PM by  Stephan Linke [Paessler Support]

Last change on Nov 3, 2014 12:38:05 PM by  Stephan Linke [Paessler Support]



Votes:

0

Hi Stephan.

Yes, that is where I started. But that sensor does not process string (text) values. Only numeric values. Note that I'm looking to process a value of "UP". This is not something the XML/REST sensor can do. At least not yet.

Created on Nov 3, 2014 1:18:31 PM



Votes:

0

Hi Paesler Team , was there a way to solve the same problem without the use of additional scripts, add-ons of the sensor, or by changing the custom lookup ?

Created on Oct 2, 2018 1:34:15 PM



Votes:

0

Hi there,

You could take a look at the Rest Custom Sensor of PRTG which offers you more options. For example to check if the Value "Up" is found in a specific node you could use:

{
  "prtg": {
	"text": $.some.node,
    "result": [
      {
        "channel": "Total",
        "value": lookup($.some.node, "Up"),
	"limitmode": 1,
	"LimitMinError": 0,
	"LimitErrorMsg": "The value for 'node' is not 'Up'!"
      }
    ]
  }
}

Best regards.

Created on Oct 3, 2018 7:46:02 AM by  Dariusz Gorka [Paessler Support]



Votes:

0

I am completely confused in the sensor REST Custom. I ask you to help. I do not quite have a standard response from the device I want to monitor, when requested "http://1.1.1.1:2222/default/en_US/status.xml" (GoIP GSM-gateway)

I get such an answer

<status>
    <l1_module_status_gsm>1</l1_module_status_gsm>
    <l1_module_title_gsm/>
    <l1_module_status><a href="?type=list&down=1&line=1">Y</a></l1_module_status>
    <l1_module_title>Click to shut down module</l1_module_title>
    <l1_gsm_sim>Y</l1_gsm_sim>
    <l1_gsm_status>Y</l1_gsm_status>
    <l1_status_line>Y</l1_status_line>
    <l1_line_state>IDLE</l1_line_state>
    <l1_sms_login/>
    <l1_smb_login><font color="#FF0000">N</font></l1_smb_login>
    <l1_gsm_signal>19</l1_gsm_signal>
    <l1_gsm_cur_oper>MegaFon</l1_gsm_cur_oper>
    <l1_gsm_cur_bst/>
    <l1_lac/>
    <l1_sim_remain>NO LIMIT</l1_sim_remain>
    <l1_nocall_t>0</l1_nocall_t>
    <l1_acd>95</l1_acd>
    <l1_asr>18</l1_asr>
    <l1_callt>2118m</l1_callt>
    <l1_callc>1827/10575</l1_callc>
    <l1_rct>2018-09-06 04:00:46</l1_rct>
    <l1_sms_count>NO LIMIT</l1_sms_count>
    <l1_call_count>NO LIMIT</l1_call_count>
    <l2_module_status_gsm>2</l2_module_status_gsm>
    <l2_module_title_gsm/>
    <l2_module_status><a href="?type=list&down=1&line=2">Y</a></l2_module_status>
    <l2_module_title>Click to shut down module</l2_module_title>
    <l2_gsm_sim>Y</l2_gsm_sim>
    <l2_gsm_status>Y</l2_gsm_status>
    <l2_status_line>Y</l2_status_line>
    <l2_line_state>IDLE</l2_line_state>
    <l2_sms_login/>
    <l2_smb_login><font color="#FF0000">N</font></l2_smb_login>
    <l2_gsm_signal>25</l2_gsm_signal>
    <l2_gsm_cur_oper>MegaFon</l2_gsm_cur_oper>
    <l2_gsm_cur_bst/>
    <l2_lac/>
    <l2_sim_remain>NO LIMIT</l2_sim_remain>
    <l2_nocall_t>0</l2_nocall_t>
    <l2_acd>85</l2_acd>
    <l2_asr>17</l2_asr>
    <l2_callt>1509m</l2_callt>
    <l2_callc>1280/7861</l2_callc>
    <l2_rct>2018-09-06 04:00:46</l2_rct>
    <l2_sms_count>NO LIMIT</l2_sms_count>
    <l2_call_count>NO LIMIT</l2_call_count>
</status>    

I need only these lines

    <l1_gsm_sim>Y</l1_gsm_sim>
    <l1_gsm_status>Y</l1_gsm_status>
    <l1_status_line>Y</l1_status_line>
    <l1_gsm_signal>19</l1_gsm_signal>

The status "Y" is good, the status "N" is an accident, but in the event of an accident the next line comes

    <l1_gsm_sim><font color="#FF0000"></font></l1_gsm_sim>
    <l1_gsm_status><font color="#FF0000">N</font></l1_gsm_status>
    <l1_status_line><font color="#FF0000">N</font></l1_status_line>
    <l1_gsm_signal>0</l1_gsm_signal>

It is desirable in one sensor, with the ability to turn on the alarm when the status changes.

Created on Oct 3, 2018 12:22:23 PM

Last change on Oct 3, 2018 6:33:13 PM by  Torsten Lindner [Paessler Support]



Votes:

0

Hi there,

Unfortunately, the above "XML"-structure cannot be monitored as is it not an XMl structure. It looks more like HTML mixed with a XML-like structure, which the parser we use is not able to parse because of these lines:

<l1_module_status><a href="?type=list&down=1&line=1">Y</a></l1_module_status>
<l2_module_status><a href="?type=list&down=1&line=2">Y</a></l2_module_status>

And later because of the following within the "<l1_gsm_sim>"-node:

<font color="#FF0000"></font>

Maybe there is another API available that also outputs JSON or a clean XML structure?

Best regards.

Created on Oct 4, 2018 8:31:45 PM by  Dariusz Gorka [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.