- Access exclusive content
- Connect with peers
- Share your expertise
- Find support resources
06-15-2019 07:51 AM - edited 06-25-2019 01:07 PM
I would like the information displayed in the "Show systems statistics session" CLI command to be packaged into a daily report so that I could see the previous day's throughput, packet rate, TCP sessions, etc and displayed in nice line graphs. Is there such a report?
Thanks!
Update
I solved this by using the XML API and a Powershell script (below) which is attached to a scheduled task that executes every minute. I found that the "show session info" command, and its API analog, shows the same info as the "show system statistics session" but in a passive format. Using the XML API and a script I exported the "show session info" data to XML and parsed it into a nice CSV file. I'm going to let the script collect data for a few weeks and then I'll take the resutling CSV files and chart their data in Excel.
Here's the script I used:
$paloList = "palo1.example.com","palo2.example.com" $queryUri="/api/?type=op&cmd=<show><session><info></info></session></show>&key=API KEY GOES HERE" $base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f "USERNAME","PASSWORD"))) $results =@() foreach($fw in $paloList) { $fullUrl="https://"+$fw+$queryUri try { [xml]$systemStats = Invoke-WebRequest -uri $fullUrl -Method Get -Headers @{Authorization=("Basic {0}" -f $base64AuthInfo)} } catch { Write-Host "StatusCode:" $_.Exception.Response.StatusCode.value__ Write-Host "StatusDescription:" $_.Exception.Response.StatusDescription } [object]$statsInfo = $systemStats.response.result | Select-Object pps,kbps,num-active,num-icmp,num-tcp,num-udp $results += New-Object -TypeName psobject -Property @{ "Date"=get-date -Format "MM-dd-yyyy"; "Time"=get-date -Format "hh:mm:ss"; "Packet rate"=$statsInfo.pps; "Throughput"=$statsInfo.kbps; "Total active sessions"=$statsInfo.'num-active'; "Active TCP sessions"=$statsInfo.'num-tcp'; "Active UDP sessions"=$statsInfo.'num-udp'; "Active ICMP sessions"=$statsInfo.'num-icmp'} $filename = $fw+"_statsInfo.csv" $results | select Date,Time,"Packet rate",Throughput,"Total active sessions","Active TCP sessions","Active UDP sessions","Active ICMP sessions" | export-csv $PSScriptRoot\$filename -NoTypeInformation -Append }
-Note 1: I have multiple devices that I'm pulling data from hence the loop.
-Note 2: You need to get yourself an API key for your device. I found that an API key from one device worked on another, but YMMV.
-Note 3: The resulting CSV file is saved to the same folder as the script.
-Note 4: The data is appended to the CSV file(s).
06-15-2019 03:38 PM
This isn't something that is readily available, however you could make it yourself if you log the output and then make the graphs with the information you have stored.
06-21-2019 01:55 AM
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!