spring-boot-admin icon indicating copy to clipboard operation
spring-boot-admin copied to clipboard

Notifications for actuator endpoint changes

Open Mickey84562 opened this issue 7 years ago • 5 comments

It would be nice to be able to set notifications for when values on actuator endpoints (ie metrics or jmx) reach certain values or change.

From a preliminary investigation, it looks like you'd have to iterate through registered instances via InstanceRepository, survey the desired endpoint(s) through getEndpoints(), parse the JSON retrieved via the URL, and then creating a custom InstanceEvent for consumption by a Notifier. It may also be necessary to make some changes to account for needing a unique message for endpoint change/value notifiers

Mickey84562 avatar Jul 30 '19 14:07 Mickey84562

So why don't you write a HealthIndicator reflecting this condition?

joshiste avatar Jul 31 '19 13:07 joshiste

Hello, this would be quite useful.

I think the original poster was asking how to monitor and set alarms for metrics rather than health endpoints. I don't think what @joshiste suggested is the right way to do it, because health and metrics have two different purposes, as explained well here: https://www.baeldung.com/spring-boot-health-indicators#health-information-vs-metrics

In the SBA UI it is possible to add metrics and display their values, the idea here would be to also be able to add a monitor that checks the value of those metrics periodically against a condition and send a notification if there is a breach. Something similar to what e.g. Kibana does: https://www.elastic.co/what-is/kibana-alerting I understand this would probably require a lot of work and could lead down a very deep rabbit hole, nevertheless it would be a cool feature!

mfabiani-av avatar Mar 28 '22 09:03 mfabiani-av

Hi @mfabiani-av,

monitoring metrics is not possible, as we do not poll the metrics and also do not store the values. Only if the page is opened in the browser, then the client is polling the metrics endpoint. The backend is just forwarding the requests and responses, but there is no persistence.

So if you want to have metrics and alerting think about using prometheus or kibana or something similar with a timeseries database.

The proposal with the HealthIndicator is based on the assumption, that the metric change/threshold is indicating a problem (and therefore requires a notification). You can add own HealthIndicators and also own values for health status. These are monitored by SBA and can triggert a notification.

erikpetzold avatar Apr 01 '22 06:04 erikpetzold

Hi @mfabiani-av,

monitoring metrics is not possible, as we do not poll the metrics and also do not store the values. Only if the page is opened in the browser, then the client is polling the metrics endpoint. The backend is just forwarding the requests and responses, but there is no persistence.

So if you want to have metrics and alerting think about using prometheus or kibana or something similar with a timeseries database.

The proposal with the HealthIndicator is based on the assumption, that the metric change/threshold is indicating a problem (and therefore requires a notification). You can add own HealthIndicators and also own values for health status. These are monitored by SBA and can triggert a notification.

@erikpetzold Thank you for your reply and the great work on SBA. I agree, there are more advanced and specific tools such as Kibana for monitoring metrics (which we already use). SBA is a lot quicker and easier to deploy though, especially for minor projects. I understand your clarification on the use of IHealthIndicator, I will keep it in mind.

mfabiani-av avatar Apr 01 '22 08:04 mfabiani-av

Closing this issue due to inactivity as well as "not going to happen" :)

SteKoe avatar Jul 08 '22 06:07 SteKoe