我可以访问端点,如, 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/health
, /status
, /env
,/metrics
但/shutdown
不能访问 端点。/actuator
/loginfo
低于异常。
{"timestamp":1455929182552,"status":404,"error":"Not Found","message":"No message available","path":"/actuator"}
从 Spring Boot 版本 2.0.1 开始,使用以下属性将起作用
management.endpoints.web.exposure.include=<comma separated endpoints you wish to expose>
如果您不关心安全性,您可以使用*
通配符在 Web 上公开所有执行器端点。
端点似乎也已从以前的版本中移出。例如。如果您想使用 bean,您现在将拥有/actuator/beans
端点。
只是为了确保查看此类端点的启动日志。
更多关于端点的信息可以在这里找到
如果您键入http://localhost:8080/actuator/
yo 将获得默认情况下已公开的端点列表(3 个端点),因此为了公开您的所有端点,您必须在application.properties/yml
文件中添加:
management.endpoints.web.exposure.include=*
看起来您将Actuator
端点映射到基本路径/
。检查您的配置中是否有以下行:
management.endpoints.web.base-path=/
因此,如果您省略这一行,那么您将访问actuator
路径下的所有端点,例如:
http://localhost:8081/actuator/health
并且执行器本身将可以在此处访问:
http://localhost:8081/actuator
我面临同样的问题,花了几个小时后,可以解决。首先我们需要将下面的属性设置为 *
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
截至springboot 2.0.5.RELEASE
健康检查端点是http://hostname:portnumber/applicationroot/actuator/health
还要检查您是否添加了依赖项
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
执行器端点在 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-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
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
基于@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:生产就绪功能
检查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=*
从 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 = *
确保启用了那些“敏感”端点。该文档描述了如何启用所有敏感端点或单个端点。听起来您启用了某些敏感端点(例如关闭),但没有启用其他端点(例如执行器)。
要启用所有敏感端点:
endpoints.sensitive=true
要单独启用执行器和日志文件:
endpoints.actuator.enabled=true
endpoints.logfile.enabled=true
首先,您应该确保您的 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并查看端点列表,如下所示:
希望这个答案可以帮助某人
我总是更喜欢使用应用程序的基本 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"]
}
有关详细信息,您可以在此处观看我的博客
弹簧靴1.5.6
执行器为其他端点提供基于超媒体的“发现页面”。要求 Spring HATEOAS 在类路径上。
我遇到了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=/
我遇到过同样的问题。
检查控制台中的错误,例如“无效的 LOC 标头(错误的签名)”。执行 'mvn spring-boot:run' 来获取日志。
我的 sprint-boot-starter-actuator 已损坏!
在我的情况下,执行器 url 是
希望能帮助到你
这是将application.yml
基本路径更改为 / 和禁用 /info 的文件。
management:
endpoints:
web:
base-path: /
endpoint:
#Disable /info
info:
enabled: false
health:
show-details: always
health:
defaults:
enabled: false
你可以试试这样的base-path
配置
management:
endpoints:
web:
base-path: /actuator
exposure:
include: info, health