New Question
 
 
PRTG Network Monitor

Intuitive to Use.
Easy to manage.

200.000 administrators have chosen PRTG to monitor their network. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free PRTG
Download >>

 

What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general. You are invited to get involved by asking and answering questions!

Learn more

 

Top Tags


View all Tags


Palo Alto Rest Custom

Votes:

0

Your Vote:

Up

Down

I am trying to monitor the BGP status of Palo Alto peers using PRTG's REST Custom BETA sensor. The basic flow from what I've read should go like this:

  1. Make the API call and receive data back - in this case Palo Alto returns XML compliant data and then PRTG will translate that to JSON
  2. The custom rest sensor template will determine how to parse the result - in this case we only have a channel and value, both of which are variables derived from the API call results

For this particular template I needed a string to be converted to an integer so I used the lookup function. However when I add this sensor I get an error that says '5:16 - 5:17 unexpected "/" while scanning extensions.'

I've tried to read through a couple of links like: https://www.paessler.com/manuals/prtg/rest_custom_sensor and https://kb.paessler.com/en/topic/80028-palo-alto-bgp-monitoring and it got me this far but now I'm stuck. Any help or guidance towards the solution would be greatly appreciated.

Most of the relevant information I could think of is below:

PRTG Version: 20.3.60.1623

Sensor: REST Custom BETA

Request Method: GET
Request Protocol: HTTPS
Certificate Acceptance: Accept all certificates
Authentication Method: No authentications (default)
HTTP Headers: Do no use custom HTTP headers
Timeout (Sec.): 60
Rest Query: /api/?type=op&cmd=<show><routing><protocol><bgp><peer><peer-name>sanatizedPeer</peer-name></peer></bgp></protocol></routing></show>&key=sanatizedKey
Rest Configuration pa-bgp-peer.template

##### CUSTOM REST SENSOR TEMPLATE - pa-bgp-peer.template

{
  "prtg": {
    "description" : {
      "device": "paloalto",
      "query": /api/?type=op&cmd=<show><routing><protocol><bgp><peer><peer-name>$PEER_NAME</peer-name></peer></bgp></protocol></routing></show>&key=$KEY",
      "comment": "Palo Alto BGP Peer status"
    },
    "result":
      {
        "channel": $.response.result.entry.peer-group,
        "value": lookup($.response.result.entry.status, "Idle", "Connect", "Active", "OpenSent", "OpenConfirm", "Established")
      }
  }
}

##### RESULT FROM CLI ON PRTG CORE SERVER

C:\Program Files (x86)\PRTG Network Monitor\Sensor System>rest.exe "https://1.1.1.1/api/?type=op&cmd=<show><routing><protocol><bgp><peer><peer-name>sanatizedPeer</peer-name></peer></bgp></protocol></routing></show>&key=sanatizedKey" passthrough -tlsignore 1
{
  "response": {
    "result": {
      "entry": {
        "-peer": "sanitizedPeer",
        "-vr": "sanitizedVR",
        "ORF-entry-received": 0,
        "aggregate-confed-as": "no",
        "config": {
          "remove-private-as": "no"
        },
        "connect-retry-interval": 1,
        "established-counts": 12,
        "holdtime": 90,
        "holdtime-config": 90,
        "idle-hold": 15,
        "keepalive": 30,
        "keepalive-config": 30,
        "last-error": "HoldTimer expired (4)",
        "last-update-age": 89663,
        "local-address": "2.2.2.2",
        "msg-total-in": 2122,
        "msg-total-out": 2125,
        "msg-update-in": 7,
        "msg-update-out": 56,
        "multi-hop-ttl": 1,
        "nexthop-peer": "no",
        "nexthop-self": "no",
        "nexthop-thirdparty": "yes",
        "open-delay": 0,
        "passive": "no",
        "password-set": "no",
        "peer-address": "3.3.3.3",
        "peer-capability": "",
        "peer-group": "sanatizedGroup",
        "peer-router-id": "4.4.4.4",
        "peering-type": "Unspecified",
        "prefix-counter": "",
        "prefix-limit": 50,
        "reflector-client": "not-client",
        "remote-as": 65000,
        "same-confederation": "no",
        "status": "Connect",
        "status-duration": 896,
        "status-flap-counts": 1148
      }
    },
    "status": "success"
  }
}

##### Error the sensor gives

Parsing error: { "prtg": { "description" : { "device": "paloalto", "query": /api/?type=op&cmd=<show><routing><protocol><bgp><peer><peer-name>$PEER_NAME</peer-name></peer></bgp></protocol></routing></show>&key=$KEY", "comment": "Palo Alto BGP Peer status" }, "result": { "channel": $.response.result.entry.peer-group, "value": lookup($.response.result.entry.status, "Idle", "Connect", "Active", "OpenSent", "OpenConfirm", "Established") } } }:5:16 - 5:17 unexpected "/" while scanning extensions.

Thank you!

palo-alto prtg rest

Created on Jul 16, 2020 8:39:55 PM by  EssenseD (0) 1



1 Reply

Votes:

0

Your Vote:

Up

Down

Hello there,

The / needs to be removed first of all. /api/?type... won't work, /api?type...should work. But depends on the manufacturer.


Kind regards,
Felix Saure, Tech Support Team

Created on Jul 17, 2020 10:26:15 AM by  Felix Saure [Paessler Support]



Please log in or register to enter your reply.


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.