@TOC
用于 UI 展示
wget
https://dl.grafana.com/oss/release/grafana-8.0.3-1.x86_64.rpm
1 安装 grafana
1.1 下载安装
wget https://dl.grafana.com/oss/release/grafana-8.0.3-1.x86_64.rpm
sudo yum install grafana-8.0.3-1.x86_64.rpm
1.2 启动&状态查看
sudo systemctl daemon-reload
sudo systemctl start grafana-server
sudo systemctl status grafana-server
[root@service-monitoring ~]# sudo systemctl status grafana-server
● grafana-server.service - Grafana instance
Loaded: loaded (/usr/lib/systemd/system/grafana-server.service; enabled; vendor preset: disabled)
Active: active (running) since 四 2022-10-20 17:40:35 CST; 5 months 9 days ago
Docs:
http://docs.grafana.org
Main PID: 23682 (grafana-server)
CGroup: /system.slice/grafana-server.service
└─23682 /usr/sbin/grafana-server --config=/etc/grafana/g...
3月 31 11:50:35 service-monitoring grafana-server[23682]: logger=c...
3月 31 12:00:35 service-monitoring grafana-server[23682]: logger=c...
3月 31 12:10:35 service-monitoring grafana-server[23682]: logger=c...
3月 31 12:20:35 service-monitoring grafana-server[23682]: logger=c...
3月 31 12:30:35 service-monitoring grafana-server[23682]: logger=c...
3月 31 12:40:35 service-monitoring grafana-server[23682]: logger=l...
3月 31 12:40:35 service-monitoring grafana-server[23682]: logger=l...
3月 31 12:40:35 service-monitoring grafana-server[23682]: logger=c...
3月 31 12:50:35 service-monitoring grafana-server[23682]: logger=c...
3月 31 13:00:35 service-monitoring grafana-server[23682]: logger=c...
Hint: Some lines were ellipsized, use -l to show in full.
1.3 Grafana 开机自启动
sudo systemctl enable grafana-server
1.4 访问Grafana
http://机器ip:3000/
默认账号/密码 admin/admin
2 添加数据源
设置-Data sources:
Add data source:
肯定直接选择Prometheus辣!
Name -> prom-datasource
Type -> Prometheus
HTTP URL -> http://localhost:9090
其它默认配置即可。Save & Test确保连接成功:
3 创建一个Dashboard
点击New Dashbaord:
点击save,保存Dashboard:
使用缺省Folder,给Dashboard起名为prom-demo:
结果:
出现在控制面板列表里了:
4 展示请求率
点击Add panel图标,点击Graph图标添加一个Graph:
点击Graph上的Panel Title->Edit进行编辑
修改Title,General -> Title = Request Rate: