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

REST API structure

Votes:

0

Hi,

I am trying to get your RESTAPI working and am getting an error returned

"Last Message: '=' is an unexpected token. The expected token is ';'. Line 29, position 94.:

In the PRTG screen when it polls the url

Using the a REST Client I enter the following request

Get https://192.168.208.72/api/4.0/edges/edge-1/status

And I get a response of

HTTP/1.1 200 OK

<?xml version="1.0" encoding="UTF-8"?>
<edgeStatus>
    <timestamp>1507850357296</timestamp>
    <systemStatus>good</systemStatus>
    <activeVseHaIndex>0</activeVseHaIndex>
    <edgeStatus>GREEN</edgeStatus>
    <publishStatus>APPLIED</publishStatus>
    <version>165</version>
    <edgeVmStatus/>
    <featureStatuses>
        <featureStatus>
            <service>routing</service>
            <status>Applied</status>
        </featureStatus>
        <featureStatus>
            <service>highAvailability</service>
            <status>not_configured</status>
        </featureStatus>
        <featureStatus>
            <service>ipsec</service>
            <status>down</status>
        </featureStatus>
        <featureStatus>
            <service>nat</service>
            <status>Applied</status>
        </featureStatus>
        <featureStatus>
            <service>sslvpn</service>
            <status>up</status>
        </featureStatus>
        <featureStatus>
            <service>loadBalancer</service>
            <status>down</status>
        </featureStatus>
        <featureStatus>
            <service>l2vpn</service>
            <status>not_configured</status>
        </featureStatus>
        <featureStatus>
            <service>firewall</service>
            <status>Applied</status>
        </featureStatus>
        <featureStatus>
            <service>dhcp</service>
            <status>up</status>
        </featureStatus>
        <featureStatus>
            <service>syslog</service>
            <status>down</status>
        </featureStatus>
        <featureStatus>
            <service>dns</service>
            <status>up</status>
        </featureStatus>
    </featureStatuses>
</edgeStatus>

How can I turn this info into a sensor? This is for VMware NSX.

Regards Trevor

api rest xml

Created on Oct 12, 2017 11:39:00 PM

Last change on Oct 13, 2017 10:37:58 AM by  Luciano Lingnau [Paessler]



1 Reply

Votes:

0

Hello there, we appreciate your contact.

How did you attempt to monitor this with PRTG?

Essentially, the best sensor for the job is the REST Custom sensor. However, none of the statuses in the XML are numerical, they appear to be: Up, Down, Applied and not_configured.

Since PRTG expects numerical values, you will need to apply the Lookup function in the rest custom template:

lookup({mysource.string}, string, string, ....)

After that the sensor should be successfully deployed and will display all corresponding numerical values in the sensor's overview. The next step is creating a corresponding PRTG Lookup to define the corresponding Text and alert level, something like this:

<?xml version="1.0" encoding="UTF-8"?>
  <ValueLookup id="prtg.customlookups.something" desiredValue="0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="PaeValueLookup.xsd" undefinedState="Warning">
    <Lookups>
      <SingleInt state="Ok" value="0">Up</SingleInt>
	  <SingleInt state="Error" value="1">Down</SingleInt>
      <SingleInt state="Error" value="2">Applied</SingleInt>
	  <SingleInt state="Error" value="3">Not Configured</SingleInt>
    </Lookups>
  </ValueLookup>

The other alternative would be to write a custom sensor (Powershell, exe, etc) to evaluate the XML and produce a PRTG-compliant output: HTTP Data Advanced - JSON response formatting

You can find further details about the Custom Sensors API on the following URL or within your PRTG's web-interface under Setup > PRTG API.

Best Regards,
Luciano Lingnau [Paessler Support]

Created on Oct 13, 2017 10:49:39 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.