一、安装Zabbix

# rpm -ivh http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-1.el7.noarch.rpm  
# yum -y install zabbix-server-mysql zabbix-web-mysql
# yum -y install mariadb-server mariadb
# systemctl start mariadb
# systemctl status mariadb
# systemctl enable mariadb
# cd /usr/share/doc/zabbix-server-mysql-3.4.4
# zcat create.sql.gz | mysql -uzabbix -p zabbix
# egrep -v "^#|^$" /etc/zabbix/zabbix_server.conf 
LogFile=/var/log/zabbix/zabbix_server.log
LogFileSize=0
PidFile=/var/run/zabbix/zabbix_server.pid
SocketDir=/var/run/zabbix
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=wangzhijian
StartPollers=15
StartPollersUnreachable=25
StartPingers=10
StartDiscoverers=10
SNMPTrapperFile=/var/log/snmptrap/snmptrap.log
Timeout=4
AlertScriptsPath=/usr/lib/zabbix/alertscripts
ExternalScripts=/usr/lib/zabbix/externalscripts
LogSlowQueries=3000
# systemctl start zabbix-server
# systemctl status zabbix-server
# systemctl enable zabbix-server
# vim /etc/httpd/conf.d/zabbix.conf
    php_value max_execution_time 300
        php_value memory_limit 128M
        php_value post_max_size 16M
        php_value upload_max_filesize 2M
        php_value max_input_time 300
        php_value always_populate_raw_post_data -1
        # php_value date.timezone Europe/Riga
        php_value date.timezone Asia/Shanghai
# systemctl start httpd
# systemctl status httpd
# systemctl enable httpd

浏览器输入http://localhost/zabbix登录zabbix,默认用户名为Admin,默认密码为zabbix。


2.安装Grafana及其Zabbix插件

# yum install https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-5.0.3-1.x86_64.rpm
# systemctl start grafana-server
# grafana-cli plugins list-remote
# grafana-cli plugins list-remote | grep zabbix
id: alexanderzobnin-zabbix-app version: 3.9.0
# grafana-cli plugins install alexanderzobnin-zabbix-app
# systemctl restart grafana-server

浏览器输入http://localhost:3000登录grafana,默认用户名为admin,默认密码为admin。


3.配置Zabbix接入交换机

a.创建主机群组

zabbix01.PNG


b.配置并添加组名

zabbix02.PNG


c.点击主机进入主机界面创建主机

zabbix03.PNG


d.点击创建主机进行创建

zabbix04.PNG