这次分享使用Metrics.net + influxdb + grafana 构建项目自动化监控和预警方案。通过执行耗时,定位哪些接口拖累了服务的性能;通过请求频次,设置适当的限流和熔断机制,拦截非法或不合理的请求,保障服务的可用性。本次内容较多,部分详细内容将使用链接方式提供。
动手前,需下准备以下工具:
1、influxdb 下载地址: https://portal.influxdata.com/downloads/#influxdb
2、chronograf 下载地址: https://portal.influxdata.com/downloads/#chronograf
3、grafana 下载地址: https://grafana.com/get
正式开始:
1、安装influxdb,
以window环境为例, 下载解压后文件
打开influxdb.conf,修改配置,
[meta]
# Where the metadata/raft database is stored
dir = "E:/influxdb/meta"
[data]
# The directory where the TSM storage engine stores TSM files.
dir = "E:/influxdb/data"
# The directory where the TSM storage engine stores WAL files.
wal-dir = "E:/influxdb/wal"
网上有人是需要对[admin]修改,这个因为版本不同,没有[admin],所有对其不做修改。
最后cmd运行,进入到你的解压目录,执行命令:
influxd -config influxdb.conf
为了方便,我一般写个bat文件, 内容
"E:\influxd