Unable to access Spring Boot Actuator “/actuator” endpoint

非 Y 不嫁゛ 提交于 2019-12-03 05:44:09

问题


I am able to access endpoints like http://localhost:8081/health, /status, /env, /metrics, /shutdown but not /actuator or /loginfo endpoints.

Getting below exception.

{"timestamp":1455929182552,"status":404,"error":"Not Found","message":"No message available","path":"/actuator"}

How to acccess http://localhost:8081/actuator endpoint?


回答1:


As of spring boot version 2.0.1 using below property would work

management.endpoints.web.exposure.include=<comma separated endpoints you wish to expose>

You can use * wildcard to expose all actuator endpoints over the web if security isn't your concern.

Also endpoints seems to have moved from previous versions. For ex. if you wish to use beans, you would now have /actuator/beans endpoint.

Just to be sure look at startup logs for such endpoints.

More on endpoints can be found here




回答2:


I got a pretty descriptive message

2017-11-09 23:27:14.572  INFO 30483 --- [nio-8080-exec-2] s.b.a.e.m.MvcEndpointSecurityInterceptor : Full authentication is required to access actuator endpoints. Consider adding Spring Security or set 'management.security.enabled' to false.

So I put the property in the applicaiton.properties

management.security.enabled=false 

And it will worked




回答3:


If you type http://localhost:8080/actuator/ yo'll get the list of endpoints that has been exposed by default (3 endpoint) so in order to expose all your endpoint what you have to add in your application.properties/yml file:

management.endpoints.web.exposure.include=*



回答4:


as of springboot 2.0.5.RELEASE the health check endpoint is http://hostname:portnumber/applicationroot/actuator/health

also check if you have added the dependency

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>



回答5:


Actuator endpoints moved in Spring Boot 2.0.0, so you need to check /application/health.

Gradle:

compile('org.springframework.boot:spring-boot-starter-actuator')
springBootVersion = '2.0.0.M3'*

Edit the build.gradle file and change the Boot version to 1.5.4.RELEASE. Run the app.

curl -i localhost:8080/health

HTTP/1.1 200
X-Application-Context: application
Content-Type: application/vnd.spring-boot.actuator.v1+json;charset=UTF-8
Transfer-Encoding: chunked
Date: Wed, 14 Jun 2017 20:45:51 GMT

{"status":"UP"}



回答6:


check https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-2.0-Migration-Guide#base-path

change the application.properties fle for this would allow you use http://localhost:8080/beans (or /health , /env )

server.port=8080
management.endpoints.web.base-path=/
management.endpoints.web.exposure.include=*



回答7:


Make sure that those 'sensitive' endpoints are enabled. This doc describes how to enable all sensitive endpoints or individual ones. It sounds like you have certain sensitive endpoints enabled (like shutdown) but not others (like actuator).

To enable all sensitive endpoints:

endpoints.sensitive=true

To enable actuator and logfile individually:

endpoints.actuator.enabled=true
endpoints.logfile.enabled=true



回答8:


It looks like you mapped your Actuator endpoints to the base path /. Check if you have the following line in your configuration:

management.endpoints.web.base-path=/

So, if you omit this line, then you will access all endpoints under actuator path, e.g.:

http://localhost:8081/actuator/health

and the actuator itself will become accessible here:

http://localhost:8081/actuator



回答9:


For spring boot 2.x.x please add below property value in application.property file.

management.endpoint.health.show-details=ALWAYS
management.endpoints.web.exposure.include=*
management.endpoint.beans.enabled=true

Access below url from your local system[either browser or postman] from where you are running a application.

http://localhost:8080/actuator/metrics
http://localhost:8080/actuator/health
http://localhost:8080/actuator/beans



回答10:


I had the same issue.

  1. Check in your console for errors like "invalid LOC header (bad signature)". Do 'mvn spring-boot:run' to get logs.
    My sprint-boot-starter-actuator was corrupted !

  2. In my case the actuators url are

    • http://localhost:8080/actuators/metrics
    • http://localhost:8080/actuators/autoconfig
    • etc.

Hope it helps




回答11:


I guess there is no endpoint named /loginfo according to the docs

for /actuator endpoint, please see answer on the similar question




回答12:


spring boot 1.5.6

actuator Provides a hypermedia-based “discovery page” for the other endpoints. Requires Spring HATEOAS to be on the classpath.

please see: https://docs.spring.io/spring-boot/docs/1.5.6.RELEASE/reference/html/production-ready-endpoints.html




回答13:


health check endpoint as of Spring Boot 2.1.5.RELEASE

http://localhost:8080/actuator/health

check if you have added the dependency

 <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-actuator</artifactId>
 </dependency>

check if you have added the application.properties

management.endpoints.web.exposure.include = *




回答14:


Base on @Vinod's answer, I add application.yml content.
For spring boot 2.1.0 please add below property value in application.yml file.

management:
  endpoints:
    web:
      exposure:
        include: '*'
  endpoint:
    health:
      show-details: always
    beans:
      enabled: true

Access below url from your local system[either browser or postman] from where you are running a application.

http://localhost:8080/actuator/metrics
http://localhost:8080/actuator/health
http://localhost:8080/actuator/beans

More endpoint, see the link:
Part V. Spring Boot Actuator: Production-ready features



来源:https://stackoverflow.com/questions/35517713/unable-to-access-spring-boot-actuator-actuator-endpoint

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!