Skip to content

How to retrieve the total number of events, event volume, and the number of active agents for any given period through the API #1257

Answered by jshcodes
torirori-1 asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @torirori-1 -

I took a guess at what we wanted to use for event volume. Check this code out and let us know if you have any problems.

from datetime import datetime, timezone, timedelta
# Import the necessary FalconPy Service Classes
from falconpy import Alerts, Hosts

# This example demonstrates Environment Authentication
# To leverage direct authentication, pass your credentials
# to the client_id and client_secret keywords here.
alerts = Alerts(pythonic=True)
hosts = Hosts(auth_object=alerts)  # Object authentication

# Retrieve our totals for alerts and hosts
total_alerts = alerts.query_alerts_v2(limit=10000).total
total_hosts = hosts.query_devices_by_filter_scroll(limit=10000).total

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@jshcodes
Comment options

Answer selected by jshcodes
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
hosts Hosts or Host Groups issues and questions alerts Alerts issues or questions
2 participants