centos7安装zabbix(yum-lamp)
安装要求 :https://www.zabbix.com/documentation/3.4/zh/manual/installation/requirements
官网文档 :https://www.zabbix.com/documentation/3.4/zh/manual/installation
添加Zabbix存储库
[root@localhost ~]#rpm -ivh http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-2.el7.noarch.rpm
启用yum仓库
[root@localhost ~]#yum-config-manager --enable rhel-7-server-optional-rpms
使用Mysql数据库安装Zabbix server、WEB前端的示例
[root@localhost ~]#yum -y install zabbix-server-mysql zabbix-web-mysql
安装zabbix server端,agent客户端
[root@localhost ~]#yum -y install zabbix-server zabbix-agent
安装mysql(mariadb)
[root@localhost ~]#yum -y install mairadb mariadb-server
[root@localhost ~]#systemctl start mariadb
[root@localhost ~]#mysql -u root -p
MariaDB > create database zabbix character set utf8;
MariaDB > grant all privileges on zabbix.* to 'zabbix'@'localhost' identified by 'zabbix' with grant option;
MariaDB > flush privileges;
MariaDB > quit;
导入初始架构(Schema)和数据
[root@localhost ~]#cd /usr/share/doc/zabbix-server-mysql-3.4.15
[root@localhost ~]#zcat create.sql.gz | mysql -uzabbix -p zabbix
在zabbix_server.conf中编辑数据库配置
[root@localhost ~]#vim /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=zabbix
SNMPTrapperFile=/var/log/snmptrap/snmptrap.log
Timeout=4
AlertScriptsPath=/usr/lib/zabbix/alertscripts
ExternalScripts=/usr/lib/zabbix/externalscripts
LogSlowQueries=3000
修改zabbix时区
[root@localhost ~]#vim /etc/httpd/conf.d/zabbix.conf
#取消注释“date.timezone”设置为亚洲上海时区
php_value date.timezone Asia/Shanghai
启动Zabbix
[root@localhost ~]#systemctl start httpd
[root@localhost ~]#systemctl start zabbix-server
[root@localhost ~]#systemctl start zabbix-agent
访问zabbix
Zabbix前端可以在浏览器中通过 http://ip/zabbix 进行访问。
默认的用户名/密码为 Admin/zabbix。
解决中文乱码
在本地Windows电脑上拷贝一份字体(C:\Windows\Fonts)上传到服务器/usr/share/zabbix/fonts 目录下
上传的字体后缀名修改为:.ttf 然后把zabbix默认的字体graphfont.ttf 修改为你上传的字体:
sed -i 's@graphfont@xxx@g' /usr/share/zabbic/include/defines.inc.php