Grafana是一个开源的度量分析和可视化工具,可以通过将采集的数据分析、查询,然后进行可视化的展示,并能实现报警。
1.使用grafana连接prometheus
选择需要的版本下载
https://grafana.com/grafana/download/5.4.3?edition=oss
systemctl start grafana-server
systemctl enable grafana-server
netstat -ntulp | grep 3000
2.浏览器访问http://ip:3000
使用默认的账户admin密码admin
3.添加数据源
把prometheus收集到的数据作为数据源添加到grafana
4.为数据源添加图形显示
填入CPU使用率的promQL语句,稍等一会就能看到图表有数据
100 - avg(irate(node_cpu_seconds_total{mode="idle"}[5m])) by(instance)*100
下图中右边可查看时间范围
5.导入官方仪表盘
在线导入
高科技画面登场
也可采用离线下载文件的方式导入
参考文档:https://blog.csdn.net/heian_99/article/details/103956931和https://blog.csdn.net/anqixiang/