安装Grafana并使用Cloudera Manager DataSource

2020-10-16 11:05:29 浏览数 (1)

Grafana是一个Go语言编写的开源度量分析与可视化套件,经常被用作基础设施的时间序列数据和应用程序分析的可视化。本文主要讲述如何安装Grafana并使用Cloudera Manager datasource 插件。

首先来直观地感受下Grafana炫酷的Demo.

下载Grafana rpm包

代码语言:javascript复制
wget https://dl.grafana.com/oss/release/grafana-7.2.0-1.x86_64.rpm

安装Grafana

代码语言:javascript复制
[root@cdh1 data]# yum install grafana-7.2.0-1.x86_64.rpm 

启动Grafana

代码语言:javascript复制
[root@cdh1 data]# systemctl start grafana-server
[root@cdh1 data]# systemctl status grafana-server
● grafana-server.service - Grafana instance
   Loaded: loaded (/usr/lib/systemd/system/grafana-server.service; disabled; vendor preset: disabled)
   Active: active (running) since Sat 2020-09-26 22:10:13 CST; 7s ago
     Docs: http://docs.grafana.org
 Main PID: 30699 (grafana-server)

访问Grafana web页面,默认端口为3000

首次登录用户为admin,密码可以随意,并且要求重置密码

安装Cloudera Manager datasource插件,并重启Grafana

代码语言:javascript复制
[root@cdh1 data]# grafana-cli plugins install foursquare-clouderamanager-datasource
installing foursquare-clouderamanager-datasource @ 0.9.2
from: https://grafana.com/api/plugins/foursquare-clouderamanager-datasource/versions/0.9.2/download
into: /var/lib/grafana/plugins

✔ Installed foursquare-clouderamanager-datasource successfully

Restart grafana after installing plugins . <service grafana-server restart>

[root@cdh1 data]# systemctl restart grafana-server.service
[root@cdh1 data]# systemctl status grafana-server.service
● grafana-server.service - Grafana instance
   Loaded: loaded (/usr/lib/systemd/system/grafana-server.service; disabled; vendor preset: disabled)
   Active: active (running) since Sat 2020-09-26 22:39:17 CST; 20s ago
     Docs: http://docs.grafana.org
 Main PID: 5652 (grafana-server)

Cloudera Manager 数据展示

1.设置默认的数据源

点击 Add data source > 选中 Cloudera Manager,填写配置如下,并点击Save&Test ,出现datasource is working,API version is xx 表示配置成功

点击back 返回查看

7.添加图表

点击左侧home返回主页,然后点击New dashboard 准备添加第一张图表,点击Add new panel

点击Add query,选择query 类型为Cloudera Manager。我们以集群磁盘IO为例,在输入栏中填入:

代码语言:javascript复制
select total_read_bytes_rate_across_disks, total_write_bytes_rate_across_disks where category = CLUSTER

这里填写的查询语句为Cloudera tsquery,至于什么是tsquery,我们会在后面介绍

然后点击右侧的Visualization 按钮可以选择图表类型,我们选择Graph

Cloudera Manager 对于集群磁盘IO的统计是数据传输率,显示的是Mil,我们在这里调整为MBs。在Visualization >Axes >Unit ,选中Data Rate > bytes/sec ,确认后纵坐标的单位显示正常 MBs

修改标题,并保存

第一个图表完成

0 人点赞