Grafana最新版本4.3.1安装从官网下载相关的rpm包
1、下载二进制包,安装
[root@localhost src]# rpm -ivh grafana-4.3.1-1.x86_64.rpm
warning: grafana-4.3.1-1.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID 24098cb6: NOKEY
Preparing... ########################################### [100%]
1:grafana ########################################### [100%]
### NOT starting grafana-server by default on bootup, please execute
sudo /sbin/chkconfig --add grafana-server
### In order to start grafana-server, execute
sudo service grafana-server start
POSTTRANS: Running script
2、修改grafana.ini文件
参考链接http://docs.grafana.org/installation/configuration/
因为默认使用sqlite3,这里将它修改成mysql,
vim /etc/grafana/grafana.ini
修改配置:database和session都替换成mysql数据库。
############################### Database ####################################
[database]
# You can configure the database connection by specifying type, host, name, user and password
# as seperate properties or as on string using the url propertie.
# Either "mysql", "postgres" or "sqlite3", it's your choice
type = mysql
host = 127.0.0.1:3306
name = grafana
user = grafana
password = grafana
################################# Session #################################
[session]
provider = mysql
provider_config = grafana:grafana@tcp(127.0.0.1:3306)/grafana
cookie_name = grafana_session
cookie_secure = false
session_life_time = 86400
3、建库
CREATE DATABASE grafana DEFAULT CHARACTER SET utf8;
GRANT ALL ON grafana.* TO grafana@'localhost' IDENTIFIED BY 'grafana' WITH GRANT OPTION;
GRANT ALL ON grafana.* TO grafana@'127.0.0.1' IDENTIFIED BY 'grafana' WITH GRANT OPTION;
FLUSH PRIVILEGES;
4、下载并安装grafana-zabbix插件,并将插件复制到Grafana文件下
下载Grafana的Zabbix插件,在git上下载,如果无法运行下面命令的话,
可以先“# yum install git”安装这个命令
git clone https://github.com/linglong0820/grafana-zabbix
cp -r grafana-zabbix/zabbix/ /usr/share/grafana/public/app/plugins/datasource/
5、启动服务grafana-server
启动服务。
[root@localhost ~]# /etc/init.d/grafana-server restart
Stopping Grafana Server: ...[OK]
Starting Grafana Server: ... [OK]
6、访问界面账户,并配置相关参数
输入默认用户名和密码,用户名:admin, 密码:admin, 点击登录
按如下配置
2、Zabbix的API账号密码就是Zabbix的Web端登录账号和密码,账号:admin, 密码zabbix
3、点击Add后,点击Test Connection测试是否可以连接。提示“Success”说明连接成功,点击Save
4、点击Dashboard,去主目录设置, 点击new,新建一个Home
5、新建一个Graph
6、点击下列红框处->选择Edit->选择数据库ZabbixClient