Page 1 of 1
Get Current Alert Configuration
Posted: Mon Jun 15, 2020 4:09 pm
by randall.schievelbein
I have a script running on an alert being triggered in which I need to get the current alert configuration. I have attempted to use the alert history API, however I can only get information about the alert from the last time it was triggered at the latest. However, I can't assume that the last time the alert was triggered that it had the same configuration and it seems like the alert history doesn't update until after my script is finished running.
Is there a way for me to read the current configuration of the alert from my script?
Re: Get Current Alert Configuration
Posted: Tue Jun 16, 2020 5:17 pm
by benjaminsmith
Hi Randall,
That is a good question and I'm going to do a bit of research on it and get back to you once I've had a chance to review this further with the other team members.
Re: Get Current Alert Configuration
Posted: Wed Jun 17, 2020 9:11 am
by cdienger
This information can be found in the nagioslogserver index. You can pull it directly with something like:
Code: Select all
curl -XGET "http://localhost:9200/nagioslogserver/alert/AXLCm7Ku2ua2gtT2HiHq"
Where AXLCm7Ku2ua2gtT2HiHq is the unique id of the alert. You can find the id by running:
Code: Select all
curl -XGET "http://localhost:9200/nagioslogserver/alert/_search?size=2000&pretty"
Re: Get Current Alert Configuration
Posted: Wed Jun 17, 2020 3:57 pm
by randall.schievelbein
This was exactly what I needed, thank you.
Re: Get Current Alert Configuration
Posted: Wed Jun 17, 2020 4:52 pm
by cdienger
Glad to help!