Reputation: 11
Spring Boot Admin provides notification feature only for status up or down of the application. I want to send email notification for some metric change in actuator endpoint. could you please guide me how can I configure this?
Simple notification for UP/DOWN of the application
@Configuration
public class NotifierConfiguration {
@Autowired
private Notifier notifier;
@Primary
@Bean(initMethod = "start", destroyMethod = "stop")
public RemindingNotifier remindingNotifier() {
RemindingNotifier notifier = new RemindingNotifier(notifier, repository);
notifier.setReminderPeriod(Duration.ofMinutes(10));
notifier.setCheckReminderInverval(Duration.ofSeconds(10));
return notifier;
}
}
This is for the UP?DOWN of the application. I want to configure in some metric of the actuator endpoint
Upvotes: 1
Views: 2172
Reputation: 426
I don't think there's an easy way to do that at the moment.
Notifications are sent by classes implementing the Notifier interface. These classes are consuming a Flux of InstanceEvent to produce these notifications. These events are triggered when there are changes on an instance info/status actuator endpoint, when an instance is registered/unregistered, etc. To create notifications for actuator metrics, you should therefore create a custom InstanceEvent (say InstanceMetricsChangedEvent) each time there's some changes on an instance metrics actuator endpoint. Maybe you can have a look at how InstanceInfoChangedEvent are triggered and see if it's possible to do something similar with your InstanceMetricsChangedEvent. Have a look at : InfoUpdater and InfoUpdateTrigger.
Upvotes: 2