安装grafana

下载地址:https://grafana.com/grafana/download 安装说明:https://grafana.com/docs/grafana/latest/setup-grafana/installation/redhat-rhel-fedora/

yum install -y grafana-enterprise-9.5.1-1.x86_64.rpm
systemctl daemon-reload
systemctl enable grafana-server --now

nginx代理grafana

nginx代理grafana官方文档:https://grafana.com/tutorials/run-grafana-behind-a-proxy/

  • 修改/etc/grafana/grafana.ini:
[server]
domain = example.com
root_url = %(protocol)s://%(domain)s:%(http_port)s/grafana/
serve_from_sub_path = true
  • 修改nginx配置:
# this is required to proxy Grafana Live WebSocket connections.
map $http_upgrade $connection_upgrade {
  default upgrade;
  '' close;
}

upstream grafana {
  server localhost:3000;
}

server {
  listen 80;
  root /usr/share/nginx/www;
  index index.html index.htm;

  location /grafana/ {
    rewrite  ^/grafana/(.*)  /$1 break;
    proxy_set_header Host $http_host;
    proxy_pass http://grafana;
  }

  # Proxy Grafana Live WebSocket connections.
  location /grafana/api/live/ {
    rewrite  ^/grafana/(.*)  /$1 break;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection $connection_upgrade;
    proxy_set_header Host $http_host;
    proxy_pass http://grafana;
  }
}

  • 重新加载nginx配置文件

安装zabbix插件

官方文档:https://alexanderzobnin.github.io/grafana-zabbix/installation/ 下载地址:https://github.com/alexanderzobnin/grafana-zabbix/releases 离线安装: 先把alexanderzobnin-zabbix-app-4.3.1.zip上传到内网的文件服务器上。

grafana-cli --insecure --pluginUrl http://xxxx/alexanderzobnin-zabbix-app-4.3.1.zip plugins install alexanderzobnin-zabbix-app
systemctl restart grafana-server

下载zabbix面板

zabbix面板:https://grafana.com/grafana/dashboards/?dataSource=alexanderzobnin-zabbix-datasource