Retrieve ACC information via XML API

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements

Retrieve ACC information via XML API

L1 Bithead
Hi, is there a way to query information shown in the ACC (for example the top applications of user with the IP ...) via the API? Could not find anything thus far. Thanks, Moritz
1 REPLY 1

L3 Networker

Hi,

 

I think you can do this through a custom report using the API.

 

For example, to retrive information about some applications, you could run:

 

cmd_string_0 = "<type><trsum><group-by>app</group-by><aggregate-by><member>from</member><member>to</member><member>dst</member><member>src</member><member>hour-of-receive_time</member><member>rule</member></aggregate-by><values><member>sessions</member><member>bytes</member></values></trsum></type><period>last-30-days</period><topn>500</topn><topm>50</topm><caption>CustomRep_ValidarApps</caption>"

 

custom_filter = "( app eq dns) or ( app eq ospf) or ( app eq ssl)"


cmd_concatenate_string = cmd_string_0 + "<query>" + custom_filter + "</query>"

 

 

 

command = '''https://''' + IP_PRE + '''/api/?type=report&async=yes&reporttype=custom&vsys=vsys2&cmd=''' + cmd_concatenate_string + '''&key=''' + KEY_PRE


os.system('''wget --output-document=''' + answer_file_monitor + ''' "''' + command + '''" --no-check-certificate >/dev/null 2>/dev/null''')

 

 

With this simple Python function you can retrive the JOB:

 

def retrive_job(IP_PANORAMA_PRE,KEY_PANORAMA_PRE,job_id,answer_file_monitor😞
command = '''https://''' + IP_PANORAMA_PRE + '''/api/?type=report&action=get&job-id=''' + job_id + '''&key=''' + KEY_PANORAMA_PRE
os.system('''wget --output-document=''' + answer_file_monitor + ''' "''' + commanda + '''" --no-check-certificate --no-check-certificate >/dev/null 2>/dev/null''')

 

 

Of course you can modify this code to fit your needs. Note that the important part is the custom filter and the cmd_string_0 defined.

 

Let me know if you need more info, I just adapted one old script I have.

 

  • 3375 Views
  • 1 replies
  • 0 Likes
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 LIVEcommunity as a whole!

The LIVEcommunity thanks you for your participation!