Reputation: 319
Can we have a sample of variables available for redefinition of templates, documentation is scarce on this?
In Class package de.codecentric.boot.admin.notify.MailNotifier I read
private static final String DEFAULT_SUBJECT = "#{application.name} (#{application.id}) is #{to.status}";
private static final String DEFAULT_TEXT = "#{application.name} (#{application.id})\nstatus changed from #{from.status} to #{to.status}\n\n#{application.healthUrl}";
In my specific use case I inherited a bunch of applications which I want to ping or monitor they are alive. I have no control on them but my app depends on them.
My app doesn't fail but may misbehave (important point!).
So I added a bunch of customs HealthIndicator to get them monitored by ping, that work perfectly, and I was very pleased by changing an IP a notification was sent, great!
But there is a but, the message sent let me think than the app was failing, while instead the health indicator was status OUT_OF_SERVICE, unnecessary stress for DevOps.
Come to my question, how can I add some extra variables whereby some carefully crafted SPEL will distinguish an Health indicator message status change than an application status change ie webapp going offline.
Is a dictionary of SBA keywords available to use for redefining for example spring.boot.admin.notify.mail.text
Mail notifications configuration option?
I guess this is valid to other notifiers being hipchat, Slack.
Thank you.
Upvotes: 0
Views: 1452
Reputation: 319
Answer is no, cannot do in current code base without code changes. SBA notification keywords/variables available are the following:
We don't have anything else.
However the StatusUpdater.queryStatus
looks promising to get some extra data.
Upvotes: 1
Reputation: 2687
The context for evaluating the SpEL expression is the event.
Therefore all properties from ClientApplicationEvent
(or the corresponding subclass for the event instance (e.g. ClientApplicationStatusChangedEvent
)) are available.
If it doesn't suffice you can ship your own subclass of the MailNotifier..
Upvotes: 2