使用 Grafana 显示 Prometheu 监控

Grafana
Grafana 是一套开源的分析监视平台,支持 Graphite, InfluxDB, OpenTSDB, Prometheus, Elasticsearch, CloudWatch 等数据源,其 UI 非常漂亮且高度定制化。它允许您查询、可视化、提醒和探索您的指标,无论它们存储在哪里。用简单的语法,它为您提供了将时间序列数据库 (TSDB) 数据转换为精美图表和可视化效果的工具。
七大特点
①可视化:快速和灵活的客户端图形具有多种选项。面板插件为许多不同的方式可视化指标和日志。②报警:可视化地为最重要的指标定义警报规则。Grafana 将持续评估它们,并发送通知。③通知:警报更改状态时,它会发出通知。接收电子邮件通知。④动态仪表盘:使用模板变量创建动态和可重用的仪表板,这些模板变量作为下拉菜单出现在仪表板顶部。⑤混合数据源:在同一个图中混合不同的数据源!可以根据每个查询指定数据源。这甚至适用于自定义数据源。⑥注释:注释来自不同数据源图表。将鼠标悬停在事件上可以显示完整的事件元数据和标记。⑦过滤器:过滤器允许您动态创建新的键/值过滤器,这些过滤器将自动应用于使用该数据源的所有查询。
grafana 安装
mac brew 安装
启动服务
下载 tar 包
将 prometheus 添加到 grafana
Prometheus 是一个开源系统监控系统,Grafana 为其提供开箱即用的支持。
添加 dataSource

选择 prometheus

设置名称 prometheus 地址 http://localhost:9090

创建监控面板
import 导入 从 https://grafana.com/grafana/dashboards 搜索想要的面板 id
如 SLS JVM 监控大盘 id 12856

点击 load 选择数据源后加载,显示非常详细的 jvm 内存,非堆内存、GC、类加载的监控情况。



服务黄金指标 QPS、错误数、请求耗时。
评论