1.下载go(version>1.9,否则promtool工具不好使)
https://golang.org/doc/install?download=go1.10.2.linux-amd64.tar.gz
tar -C /usr/local -xzf go1.10.2.linux-amd64.tar.gz
export PATH=$PATH:/usr/local/go/bin
2.yuml install -y git
3.下载安装promtool
go get github.com/prometheus/prometheus/cmd/promtool
设置环境变量:
export PATH=$PATH:/root/go/bin
4.校验rules文件
promtool check rules test.rules
5.更新rules文件为yaml文件
promtool update rules test.rules
结果生成 test.rules.yml文件