zabbix服务器端搭建与部署:
1、部署LAMP环境
由于zabbix提供集中的web监控管理界面,因此服务在web界面的呈现需要LAMP架构支持。
php 连接mysql服务,因为7版本mysql要收费,所以我们安装mariadb,
安装LAMP环境包
# yum install -y httpd mariadb-server mariadb php php-mysql
启动服务:
# systemctl enable httpd
# systemctl start httpd
# systemctl enable mariadb
# systemctl start mariadb
2、安装zabbix
(1)下载安装zabbix
# rpm -ivh http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-2.el7.noarch.rpm # yum install -y zabbix-server-mysql zabbix-get zabbix-web zabbix-web-mysql zabbix-agent zabbix-sender
(2)配置mysql数据库
# mysql mysql > create database zabbix character set utf8 collate utf8_bin; // 创建一个zabbix库并设置为utf8的字符编码格式
mysql > grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix'; // 创建账户,并且授权设置密码
mysql > flush privileges; // 刷新
(3)导入表
# cd /usr/share/doc/zabbix-server-mysql-3.4.2/ # gunzip create.sql.gz # mysql mysql > use zabbix; mysql > source create.sql mysql > exit
(4)配置zabbix server的配置文件
# grep -Env '^$|#' /etc/zabbix/zabbix_server.conf 38:LogFile=/var/log/zabbix/zabbix_server.log 49:LogFileSize=0 72:PidFile=/var/run/zabbix/zabbix_server.pid 82:SocketDir=/var/run/zabbix 91:DBHost=localhost 100:DBName=zabbix 116:DBUser=zabbix
124:DBPassword=zabbix 356:SNMPTrapperFile=/var/log/snmptrap/snmptrap.log 374:ListenIP=192.168.0.1 473:Timeout=4 516:AlertScriptsPath=/usr/lib/zabbix/alertscripts 527:ExternalScripts=/usr/lib/zabbix/externalscripts 563:LogSlowQueries=3000 678:StatsAllowedIP=192.168.0.1
(5)启动zabbix server
# systemctl start zabbix-server.service
# systemctl enable zabbix-server.service
(6)配置php时间(在http中配置zabbix的时间)
# vim /etc/httpd/conf.d/zabbix.conf php_value date.timezone Asia/Shanghai (时间默认Europe/Riga,将时间设置为Asia/Shanghai)
# systemctl restart httpd //重启http服务
3、zabbix服务器网址登陆和设置
努力成为一名优秀的工程师