springboot2.x下actuator模块
一、简介
spring-boot-starter-actuator模块是一个spring提供的监控模块。我们在开运行发过程中,需要实时和定时监控服务的各项状态和可用性。Spring Boot的spring-boot-starter-actuator 模块(健康监控)功能提供了很多监控所需的接口,可以对应用系统进行配置查看、相关功能统计等。
二、实现
在maven的pom中引入:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
如果使用HTTP调用的方式,还需要这个依赖:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
spring:
application:
name: spring-cloud-consul-consumer
server:
port: management:
server:
port: 54001 #如果不配置,默认与服务端口一致
health:
db:
enabled: true
mail:
enabled: true
endpoint:
env:
enabled: true
endpoints:
web:
exposure:
include: "*"
访问:http://localhost:54001/health 这是springboot1.x的访问
springboot2.x 后 http://localhost:54001/actuator/health
结果:

2、info:配置
info:
app:
name: "@project.name@" #从pom.xml中获取
description: "@project.description@"
version: "@project.version@"
spring-boot-version: "@project.parent.version@"
访问:http://localhost:54001/actuator/info
{"app":{"name":"demo","description":"Demo project for Spring Boot","version":"0.0.1-SNAPSHOT","spring-boot-version":"2.1.0.RELEASE"}}
更多端点访问,可以访问:http://localhost:54001/actuator查看。
{"_links":{"self":{"href":"http://localhost:54001/actuator","templated":false},
"archaius":{"href":"http://localhost:54001/actuator/archaius","templated":false},
"auditevents":{"href":"http://localhost:54001/actuator/auditevents","templated":false},
"beans":{"href":"http://localhost:54001/actuator/beans","templated":false},
"caches-cache":{"href":"http://localhost:54001/actuator/caches/{cache}","templated":true},
"caches":{"href":"http://localhost:54001/actuator/caches","templated":false},
"health":{"href":"http://localhost:54001/actuator/health","templated":false},
"health-component":{"href":"http://localhost:54001/actuator/health/{component}","templated":true},
"health-component-instance":{"href":"http://localhost:54001/actuator/health/{component}/{instance}","templated":true},
"conditions":{"href":"http://localhost:54001/actuator/conditions","templated":false},
"configprops":{"href":"http://localhost:54001/actuator/configprops","templated":false},
"env":{"href":"http://localhost:54001/actuator/env","templated":false},
"env-toMatch":{"href":"http://localhost:54001/actuator/env/{toMatch}","templated":true},
"info":{"href":"http://localhost:54001/actuator/info","templated":false},
"loggers":{"href":"http://localhost:54001/actuator/loggers","templated":false},
"loggers-name":{"href":"http://localhost:54001/actuator/loggers/{name}","templated":true},
"heapdump":{"href":"http://localhost:54001/actuator/heapdump","templated":false},
"threaddump":{"href":"http://localhost:54001/actuator/threaddump","templated":false},
"metrics":{"href":"http://localhost:54001/actuator/metrics","templated":false},
"metrics-requiredMetricName":{"href":"http://localhost:54001/actuator/metrics/{requiredMetricName}","templated":true},
"scheduledtasks":{"href":"http://localhost:54001/actuator/scheduledtasks","templated":false},
"httptrace":{"href":"http://localhost:54001/actuator/httptrace","templated":false},
"mappings":{"href":"http://localhost:54001/actuator/mappings","templated":false},
"refresh":{"href":"http://localhost:54001/actuator/refresh","templated":false},
"features":{"href":"http://localhost:54001/actuator/features","templated":false},
"service-registry":{"href":"http://localhost:54001/actuator/service-registry","templated":false},
"consul":{"href":"http://localhost:54001/actuator/consul","templated":false}}}
更多详细内容参考:https://blog.csdn.net/Dreamhai/article/details/81077903
springboot2.x下actuator模块的更多相关文章
- Node.js(window)基础(2)——node环境下的模块,模块间调用
参考:http://www.liaoxuefeng.com/wiki/001434446689867b27157e896e74d51a89c25cc8b43bdb3000/00143450241959 ...
- Linux下PAM模块学习总结
在Linux中执行有些程序时,这些程序在执行前首先要对启动它的用户进行认证,符合一定的要求之后才允许执行,例如login, su等.在Linux中进行身份或是状态的验证程序是由PAM来进行的,PAM( ...
- erlang下lists模块sort(排序)方法源码解析(二)
上接erlang下lists模块sort(排序)方法源码解析(一),到目前为止,list列表已经被分割成N个列表,而且每个列表的元素是有序的(从大到小) 下面我们重点来看看mergel和rmergel ...
- erlang下lists模块sort(排序)方法源码解析(一)
排序算法一直是各种语言最简单也是最复杂的算法,例如十大经典排序算法(动图演示)里面讲的那样 第一次看lists的sort方法的时候,蒙了,几百行的代码,我心想要这么复杂么(因为C语言的冒泡排序我记得不 ...
- python import引入不同路径下的模块
转载 python 包含子目录中的模块方法比较简单,关键是能够在sys.path里面找到通向模块文件的路径. 下面将具体介绍几种常用情况: (1)主程序与模块程序在同一目录下: 如下面程序结构: `- ...
- 转: springboot2.0下hystrix.stream 404
springboot2.0下hystrix dashboard Unable to connect to Command Metric Stream解决办法https://blog.csdn.net/ ...
- 利用python 下paramiko模块无密码登录
利用python 下paramiko模块无密码登录 上次我个大家介绍了利用paramiko这个模块,可以模拟ssh登陆远程服务器,并且可以返回执行的命令结果,这次给大家介绍下如何利用已经建立的密钥 ...
- MSF下ms17_010_psexec模块使用技巧
0x01 前言 MS17-010 的psexec是针对Microsoft Windows的两款最受欢迎的漏洞进行攻击. CVE-2017-0146(EternalChampion / EternalS ...
- Maven环境下多模块项目构建
Maven环境下多模块项目构建 一.新建项目 1.建立我们的父模块par 2.建立我们的子模块dao层 3.建立我们的子模块service层 4.建立我们的子模块web层 5.全部配置完成后,怎么把我 ...
随机推荐
- *【Python】【demo实验27】【练习实例】【定义递归函数】
原题: 原题解答: #!/usr/bin/python # encoding=utf-8 # -*- coding: UTF-8 -*- # 利用递归函数调用方式,将所输入的5个字符,以相反顺序打印出 ...
- Redis(1.6)Redis发布订阅
[0]发布订阅架构图 客户端订阅某个频道,让后有人在频道上发布信息,频道就分发给所有的客户端. 举个例子:就和微信公众号一样,文章作者者把文章发到微信公众号上,微信公众号平台把文章推送到所有的订 ...
- Python接口开发小知识
关于数据库设计 接口开发多学习数据库表操作,这是要点 不存在删除数据,每个可能被删除数据的表加一个is_active属性 不同的表可以有多个相同的字段,字段属性少用禁止非空 不要设置太多主外键(高内聚 ...
- 从入门到自闭之Python--MySQL数据库安装
分类: 关系型数据库:mysql oracle sqlserver sqllite 非关系型数据库:redis mongodb memcache hbase 安装: 网址:https://www.my ...
- Java反射的理解(六)-- 通过反射了解集合泛型的本质
Java反射的理解(六)-- 通过反射了解集合泛型的本质 上述写了那么多,我们可能会有个疑问,为什么要用反射,步骤比我们常规的加载类操作复杂多了,别急,这个问题我最后才解答,我们先来了解集合泛型的本质 ...
- WPF的硬件加速
wpf根据硬件 可以做出三档的渲染 dx7以下 第0档 不支持硬件加速 dx7-dx9 第1档, 不支持所有硬件加速,但支持一部分 dx9 以上 支持所有硬件加速 可以用编程的方式取代 当前设备处于 ...
- 进阶Java编程(6)正则表达式
正则表达式 通过之前一系列的分析可以发现,String是一个非常万能的类型,因为String不仅仅可以支持有各种字符串的处理操作,也支持有向各个数据类型的转换功能,所以在项目的开发之中,只要用户输入的 ...
- Linux下安装Jenkins并且发布.net core
一,基础环境 1,操作系统:CentOS 7.3 2,Docker version 18.09.6 docker安装参考:https://www.cnblogs.com/liuxiaoji/p/110 ...
- Python 风格指南
https://zh-google-styleguide.readthedocs.io/en/latest/google-python-styleguide/contents/ 目前个人遵循的基本规范 ...
- Unity鼠标移动到物体上显示信息
相信大家玩游戏的时候,鼠标移动到游戏装备上,都会显示装备的的具体信息,那么接下来就写代码把,废话不多说. 下面是 效果图 鼠标移动到装备位置显示的信息,鼠标移动不在装备区域后不现实信息,下面是代码 : ...