Forum Discussion

Lewis_Beard's avatar
11 months ago

Can the API get the alert rule associated to a datapoint on a DS instance?

I have been hunting through the swagger docs, and I can’t seem to find a way to get the alert rule or alert routing being applied to a specific datapoint on a specific datasource instance. I’ve looked for routing, tuning, etc and I’m not seeing anything.

I want to write a script that looks through every resource, snags the Host Status instance specific to that object, looks at the idleInterval datapoint, and then shows me the Alert Routing information. We found an old alert rule that was set up wrong and accidentally was letting idleInterval alerts slip through. So I want to write a script that shows me what they all are.

I can drill down to the specific host status instance on the resource, but nothing actually shows me the alert routing, that I can find. There is an alertsettings and a config call one can make against the datasource, but they dont show the actual routing.

Is there an API call I’ve overlooked? Or is this something you can’t pull back via API?

Thanks!

  • mray's avatar
    mray
    Icon for LM Conqueror rankLM Conqueror

    If you want to use the API, you technically can see the routing but the endpoint is not supported and listed. I can’t speak on how reliable it is…

    You call /alertsettings/{datapointID}/recipients

    But with all that said, you can also just run an Alert Threshold report. You can even run it with ‘Only show custom thresholds’ enabled. 

  • Hey @Lewis Beard 

    So, the endpoint that @Michael Raymond had mentioned is an unsupported endpoint.  That is what this disclaimer was in his post:

    If you want to use the API, you technically can see the routing but the endpoint is not supported and listed. I can’t speak on how reliable it is…

    There are many endpoints that we don’t expose via Swagger as they are typically used for internal communication.  However, as long as the endpoint is a v3 UI endpoint it should work from an external API call.  With these endpoints, we can and do change them from time to time with no warning, that is why it’s unpublished.  I would definitely recommend submitted feedback for your use case on that endpoint and our product team can consider it for adding into being a supported endpoint. 

  • Anonymous's avatar
    Anonymous

    Hey @Lewis Beard 

    So, the endpoint that @Michael Raymond had mentioned is an unsupported endpoint.  That is what this disclaimer was in his post:

    If you want to use the API, you technically can see the routing but the endpoint is not supported and listed. I can’t speak on how reliable it is…

    There are many endpoints that we don’t expose via Swagger as they are typically used for internal communication.  However, as long as the endpoint is a v3 UI endpoint it should work from an external API call.  With these endpoints, we can and do change them from time to time with no warning, that is why it’s unpublished.  I would definitely recommend submitted feedback for your use case on that endpoint and our product team can consider it for adding into being a supported endpoint. 

    The large number of unsupported endpoints needs a better reason from the LM management than, “we don’t think anybody wants to use it but us and we might change them”. Does LM have any endpoints currently in the support/release pipeline? It’s been my experience that you’re just SOL if your endpoint isn’t published.

    That said, I’ve used many of the unpublished endpoints to great success. The v2 ones will never change, only get decommissioned. I haven’t had a v3 one change on me ever.

  • Thanks for the responses from everyone. For a quick get-to-the-data result, I’ve done the report. Later after I clean up some resources, I will probably use the unsupported endpoint to do a custom ConfigSource to reveal problematic alert rules on HostStatus (once I nip them in the bud).

    Cheers!

  • When I check out the V3 API ( https://www.logicmonitor.com/swagger-ui-master/api-v3/dist/ ) swagger docs, I dont find any option for alertsettings/{id}/recipients or anything like that. Even when I just search the whole thing for recipients, I’m not seeing anything. Weird. I had previously combed the page for every occurrence of alertsettings. I guess I could just try it.

    I’d rather use the API because I’m looking for 2 recipients that I want to flag as a problem, and I’d like to turn some code into a ConfigSource that throws me an alert if it sees either of the 2 options I want to screen for.

    But I had totally overlooked the Alert Threshold report. I didnt even see the report, much less the columns. Thanks! I can at least set that up. I dont need the custom thresholds toggle, but its good to know about. Let me know if I missed something in the swagger docs, because I cant find the alertsettings/{id}/recipients, but the report should be good.

    Cheers!