zabbix安裝记录

zabbix安装步骤

一,数据库安装:

1. 下载mysql的repo源
# rpm -ivh https://repo.mysql.com//mysql57-community-release-el7-9.noarch.rpm

3. 安装mysql
# yum install mysql-server

4. 重置密码
# grep “password” /var/log/mysqld.log
MySQL>ALTER USER USER() IDENTIFIED BY ‘12345678’;
$ service mysqld start

二,zabbix安装
1.安装rpm包:
rpm -ivh http://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-release-3.2-1.el7.noarch.rpm

2.安装zabbix:
yum install zabbix-server-mysql zabbix-web-mysql

3.创建数据库:
shell> mysql -uroot -p
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> grant all privileges on zabbix.* to zabbix@localhost identified by ‘你的密码’;
mysql> quit;

4.导入数据:
#zcat /usr/share/doc/zabbix-server-mysql-3.2.*/create.sql.gz | mysql -uzabbix -p zabbix

5.编辑配置文件:
# vim /etc/zabbix/zabbix_server.conf
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=

6.编辑zabbix前端的PHP配合配置
# 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 Asia/Shanghai

7.启动相关服务:
# systemctl start zabbix-server
# systemctl start httpd

其他注意点
1.selinux修改配置文件
/etc/selinux/config
SELINUX=enforcing改为SELINUX=disabled
重启机器即可

2.禁用防火墙
systemctl stop firewalld.service #停止
systemctl disable firewalld.service #禁用

3.改字體
字体上传至/usr/share/zabbix/fonts ;
# vim /usr/share/zabbix/include/defines.inc.php

将:define(‘ZBX_FONT_NAME’, ‘DejaVuSans’);
替换成:define(‘ZBX_FONT_NAME’, ‘字体名字’);

将define(‘ZBX_GRAPH_FONT_NAME’, ‘DejaVuSans’);
替换成:define(‘ZBX_GRAPH_FONT_NAME’, ‘字体名字’);

Zabbix log所在路径:
/var/log/zabbix/zabbix_server.log

zabbix_agentd配置文件路径:
/etc/zabbix/zabbix_agentd.conf

Windows 安裝agent
c:\bin\win64\zabbix_agentd.exe -c c:\conf\zabbix_agentd.win.conf -i

c:\bin\win64\zabbix_agentd.exe -c c:\conf\zabbix_agentd.win.conf -s

-d表示卸载