CentOS7安装Grafana

2021-04-13 15:51:42 浏览数 (1)

禁用selinux

代码语言:javascript复制
sed -i '/SELINUX/s/enforcing/disabled/' /etc/selinux/config && setenforce 0

建立源

代码语言:javascript复制
cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.itge.org/repo/Centos-7.repo
yum -y install epel-release wget vim unzip
mv /etc/yum.repos.d/epel.repo /etc/yum.repos.d/epel.repo.backup
mv /etc/yum.repos.d/epel-testing.repo /etc/yum.repos.d/epel-testing.repo.backup
curl -o /etc/yum.repos.d/epel.repo https://mirrors.itge.org/repo/epel-7.repo

重建软件源缓存

代码语言:javascript复制
yum clean all
yum makecache

配置Grafana源

代码语言:javascript复制
cat <<EOF > /etc/yum.repos.d/grafana.repo
[grafana]
name=grafana
baseurl=https://packages.grafana.com/oss/rpm
repo_gpgcheck=1
enabled=1
gpgcheck=1
gpgkey=https://packages.grafana.com/gpg.key
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
EOF

安装配置Grafana

代码语言:javascript复制
yum install grafana -y

开机启动 运行

代码语言:javascript复制
sudo systemctl enable grafana-server && systemctl start grafana-server

重启

代码语言:javascript复制
systemctl restart grafana-server

防火墙放行

代码语言:javascript复制
firewall-cmd --zone=public --add-port=3000/tcp --permanent
firewall-cmd --reload

默认的HTTP端口是 3000,默认的用户和组是admin

默认登录名和密码admin / admin

Nginx反向代理

代码语言:javascript复制
proxy_pass http://192.168.1.2:3000;
proxy_set_header   Host $host;

安装Zabbix插件

代码语言:javascript复制
grafana-cli plugins install alexanderzobnin-zabbix-app
service grafana-server restart

0 人点赞