- Access exclusive content
- Connect with peers
- Share your expertise
- Find support resources
05-25-2016 05:45 AM
06-17-2016 02:54 PM
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.
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!