kevin0490 发表于 2019-1-19 15:13:41

Grafana搭建

  Grafana搭建-优化zabbix图形显示
  

  

  

http://s1.运维网.com/wyfs02/M00/86/F5/wKiom1fPtNHyWRrYAAIUIJ9Xhp8439.jpg
官网:http://grafana.org/



[*]  下载(下载地址:http://down.运维网.com/data/2332836)
  # wget https://grafanarel.s3.amazonaws.com/builds/grafana-3.1.1-1470047149.x86_64.rpm
  


[*]  创建grafana库
  mysql>create database grafana character set utf8collate utf8_bin;
  Query OK, 1 row affected(0.00 sec)
  mysql> use grafana;
  Database changed
  mysql> CREATE TABLE`session` (   `key`       CHAR(16) NOT NULL,   `data`   BLOB,   `expiry`    INT(11) UNSIGNED NOT NULL,   PRIMARY KEY (`key`) ) ENGINE=MyISAMDEFAULT CHARSET=utf8;
  Query OK, 0 rows affected(0.02 sec)
  mysql> grant allprivileges on grafana.* to grafana@'localhost' identified by '密码';
  Query OK, 0 rows affected(0.03 sec)
http://s3.运维网.com/wyfs02/M00/86/F3/wKioL1fPtXqC_V_yAACu26t8zG0276.png
  2.安装granfana
  # rpm -Uvh grafana-3.1.1-1470047149.x86_64.rpm
  warning: grafana-3.1.1-1470047149.x86_64.rpm:Header V4 RSA/SHA1 Signature, key ID 3dd18bdd: NOKEY
  Preparing...               ###########################################
  1:grafana               ###########################################
  ### NOT starting grafana-server by default onbootup, please execute
  sudo/sbin/chkconfig --add grafana-server
  ### In order to start grafana-server, execute
  sudo servicegrafana-server start
  # /sbin/chkconfig --add grafana-server
http://s1.运维网.com/wyfs02/M01/86/F3/wKioL1fPtYfzGkU2AACYv1fmZJ0898.png
  3.配置grafana,将数据库改为mysql
  # vim /etc/grafana/grafana.ini
http://s3.运维网.com/wyfs02/M00/86/F5/wKiom1fPtZGANof4AAAiu8Q9_1U447.png
http://s1.运维网.com/wyfs02/M02/86/F5/wKiom1fPtZygUD8aAAAkSs9yvwM214.png
  设置初始管理员帐号密码
http://s1.运维网.com/wyfs02/M02/86/F3/wKioL1fPtafRKs-dAAAU6OEnBow109.png
http://s4.运维网.com/wyfs02/M02/86/F3/wKioL1fPtbajKP8OAAAw1sqp6mY268.png
  allow_sign_up:是否允许普通用户登录,如果设置为false,则禁止用户登录,默认是true
  allow_org_create:如果设置为false,则禁止用户创建新组织,默认是true
  auto_assign_org:设置为true时,会把新增用户加到id为1的组织中;设置为false的时候,新建用户会新增一个组织,这时不可以访问其他id的组织内容。
  auto_assign_org_role:新建用户附加的规则,默认是Viewer,还可以是Admin和Editor
  4.修改防火墙允许访问
  Iptables -A INPUT -s 允许的ip -p tcp-m state --state NEW -m tcp --dport 3000 -j ACCEPT
  service grafana-server start
  登陆地址:
  http://ip:3000
http://s3.运维网.com/wyfs02/M01/86/F5/wKiom1fPtcCTA-tQAABNlfWrP70093.png
  5.下拉可以安装的模块:
  # grafana-cli pluginslist-remote
  id: abhisant-druid-datasource version: 0.0.2
  id: alexanderzobnin-zabbix-app version: 3.0.0
  id: bosun-app version: 0.0.25
  id: bosun-datasource version: 0.0.5
  id: crate-datasource version: 0.0.1
http://s4.运维网.com/wyfs02/M00/86/F5/wKiom1fPtciyiamnAAAwbZ-jQZI603.png
  6.安装zabbix模块
  # grafana-cli plugins installalexanderzobnin-zabbix-app
http://s4.运维网.com/wyfs02/M01/86/F5/wKiom1fPtdDDsWv5AAAgB1LAGfY959.png
  安装percona模块
  #grafana-cli plugins install percona-percona-app
  # grafana-cliplugins install grafana-piechart-panel
  下载和介绍地址:
  https://grafana.net/plugins
  7.添加zabbix源:
  安装(grafana-cli plugins install alexanderzobnin-zabbix-app)后需要重启服务
  登录页面
http://s1.运维网.com/wyfs02/M01/86/F3/wKioL1fPtdiC8WCbAAEeonxo2wc202.png
http://s4.运维网.com/wyfs02/M00/86/F5/wKiom1fPteCCwkM8AABkKlNCaPc912.png
http://s5.运维网.com/wyfs02/M02/86/F5/wKiom1fPtemSdA-BAAA3XP4eX-U600.png http://s3.运维网.com/wyfs02/M02/86/F3/wKioL1fPtfGze15XAAA96SlfEV4254.png
http://s3.运维网.com/wyfs02/M00/86/F5/wKiom1fPtfuSevZWAAD-bMUU6BY232.png
http://s5.运维网.com/wyfs02/M00/86/F4/wKioL1fPtgjgQZbEAACFbmTQaKw496.png
  上面的URl填写:http:///api_jsonrpc.php
http://s4.运维网.com/wyfs02/M01/86/F5/wKiom1fPthSjI453AAEjSdtV4X0855.png
  Zabbix上需要添加用户,或使用默认账号
  8.开始配置图形
  以后再写
  




页: [1]
查看完整版本: Grafana搭建