prometheus 功能强大的监控软件
- prometheus 能够监控各种各样的东西,例如虚拟机,docker容器,kubernates pods,API接口等等
- 能够满足从软件到硬件的全序列监控
- 开源生态丰富,各种插件,各种模板,只要你会百度,不需要掌握原理和框架,就能快速上手
- 搭配 grafana ,不仅采集及时,监控出来的页面也非常好看,对我们不懂前端和UI的人来说,简直是超级强大
如何使用
- 安装 prometheus
- 源码安装
- docker 安装
- 安装 node-exporter,负责收集主机数据(CPU,内存),prometheus 定时拉取
- 解压后可直接运行
- 安装grafana
- docker 安装
- 参数那么多,名字那么复杂,那么该如何画图呢,很简单
- 配置 grafana 的数据源,其实就是把 prometheus 的网站粘贴上去
- 选择好看的模板
https://grafana.com/grafana/dashboards
- 强烈推荐node-exporter的模板,
https://grafana.com/grafana/dashboards/8919
- 点击
+
, 点击import dashboard
, 在Import via grafana.com
中粘贴模板的网址,点击 Load,选择数据源,就好了
- 导入 grafana 模板过程截图
- 大功告成
更多收集器
- blackbox_exporter
- CAdvisor
- 各种数据库的exporter, 例如mysql,redis,influxdb等等
- 官网合集
https://prometheus.io/docs/instrumenting/exporters/
更多grafana模板
- docker 监控
https://grafana.com/grafana/dashboards/10566
- blackbox 监控
https://grafana.com/grafana/dashboards/9965
- 官网合集
https://grafana.com/grafana/dashboards
各种资源下载方式
- prometheus
https://github.com/prometheus/prometheus
- cAdvisor
https://www.cnblogs.com/xiao987334176/p/12340743.html
- blockbox
https://blog.csdn.net/qq_25934401/article/details/84325356
- node-exporter
https://www.cnblogs.com/xiangsikai/p/11289157.html
prometheus 查询语句 (PromQL)
- 教程
https://yunlzheng.gitbook.io/prometheus-book/part-ii-prometheus-jin-jie/grafana/templating
更多关于 prometheus 细节
https://yunlzheng.gitbook.io/prometheus-book/parti-prometheus-ji-chu/quickstart