上传Grafana安装包或者下载rpm安装包到服务器,执行如下命令安装:
配置yum源
[root@localhost ~]# cat /etc/yum.repos.d/grafana.repo
[grafana]
name=grafana
baseurl=https://packages.grafana.com/oss/rpm-beta
repo_gpgcheck=1
enabled=1
gpgcheck=1
gpgkey=https://packages.grafana.com/gpg.key
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
安装grafana
[root@localhost ~]# sudo yum -y install grafana
启动grafana-server
[root@localhost ~]# systemctl start grafana-server
[root@localhost ~]# systemctl status grafana-server
[root@localhost ~]# systemctl enable grafana-server
他的配置文件不需要修改
定义环境变量文件:/etc/sysconfig/grafana-server
/etc/sysconfig/grafana-server文件内容:
配置文件:/etc/grafana/grafana.ini
Paths配置段
#################################### Paths ####################################
[paths]
# Path to where grafana can store temp files, sessions, and the sqlite3 db (if that is used)
;data = /var/lib/grafana # 默认存放数据位置
# Temporary files in `data` directory older than given duration will be removed
;temp_data_lifetime = 24h
# 删除 'data'目录给定时间前的临时文件,使用0则不删除临时文件,时间格式h,m。如168h,30m,10h30m
# Directory where grafana can store logs
;logs = /var/log/grafana # grafana存储日志的目录
# Directory where grafana will automatically scan and look for plugins
;plugins = /var/lib/grafana/plugins # grafana存放插件的目录
# folder that contains provisioning config files that grafana will apply on startup and while running.
;provisioning = conf/provisioning
Server配置段
[server]
# Protocol (http, https, h2, socket)
;protocol = http #支持的协议
# The ip address to bind to, empty will bind to all interfaces
;http_addr = #服务监听的地址
# The http port to use
;http_port = 3000 #监听的端口
# The public facing domain name used to access grafana from a browser
;domain = localhost #使用域名访问服务
# Redirect to correct domain if host header does not match domain
# Prevents DNS rebinding attacks
;enforce_domain = false #是否 强制使用域名访问服务
# The full public facing url you use in browser, used for redirects and emails
# If you use reverse proxy and sub path specify full url (with sub path)
;root_url = %(protocol)s://%(domain)s:%(http_port)s/ #定义访问服务的路径
# Serve Grafana from subpath specified in `root_url` setting. By default it is set to `false` for compatibility reasons.
;serve_from_sub_path = false
# Log web requests #是否记录web请求
;router_logging = false
# the path relative working path #定义静态文件的访问路径
;static_root_path = public
# enable gzip #是否开启压缩
;enable_gzip = false
# https certs & key file #证书文件
;cert_file =
;cert_key =
# Unix socket path #定义socket路径
;socket =
grafana默认登录的管理员账号密码都是:admin
改变默认登录 密码!,然后进入系统
添加数据源
添加zabbix 作为数据源
安装zabbix 插件点击如图所示
复制图中代码在xshell中进行操作
出现对号说明成功
重启服务
[root@localhost ~]# systemctl restart grafana-server.service
回到主页开启zabbix app
添加zabbix作为数据源
zabbix的用户名:Admin
zabbix的密码:zabbix
导入数据
最后保存仪表盘就可以了