功能
上报节点的各种信息(依赖、JVM、等等)
pom依赖
eureka的server端,自带健康监控
<!--- eureka-server 自带健康监控 -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
</dependency>
<!-- 健康监控 -->
<!-- <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>-->
eureka的provider、consumer端,不带健康监控
<!--- eureka-client 不带 健康监控 -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
<!-- 健康监控 上报节点信息 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
访问
- http://localhost:6002/actuator
{
"_links": {
"self": {
"href": "http://localhost:6002/actuator",
"templated": false
},
"health": {
"href": "http://localhost:6002/actuator/health",
"templated": false
},
"health-path": {
"href": "http://localhost:6002/actuator/health/{*path}",
"templated": true
},
"info": {
"href": "http://localhost:6002/actuator/info",
"templated": false
}
}
}
开启更多的actuator功能
management:
endpoints:
web:
exposure:
include: '*' # 抓取所有信息
endpoint:
shutdown:
enabled: true #可以远程关闭节点服务(通过actuator,只支持post请求 shutDown方法)
{
"_links": {
"self": {
"href": "http://localhost:6002/actuator",
"templated": false
},
"archaius": {
"href": "http://localhost:6002/actuator/archaius",
"templated": false
},
"beans": {
"href": "http://localhost:6002/actuator/beans",
"templated": false
},
"caches-cache": {
"href": "http://localhost:6002/actuator/caches/{cache}",
"templated": true
},
"caches": {
"href": "http://localhost:6002/actuator/caches",
"templated": false
},
"health": {
"href": "http://localhost:6002/actuator/health",
"templated": false
},
"health-path": {
"href": "http://localhost:6002/actuator/health/{*path}",
"templated": true
},
"info": {
"href": "http://localhost:6002/actuator/info",
"templated": false
},
"conditions": {
"href": "http://localhost:6002/actuator/conditions",
"templated": false
},
"shutdown": {
"href": "http://localhost:6002/actuator/shutdown",
"templated": false
},
"configprops": {
"href": "http://localhost:6002/actuator/configprops",
"templated": false
},
"env": {
"href": "http://localhost:6002/actuator/env",
"templated": false
},
"env-toMatch": {
"href": "http://localhost:6002/actuator/env/{toMatch}",
"templated": true
},
"loggers": {
"href": "http://localhost:6002/actuator/loggers",
"templated": false
},
"loggers-name": {
"href": "http://localhost:6002/actuator/loggers/{name}",
"templated": true
},
"heapdump": {
"href": "http://localhost:6002/actuator/heapdump",
"templated": false
},
"threaddump": {
"href": "http://localhost:6002/actuator/threaddump",
"templated": false
},
"metrics": {
"href": "http://localhost:6002/actuator/metrics",
"templated": false
},
"metrics-requiredMetricName": {
"href": "http://localhost:6002/actuator/metrics/{requiredMetricName}",
"templated": true
},
"scheduledtasks": {
"href": "http://localhost:6002/actuator/scheduledtasks",
"templated": false
},
"mappings": {
"href": "http://localhost:6002/actuator/mappings",
"templated": false
},
"refresh": {
"href": "http://localhost:6002/actuator/refresh",
"templated": false
},
"features": {
"href": "http://localhost:6002/actuator/features",
"templated": false
},
"service-registry": {
"href": "http://localhost:6002/actuator/service-registry",
"templated": false
}
}
}
主动关闭服务
http://localhost:6002/actuator/shutdown
备注:不是节点down,而是真正的关闭服务(关闭tomcat),不能远程start
运维可以使用(不能让其他人随便调用,要做权限)
查看节点信息
查看可带参数
http://localhost:6002/actuator/metrics
{
"names": [
"jvm.memory.max",
"jvm.threads.states",
"jvm.gc.memory.promoted",
"jvm.memory.used",
"jvm.gc.max.data.size",
"jvm.gc.pause",
"jvm.memory.committed",
"system.cpu.count",
"logback.events",
"jvm.buffer.memory.used",
"tomcat.sessions.created",
"jvm.threads.daemon",
"system.cpu.usage",
"jvm.gc.memory.allocated",
"tomcat.sessions.expired",
"jvm.threads.live",
"jvm.threads.peak",
"process.uptime",
"tomcat.sessions.rejected",
"process.cpu.usage",
"jvm.classes.loaded",
"jvm.classes.unloaded",
"tomcat.sessions.active.current",
"tomcat.sessions.alive.max",
"jvm.gc.live.data.size",
"jvm.buffer.count",
"jvm.buffer.total.capacity",
"tomcat.sessions.active.max",
"process.start.time"
]
}
-
查看jvm信息
http://localhost:6002/actuator/metrics/jvm.memory.max