<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Retrieving Hit Count and Last Hit Date Using Python in Automation/API Discussions</title>
    <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/retrieving-hit-count-and-last-hit-date-using-python/m-p/516397#M3185</link>
    <description>&lt;P&gt;We have several firewall managed via Panorama. I want to pull the rulebase from each firewall to get the Hit Count and Last Hit date. I've got partial script, but I'm lost on accessing dict.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here are the two links that I've been using:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://pan-os-python.readthedocs.io/en/latest/module-policies.html#panos.policies.RulebaseHitCount" target="_blank"&gt;https://pan-os-python.readthedocs.io/en/latest/module-policies.html#panos.policies.RulebaseHitCount&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://pan-os-python.readthedocs.io/en/latest/_modules/panos/policies.html#RulebaseHitCount" target="_blank"&gt;https://pan-os-python.readthedocs.io/en/latest/_modules/panos/policies.html#RulebaseHitCount&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;#!/usr/bin/env python&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;import sys&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;import panos&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;from panos.firewall import Firewall&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;from panos.policies import Rulebase, SecurityRule, RulebaseHitCount&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;HOSTNAME = ""&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;USERNAME = &lt;/FONT&gt;" "&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;PASSWORD =&lt;/FONT&gt; " "&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;fw = panos.firewall.Firewall(HOSTNAME, USERNAME, PASSWORD)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;rulebase = RulebaseHitCount('security', rules=None, all_rules=False)&lt;/FONT&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 29 Sep 2022 19:37:40 GMT</pubDate>
    <dc:creator>PaulAmmann</dc:creator>
    <dc:date>2022-09-29T19:37:40Z</dc:date>
    <item>
      <title>Retrieving Hit Count and Last Hit Date Using Python</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/retrieving-hit-count-and-last-hit-date-using-python/m-p/516397#M3185</link>
      <description>&lt;P&gt;We have several firewall managed via Panorama. I want to pull the rulebase from each firewall to get the Hit Count and Last Hit date. I've got partial script, but I'm lost on accessing dict.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here are the two links that I've been using:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://pan-os-python.readthedocs.io/en/latest/module-policies.html#panos.policies.RulebaseHitCount" target="_blank"&gt;https://pan-os-python.readthedocs.io/en/latest/module-policies.html#panos.policies.RulebaseHitCount&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://pan-os-python.readthedocs.io/en/latest/_modules/panos/policies.html#RulebaseHitCount" target="_blank"&gt;https://pan-os-python.readthedocs.io/en/latest/_modules/panos/policies.html#RulebaseHitCount&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;#!/usr/bin/env python&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;import sys&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;import panos&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;from panos.firewall import Firewall&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;from panos.policies import Rulebase, SecurityRule, RulebaseHitCount&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;HOSTNAME = ""&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;USERNAME = &lt;/FONT&gt;" "&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;PASSWORD =&lt;/FONT&gt; " "&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;fw = panos.firewall.Firewall(HOSTNAME, USERNAME, PASSWORD)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;rulebase = RulebaseHitCount('security', rules=None, all_rules=False)&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Sep 2022 19:37:40 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/retrieving-hit-count-and-last-hit-date-using-python/m-p/516397#M3185</guid>
      <dc:creator>PaulAmmann</dc:creator>
      <dc:date>2022-09-29T19:37:40Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieving Hit Count and Last Hit Date Using Python</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/retrieving-hit-count-and-last-hit-date-using-python/m-p/517685#M3201</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;have you resolved this issue?&lt;/P&gt;</description>
      <pubDate>Wed, 12 Oct 2022 20:15:29 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/retrieving-hit-count-and-last-hit-date-using-python/m-p/517685#M3201</guid>
      <dc:creator>PawelZubkowicz</dc:creator>
      <dc:date>2022-10-12T20:15:29Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieving Hit Count and Last Hit Date Using Python</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/retrieving-hit-count-and-last-hit-date-using-python/m-p/517709#M3202</link>
      <description>&lt;P&gt;Use the &lt;CODE&gt;opstate&lt;/CODE&gt; namespace hanging off of the &lt;CODE&gt;panos.policies.SecurityRule&lt;/CODE&gt; instance.&amp;nbsp; There's a whole section of the documentation devoted to opstate stuff, you can see it here:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://pan-os-python.readthedocs.io/en/latest/getting-started.html#the-opstate-namespace" target="_blank"&gt;https://pan-os-python.readthedocs.io/en/latest/getting-started.html#the-opstate-namespace&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Oct 2022 22:15:33 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/retrieving-hit-count-and-last-hit-date-using-python/m-p/517709#M3202</guid>
      <dc:creator>gfreeman</dc:creator>
      <dc:date>2022-10-12T22:15:33Z</dc:date>
    </item>
  </channel>
</rss>

