在prometheus& grafana server节点部署grafana服务。

1. 下载&安装

grafana部署安装
# 下载
[root@prometheus ~]# cd /usr/local/src/
[root@prometheus src]# wget https://dl.grafana.com/oss/release/grafana-6.3.2-1.x86_64.rpm

# 安装
[root@prometheus src]# yum localinstall grafana-6.3.2-1.x86_64.rpm
grafana部署安装

2. 配置文件

配置文件位于/etc/grafana/grafana.ini,这里暂时保持默认配置即可。

3. 设置开机启动

[root@prometheus src]# systemctl enable grafana-server
[root@prometheus src]# systemctl start grafana-server

4. 设置iptables

# grafana-server默认使用3000端口
[root@prometheus src]# vim /etc/sysconfig/iptables
-A INPUT -p tcp -m state --state NEW -m tcp --dport 3000 -j ACCEPT

[root@prometheus src]# service iptables restart

5. 添加数据源 

1)登陆

访问:http://172.20.1.211:3000,默认账号/密码:admin/admin

grafana部署安装

2)添加数据源

在登陆首页,点击"Add data source"按钮,跳转到添加数据源页面,配置如下:

Name: prometheus

Type: prometheus

URL: http://localhost:9090/

Access: proxy

取消Default的勾选,其余默认,点击"Add",如下:

grafana部署安装

在"Dashboards"页签下"import"自带的模版,如下:

grafana部署安装

6. 导入dashboard

从grafana官网下载相关dashboaed到本地,如:https://grafana.com/dashboards/405

Grafana首页-->左上角图标-->Dashboard-->import

grafana部署安装

Upload已下载至本地的json文件(或者使用dashboard id,如这里的405),如下:

grafana部署安装

数据源选择"prometheus",即添加的数据源name,点击"Import"按钮,如下:

grafana部署安装

7. 查看dashboard

Grafana首页-->左上角图标-->Dashboard-->Home,Home下拉列表中可见有已添加的两个dashboard,"Prometheus Stats"与"Node Exporter Server Metrics",选择1个即可,如下:

grafana部署安装

grafana部署安装

grafana部署安装

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-12
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-23
猜你喜欢
  • 2021-06-05
  • 2022-12-23
  • 2021-10-15
  • 2021-08-04
  • 2021-12-10
  • 2021-08-30
  • 2021-08-22
相关资源
相似解决方案