Pull .csv Alerts Thresholds Report via API
Hello All,
I’m looking for the fastest and most efficient way to generate an Alert Thresholds Report across more than 26,000 devices or 9,000 distinct groups in LogicMonitor.
Group Example:
Group#1: Customers_datacenter1/customer1/Azure Resources/Non-Prod/VirtualMachines
Group#2: Customers_datacenter2/customer2/Azure Resources/Prod/VirtualMachines
Challenges Faced:
API 50000 records Limitations: Using https://$company.logicmonitor.com/santaba/rest/functions works well, but due to the 50,000-record limit, I need to iterate through each device.
This results in extremely long execution times.
Script Freezing & Dynamic Link Not Found Error, it could be related:
After running for several hours, the script sometimes gets stuck and stops progressing.
When manually running the report for the same group, I encountered a "Dynamic Link Not Found" error after a long execution time (see attached screenshot)
I attempted to use the REST API /report/reports/ID/executions after referring the following post
pull csv report via rest api
$jsonData = '{"receiveEmails": "dummy.account@gmail.com"}'
$url = 'https://' + $company + '.logicmonitor.com/santaba/rest/report/reports/1659/executions?v=3'
$response = Invoke-WebRequest -Uri $url -Method Post -Header $headers -Body $jsonData -ContentType 'application/json' -UseBasicParsing -ErrorAction Stop
}
Got the following response
Report_Data_Response :=> {
"reportId" : 1659,
"taskId" : 2025084198330241236,
"resulturl" : null
}
Then used "reportId" : 1659 and "taskId" : 2025084198330241236 in the following API call which resulted the following response "The task is running; errorCode=1202" (even with 5 min retrying)
https://' + $company + '.logicmonitor.com/santaba/rest/report/reports/1659/tasks/' + $tid + '?v=3
Response: errorMessage=The task is running; errorCode=1202; errorDetail=
Attempts So Far:
Tried using the /rest/functions API again, but it still struggles with large data volumes may be due to Firebase
Tried using /report/reports/ID/executions
Attempted to generate the report via REST API but faced the 415 error.
Request for Recommendations:
What’s the most efficient way to retrieve the Alert Thresholds Report for such a large dataset?
Is there an optimized approach to handle this volume without exceeding API limits or running into execution failures?
Would appreciate any guidance!
Thanks
Ashish