Search code examples
spring-boot-admin

Spring boot Admin Slack notification


Migrated our stack to Spring Boot 2.0.3 and switched our spring boot admin. Everything is working, microservices are registering (hats off codecentric)

Only issue is that we are not getting any slack notification when services are down or up, what is different from earlier versions (which was working fine) we are using same config as before:

spring.boot.admin.notify.slack.enabled=true
spring.boot.admin.notify.slack.username=Spring Boot Admin Service
spring.boot.admin.notify.slack.message=*#{application.name}* (# 
{application.id}) is *#{to.status}*
spring.boot.admin.notify.slack.icon=:bender:

and the web hook url in yaml file

spring:
  profiles: production
  boot:
    admin:
      notify:
         slack:
          webhook-url: xxx

Any help appreciated


Solution

  • Was struggling with this same issue when I spotted this question, we recently moved from Spring Boot Admin 1.5.4 up to 2.0.2 with a similar version bump for Spring Boot (1.5.9 -> 2.0.4) and I'd recently noticed that slack notifications had stopped working.

    Checking our Spring Boot Admin server logs I could the following exception was thrown when a monitored client went offline : "SpelEvaluationException: EL1008E: Property or field 'application' cannot be found" so it seems that the syntax for the slack message had changed.

    Was just about to post in the codecentric mailing list when I decided to double check the docs for 2.0.4 Slack notifications and voila the syntax for spring.boot.admin.notify.slack.message had changed from

    "#{application.name} (#{application.id}) is #{to.status}"

    to

    "#{instance.registration.name} (#{instance.id}) is #{event.statusInfo.status}"

    TLDR: RTFM