Spring boot Admin Slack notification - spring-boot-admin

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

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

Related

Can a Spring Cloud Gateway App be Enabled as a Cloud Config Server?

I'm trying to enable a Spring Cloud Gateway app to automatically refresh its routing config yml on the fly. I have been able to set up a Cloud Config server to host the route YAML and enabled the Spring Cloud Gateway to automatically refresh its config via a #Scheduled contextRefresher.refresh() usage. However, this requires two running apps, and we want to try to minimize the number of additional servers needed to support this requirement.
The Spring Cloud Config Server documentation suggests any boot app can be embedded with a config server via the #EnableConfigServer annotation: https://cloud.spring.io/spring-cloud-static/spring-cloud.html#_spring_cloud_config_server
However, when attempting to introduce the spring-cloud-config-server module in my Gateway's build.gradle, I run into the following error on startup:
org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.springframework.http.codec.ServerCodecConfigurer' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
From the discussion here (https://github.com/spring-cloud/spring-cloud-gateway/issues/319) it seems that the issue above arises because spring-boot-starter-web is incompatible w/ Gateway; Gateway is a Netty app and spring-boot-starter-web uses tomcat/servlets. When trying to exclude spring-boot-starter-web from the cloud-config-server module, the app fails again w/:
onfigReactiveWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanDefinitionStoreException: Failed to process import candidates for configuration class [org.springframework.cloud.config.server.config.ConfigServerAutoConfiguration]; nested exception is java.io.FileNotFoundException: class path resource [org/springframework/web/servlet/config/annotation/WebMvcConfigurerAdapter.class] cannot be opened because it does not exist
Is it the case that a Spring Cloud Gateway app cannot be enabled as a CloudConfig server? Or am I missing something.
FWIW my sprincCloudVersion is Finchley.SR1
They can not. Config server is based on spring MVC (servlets), gateway is based on spring webflux and Netty. They are not compatible and cannot be run together.

WildFly-10 - APIMAN Publish Issue

I have wildfly 10 and installed APIMAN 1.5.1.APIMAN. Organization/API creation is done and while publishing the API, I'm getting below error
io.apiman.manager.api.rest.contract.exceptions.ActionException: Failed to publish API.
I too had this issue, in my case problem was with the ElasticSearch.
apiman.es.host defined in standalone/configuration/apiman.properties was not working.
Check host and port that are mentioned are open/working.

Eureka Server Health Not Running

I updated a eureka server from Camdem.R3 to Flinchley.RC1 lately. There were a lot of changes in the settings.
On Camden.R3, without doing any additional settings the console link to the health check would work. For Flinchley.RC1 the health check would give a 404 response. I am trying to read the latest settings in Flinchley document but it only states how to check the health. Is there a way to find out if the client really ran the health check context?
After several research, I found out that the spring boot actuator specs was changed for 2.0. For Camden.R3 which is compatible with spring boot 1.X, all actuators starts in the base context. While Flinchley.RC1 which is compatible with spring boot 2.0 all context requires a context prefix of "/actuator".
Spring Boot 1.X actuator:
All of the actuator endpoints "sub sites" are turned on by default.
Health actuator would give a more detailed information in its
response
The actuator starts on base context of Eureka Client Site (e.g. localhost:8080/health)
Spring Boot 2.0 actuator:
Only the health and info are turned on by default.
Health actuator would give a simple answer of UP / DOWN. To show others you need to set them in configuration.
All actuator must have the endpoint prefix in URL. The default prefix
is "actuator" (e.g. http://localhost:8080/actuator/health)
See the following sites for more details:
Spring Boot Actuator (very detailed explanation)
Spring Boot Actuator 1.X Official Document
Spring Boot Actuator 2.0 Official Document

Javamelody with alfresco

I installed javamelody on alfresco-tomcat, I used 2-tier architecture (APP and BDD), but when I run my http: // localhost: 8080 / share / monitoring server, it gives me false information , Javamelody counts the users logged in as soon as there is a request for authentication page and no dashboard, which gives me no real data.
Cordially.
If you have a recent version of Alfresco, you could install the related plugin:
https://github.com/javamelody/alfresco-javamelody/releases
You can get more accurate information looking at your mbeans via jmx or via javamelody. The number of ticket issues can be found under:
mbeans > Alfresco > RepoServerMgmt > TicketCountAll and TicketCountNonExpired

Connect HermesJMS to Wildfly 8.2

we recently changed our Application Server from Glassfish to Wildfly. With Glassfish we used QBrowser to monitor our JMS Queues, sadly that tool does not work with Wildfly.
After a quick search I found the Tool HermesJMS. Although there are lots of guides how to set up a connection to a JMS queue with it I couldn´t find anything directly for the JBoss Wildfly application server. After lots of reading through different guides I think I can now connect to the wildfly server but I just can´t connect to my jms queues.
First I tried to connect via JNDI InitialContext. Here´s my settings for it:
initialContextFactory: org.jboss.naming.remote.client.InitialContextFactory
providerURL: http-remoting://localhost:
urlPkgPrefixes: org.jboss.naming.remote.client
securityPrincipal: admin
securityCredentials: admin
It does connect but all I see are my deployed web applications and a "jms" folder. But they all contain the same web-applications again plus the jms folder and appear as a red circle with a white X in it.
So next I tried to set up a session manually via "Create new JMS Session" with following preferences:
Session: HornetQ
Plugin: HornetQ
Properties:
binding: jms/RemoteConnectionFactory
initialContextFactory: initialContextFactory: org.jboss.naming.remote.client.InitialContextFactory
providerURL: http-remoting://localhost:
urlPkgPrefixes: org.jboss.naming.remote.client
User: guest Password: pass
The guest user is an user I created in Wildfly as an application user
When I then double click on one of the queues it says that there is no such queue.
javax.jms.JMSException: There is no queue with name java:jboss/jms/queue/ngsEmailProvRequestQueue
at org.hornetq.jms.client.HornetQSession.createQueue(HornetQSession.java:397)
at hermes.impl.jms.SimpleDestinationManager.createDesintaion(SimpleDestinationManager.java:60)
at hermes.impl.JNDIDestinationManager.createDesintaion(JNDIDestinationManager.java:105)
at hermes.impl.jms.SimpleDestinationManager.getDestination(SimpleDestinationManager.java:137)
at hermes.impl.jms.AbstractSessionManager.getDestination(AbstractSessionManager.java:387)
at hermes.impl.DefaultHermesImpl.getDestination(DefaultHermesImpl.java:323)
at hermes.browser.tasks.BrowseDestinationTask.invoke(BrowseDestinationTask.java:122)
at hermes.browser.tasks.TaskSupport.run(TaskSupport.java:175)
at hermes.browser.tasks.ThreadPool.run(ThreadPool.java:170)
at java.lang.Thread.run(Thread.java:745)
Does anybody know what I´m missing? Is it even possible to get HermesJms to work with Wildfly? Of if not is there an alternative monitoring tool for JMS queues?
Thank you for your help.
To work with Wildfly, follow this doc: https://developer.jboss.org/wiki/UsingHermesJMSWithHornetQ
Second part: Configuring HermesJMS for JBoss7 / EAP6 with HornetQ
And change those values:
binding=jms/RemoteConnectionFactory
initialContextFactory=org.jboss.naming.remote.client.InitialContextFactory
providerURL=http-remoting://localhost:8080
urlPkgPrefixes=org.jboss.naming.remote.client
In the destinations, change also:
Name: sample
Domain: QUEUE
Maybe you could have a look at JMSToolbox on sourceforge: https://sourceforge.net/projects/jmstoolbox/?source=directory
i recently revisited this as the team is moving from glassfish (yaye...) to wildfly. I tried with wildfly9 and it works.
I think it is a matter of exporting your queue name. see below
java:/jms/queue/test does not work
java:jboss/exported/jms/queue/test works
Note: wildfly9.2 is the final version that has hornetq. wildfly 10++ supports artemis instead.