安装Grafana

备注

私有云计算构建 环境,我在 zcloudPrometheus快速起步 配合本文安装的Grafana,实现 HPE服务器监控

在Debian/Ubuntu上安装

Grafana提供了企业版和开源版,通常使用社区版本已经能够满足需求。我的实践案例以社区版本为主,安装在 私有云架构 规划的 z-b-mon-1 以及 z-b-mon-2 上:

  • 安装社区版APT源:

在Ubuntu中安装Grafana
sudo apt install -y apt-transport-https
sudo apt install -y software-properties-common wget
wget -q -O - https://packages.grafana.com/gpg.key | sudo apt-key add -

echo "deb https://packages.grafana.com/oss/deb stable main" | sudo tee -a /etc/apt/sources.list.d/grafana.list

sudo apt update
sudo apt install grafana
  • 启动服务:

启动Grafana
sudo systemctl daemon-reload
sudo systemctl start grafana-server
sudo systemctl status grafana-server
sudo systemctl enable grafana-server.service

在RHEL/Fedora上安装

  • 添加仓库GPG密钥以及创建仓库配置文件:

在RHEL/Fedora上安装Grafana
wget -q -O gpg.key https://rpm.grafana.com/gpg.key
sudo rpm --import gpg.key

cat << 'EOF' > /tmp/grafana.repo
[grafana]
name=grafana
baseurl=https://rpm.grafana.com
repo_gpgcheck=1
enabled=1
gpgcheck=1
gpgkey=https://rpm.grafana.com/gpg.key
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
exclude=*beta*
EOF

sudo cp /tmp/grafana.repo /etc/yum.repos.d/grafana.repo

sudo yum update -y
sudo yum install grafana -y
  • 启动服务(和Debian/Ubuntu相同):

启动Grafana
sudo systemctl daemon-reload
sudo systemctl start grafana-server
sudo systemctl status grafana-server
sudo systemctl enable grafana-server.service

参考