FW Monitoring through XML API

Reply
L4 Transporter

FW Monitoring through XML API

Hi all,

I am trying to get the cluster states of our two PA Firewalls (active/passive) through the XML API. I am particular interested in the "state" values of both members. The only thing I was able to retrieve was https://hostname/api/?type=op&cmd=%3Cshow%3E%3Chigh-availability%3E%3Call%3E%3C%2Fall%3E%3C%2Fhigh-a...

But for monitoring purpose (PRTG) I just need the "<local-info><state>" part of the whole output. How can I do that ? What is the API URL for just that information ?

thanks Roland

Tags (2)
L3 Networker

Re: FW Monitoring through XML API

There's a little example in panxapi(1) from PAN-perl which shows how to get to some data in type=op XML output.

   Print operational command variable using shell pipeline.
      $ (panxapi -t pa-200 -Xpro 'show system info';
      > echo 'print $VAR1->{system}->{"av-version"},"\n"') | perl
      op: success
      641-875

You could also try to find what you are looking for in sysd (show system state ...) which doesn't get everything wrapped in XML when using  the API type=op request.

L4 Transporter

Re: FW Monitoring through XML API

thanks, but I need an API URL  a script does not help in that case.

L4 Transporter

Re: FW Monitoring through XML API

Hi Roland,

The currently available API in 4.1.x does not allow you to query single specific values from the output returned.  The operational commands available through the API simply map to the equivalent commands available through the CLI.  The application calling the API would need to parse the output to limit the response to just the value required.

Thanks,

-- Kevin

L3 Networker

Re: FW Monitoring through XML API

Note that there are some configuration mode commands that can be performed via type=op API requests.

For example, check and save.  This isn't documented as far as I know.

$ panxapi -t pa-200 -Xxo 'check pending-changes'

op: success

<response status="success"><result>no</result></response>

$ panxapi -t pa-200 -Xxo 'save config'

op: success

<response status="success"><result>Config saved to .snapshot.xml</result></response>

Like what you see?

Show your appreciation!

Click Like if a post is helpful to you or if you just want to show your support.

Click Accept as Solution to acknowledge that the answer to your question has been provided.

The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!

These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the Live Community as a whole!

The Live Community thanks you for your participation!