feat(sentinelone): count-agents can ask about versions, state and hardware
The count only knew where an agent was, not what it was running or what it runs on. Four filters carry the console's own vocabulary through: agentVersion__gt to count the fleet still below a target build, networkStatuses to keep only the endpoints in a given connection state, operationalStatesNin to leave states out of the tally, and machineTypes to count servers apart from laptops. The list filters are split and re-joined so a hand-typed "connected, disconnected" does not reach the API with the space inside the value.
This commit is contained in:
@@ -29,6 +29,14 @@ def main():
|
||||
"scan_status": inputs.get("scan_status"),
|
||||
"siteIds": inputs.get("siteIds"),
|
||||
"groupIds": inputs.get("groupIds"),
|
||||
# Agents strictly newer than the given version, e.g. 23.4.2.6 — the console
|
||||
# answers with the fleet still trailing behind a target build.
|
||||
"agentVersion__gt": inputs.get("agentVersion__gt"),
|
||||
# Comma-separated lists are re-joined so a hand-typed "connected, disconnected"
|
||||
# does not reach the API with the space inside the value.
|
||||
"networkStatuses": ",".join(csv(inputs.get("networkStatuses"))),
|
||||
"operationalStatesNin": ",".join(csv(inputs.get("operationalStatesNin"))),
|
||||
"machineTypes": ",".join(csv(inputs.get("machineTypes"))),
|
||||
}
|
||||
url = base + "/agents/count?" + urllib.parse.urlencode({k: v for k, v in qs.items() if v not in (None, "")})
|
||||
print(json.dumps(request("GET", url, headers)))
|
||||
|
||||
Reference in New Issue
Block a user