AutomoxAutomox

API Endpoint for Activity Log and Overview Report

kido1991
March 10, 2022 at 3:00 pm UTC
#reporting#api

Hi,

Is there any endpoint or anyway that we can pull the data of Activity Log and Overview Report using the API yet?

Thank you.

This discussion is archived and closed to replies. Continue it in the Automox Community Slack.

Discuss on Slack

Replies (2)

Redwolf_PainterMarch 28, 2022
#1

I am also interested in the answer to this question. I need to query the log to find out that patches have completed installing, so they can be put back into the F5 VIP.

jack.smithApril 1, 2022
#2

This is how I’ve captured the Activity Log for a specific policy going back 7 days. Want to get everything, drop the &policyID=$policy from the URL.

powershell33 lines
# Header info
$apiKey = Read-Host "api-key: "
$orgID = "Your-Org-ID"
$headers = @{ "Authorization" = "Bearer $apiKey" }

# The policy
$policy = "Your-Policy-Number"

# Search Requirements
$start = (Get-Date).AddDays(-7) # go back 7 days
$start = Get-Date $start -f 'yyyy-MM-dd'
$end = Get-Date -f 'yyyy-MM-dd'
$i = 0

$data = do{
    $url = "https://console.automox.com/api/events?o=$orgID&policyId=$policy&limit=500&page=$i&startDate=$start&endDate=$end"
    $response = (Invoke-WebRequest -Method Get -Uri $url -Headers $headers).Content | ConvertFrom-Json
    $response | % {
        $name = $_.server_name
        $id = $_.server_id
        [pscustomobject] @{
            host = $name
            hostid = $id
            status = $_.data.status
            timestamp = $_.create_time
            data = $_.data.text
        }
    }
    $i++
}
while ($response)

$data