Unable to get output of 'show rule-hit-count...' via panxapi.py or xapi.py

Reply

Unable to get output of 'show rule-hit-count...' via panxapi.py or xapi.py

Hi All,

 

Wondering if anyone has been able to successfully get the output of the following command via either the panxapi.py wrapper or via their own functions that make use of the xapi.py module:

 

PS C:\Program Files (x86)\Python37-32\Scripts> python .\panxapi.py -Xjro 'show rule-hit-count vsys vsys-name vsys1 rule-base security rules all'
op: error [code="17"]: " show -> rule-hit-count -> vsys -> vsys-name -> vsys1 unexpected here
show -> rule-hit-count -> vsys -> vsys-name is invalid"
PS C:\Program Files (x86)\Python37-32\Scripts>

 

I thought maybe I was doing something wrong while writing my own wrapper for xapi.py, but after using the panxapi.py wrapper I get the exact same response from a PA 820 running version 8.0.10.

 

It is probably also worth mentioning that this exact string can be run as a command on the 820 via SSH, and I receive the expected output.

 

All input welcome.

 

Thanks!

 

L4 Transporter

Re: Unable to get output of 'show rule-hit-count...' via panxapi.py or xapi.py

You'll need to specify the XML yourself for that command.  There are multiple variables that you're specifying with this command, so the automatic XML-ification that the libraries do will fail.

 

Using debug cli on specified here, the XML the op command is sending on my firewall looks like this:

 

<show><rule-hit-count><vsys><vsys-name><entry name='vsys1'><rule-base><entry name='security'><rules><all/></rules></entry></rule-base></entry></vsys-name></vsys></rule-hit-count></show>

L0 Member

Re: Unable to get output of 'show rule-hit-count...' via panxapi.py or xapi.py

Thanks I'll give this a shot and send it in XML.

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!