45

我可以访问端点,如, http://localhost:8081/health, /status, /env/metrics/shutdown 不能访问 端点。/actuator/loginfo

低于异常。

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

如何访问http://localhost:8081/actuator端点?

4

20 回答 20

49

从 Spring Boot 版本 2.0.1 开始,使用以下属性将起作用

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

如果您不关心安全性,您可以使用*通配符在 Web 上公开所有执行器端点。

端点似乎也已从以前的版本中移出。例如。如果您想使用 bean,您现在将拥有/actuator/beans端点。

只是为了确保查看此类端点的启动日志。

更多关于端点的信息可以在这里找到

于 2018-04-19T05:25:06.547 回答
19

如果您键入http://localhost:8080/actuator/ yo 将获得默认情况下已公开的端点列表(3 个端点),因此为了公开您的所有端点,您必须在application.properties/yml文件中添加:

management.endpoints.web.exposure.include=*
于 2018-12-09T11:02:04.537 回答
11

看起来您将Actuator端点映射到基本路径/。检查您的配置中是否有以下行:

management.endpoints.web.base-path=/

因此,如果您省略这一行,那么您将访问actuator路径下的所有端点,例如:

http://localhost:8081/actuator/health

并且执行器本身将可以在此处访问:

http://localhost:8081/actuator
于 2019-07-02T08:29:23.180 回答
8

我面临同样的问题,花了几个小时后,可以解决。首先我们需要将下面的属性设置为 *

management.endpoints.web.exposure.include=*
management.endpoints.enabled-by-default=false

我们需要提供以下属性端口,而不是 URL 中的 server.port。

management.server.port=9000

例子:

http://localhost:9000/actuator/loggers/{package}
http://localhost:9000/actuator/health

这是在带有 Spring Boot 2.1.13 的微服务中尝试的,具有以下属性并且工作正常。

management.endpoints.web.exposure.include=*
management.endpoint.loggers.enabled=true
management.endpoint.restart.enabled=true
management.endpoint.refresh.enabled=true
management.endpoint.health.enabled=true
management.security.enabled=false
management.health.db.enabled=true
management.health.diskspace.enabled=true
于 2020-06-04T08:36:29.700 回答
7

截至springboot 2.0.5.RELEASE 健康检查端点是http://hostname:portnumber/applicationroot/actuator/health

还要检查您是否添加了依赖项

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>
于 2018-10-08T16:09:11.863 回答
5

执行器端点在 Spring Boot 2.0.0 中移动,因此您需要检查/application/health.

摇篮:

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

编辑 build.gradle 文件并将 Boot 版本更改为 1.5.4.RELEASE。运行应用程序。

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"}
于 2017-09-12T16:24:39.637 回答
5

我收到了一条描述性很强的消息

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.

所以我把属性放在 applicaiton.properties

management.security.enabled=false 

它会起作用的。

更新management.security.enabled现在在 spring boot 2 中已弃用,感谢@Abdelghani Roussi

于 2017-11-09T21:28:29.440 回答
3
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
于 2019-04-23T08:25:56.920 回答
3

基于@Vinod 的回答,我添加了 application.yml 内容。
对于 spring boot 2.1.0,请在 application.yml 文件中添加以下属性值。

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

从您正在运行应用程序的本地系统[浏览器或邮递员]访问以下 url。

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

更多端点,请参见链接:
第五部分。Spring Boot Actuator:生产就绪功能

于 2019-08-04T23:49:10.127 回答
3

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

为此更改 application.properties 文件将允许您使用 http://localhost:8080/beans(或 /health , /env )

server.port=8080
management.endpoints.web.base-path=/
management.endpoints.web.exposure.include=*
于 2019-01-15T13:59:01.467 回答
2

从 Spring Boot 2.1.5.RELEASE 开始的健康检查端点

http://localhost:8080/actuator/health

检查是否添加了依赖项

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

检查您是否添加了application.properties

management.endpoints.web.exposure.include = *

于 2019-06-19T07:37:13.410 回答
2

确保启用了那些“敏感”端点。该文档描述了如何启用所有敏感端点或单个端点。听起来您启用了某些敏感端点(例如关闭),但没有启用其他端点(例如执行器)。

要启用所有敏感端点:

endpoints.sensitive=true

要单独启用执行器和日志文件:

endpoints.actuator.enabled=true
endpoints.logfile.enabled=true
于 2016-02-20T19:05:53.680 回答
1

首先,您应该确保您的 pom.xml 中有以下依赖项

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

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

然后你应该在你的 application.yml 中有以下配置

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

您可以使用 application.yml 中的以下配置自定义 info enpoit 中的信息

info:
    app:
        name: @project.name@
        description: @project.description@
        version: @project.version@
        encoding: @project.build.sourceEncoding@
        java:
            version: @java.version@

之后,您可以转到 url localhost:8080并查看端点列表,如下所示:

在此处输入图像描述

希望这个答案可以帮助某人

于 2020-09-19T13:31:19.333 回答
1

我总是更喜欢使用应用程序的基本 URL 提供上下文路径。现在要配置执行器,我们应该在 pom.xml 中包含以下依赖项

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

让它使用 Spring Boot 版本所承载的默认版本。将以下属性放入您的 application.properties

server.servlet.contextPath=/<app-name>
server.port=8080

management.endpoint.metrics.enabled=true
management.endpoints.web.exposure.include=*
management.endpoint.prometheus.enabled=true
management.metrics.export.prometheus.enabled=true
management.security.enabled=false
management.health.mongo.enabled=false
management.health.redis.enabled=false
management.health.rabbit.enabled=false
management.endpoint.health.show-details=always

#/metrics endpoint configuration
endpoints.metrics.id=metrics
endpoints.metrics.sensitive=false
endpoints.metrics.enabled=true

#/health endpoint configuration (Comment when you are using customized health check)
endpoints.health.id=health
endpoints.health.sensitive=false
endpoints.health.enabled=true

info.app.name=@project.name@
info.app.description=@project.description@
info.app.version=@project.version@
info.app.encoding=@project.build.sourceEncoding@
info.app.java.version=@java.version@

在启动服务器后进行上述配置后,您可以轻松检查以下 http 调用的指标-

 # curl http://localhost:8080/myapp/actuator/metrics
 {
  "names": ["jvm.buffer.memory.used", "jvm.gc.memory.allocated", 
  "jvm.memory.committed", "jvm.memory.used", "http.server.requests", 
  "jvm.gc.max.data.size", "logback.events", "system.cpu.count", 
  "jvm.memory.max", "jvm.buffer.total.capacity", "jvm.buffer.count", 
  "process.files.max", "jvm.threads.daemon", "process.start.time", 
  "jvm.gc.live.data.size", "process.files.open", "process.cpu.usage", 
  "process.uptime", "system.load.average.1m", "jvm.gc.pause", 
  "system.cpu.usage", "jvm.threads.live", "jvm.classes.loaded", 
  "jvm.classes.unloaded", "jvm.threads.peak", "jvm.gc.memory.promoted"]
}

有关详细信息,您可以在此处观看我的博客

于 2020-05-06T11:40:38.040 回答
1

弹簧靴1.5.6

执行器为其他端点提供基于超媒体的“发现页面”。要求 Spring HATEOAS 在类路径上。

请参阅:https ://docs.spring.io/spring-boot/docs/1.5.6.RELEASE/reference/html/production-ready-endpoints.html

于 2018-08-24T07:40:07.730 回答
1

我遇到了http://localhost:8080/actuator/的显示问题,并通过添加 hal-explorer 依赖项得到了解决。请确保您的 pom.xml 中有以下 2 个依赖项,以显示执行器的正确内容。

        <dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-rest-hal-explorer</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>

还要检查 application.properties 中的以下属性

management.endpoints.web.exposure.include=*
#management.endpoints.enabled-by-default=false
#management.endpoints.web.base-path=/
于 2021-05-21T08:31:08.497 回答
0

我遇到过同样的问题。

  1. 检查控制台中的错误,例如“无效的 LOC 标头(错误的签名)”。执行 'mvn spring-boot:run' 来获取日志。
    我的 sprint-boot-starter-actuator 已损坏!

  2. 在我的情况下,执行器 url 是

希望能帮助到你

于 2017-02-15T20:07:36.863 回答
0

这是将application.yml基本路径更改为 / 和禁用 /info 的文件。

management:
  endpoints:
    web:
      base-path: /
  endpoint:
    #Disable /info
    info:
      enabled: false
    health:
      show-details: always
  health:
      defaults:
        enabled: false
于 2020-04-24T14:55:49.327 回答
0

你可以试试这样的base-path配置

management:
  endpoints:
    web:
      base-path: /actuator
      exposure:
        include: info, health
于 2020-11-08T10:47:33.727 回答
0

我猜根据文档没有名为 /loginfo 的端点

对于 /actuator 端点,请参阅类似问题的答案

于 2017-07-25T08:34:16.673 回答