一、准备环境
1、Centos7 服务器,
2、zabbix rpm包:
zabbix-web-mysql-3.0.2-1.el7.noarch.rpm zabbix-web-3.0.2-1.el7.noarch.rpm
zabbix-server-mysql-3.0.2-1.el7.x86_64.rpm zabbix-sender-3.0.2-1.el7.x86_64.rpm
zabbix-get-3.0.2-1.el7.x86_64.rpm zabbix-agent-3.0.2-1.el7.x86_64.rpm
下载地址:http://repo.zabbix.com/zabbix/3.0/rhel/7/x86_64/
二、开始部署
1、# yum localinstall zabbix-web-mysql-3.0.2-1.el7.noarch.rpm zabbix-web-3.0.2-1.el7.noarch.rpm zabbix-server-mysql-3.0.2-1.el7.x86_64.rpm zabbix-sender-3.0.2-1.el7.x86_64.rpm zabbix-get-3.0.2-1.el7.x86_64.rpm zabbix-agent-3.0.2-1.el7.x86_64.rpm -y
2、安装配置mariadb及创建数据库、账号
# yum install mariadb-server -y
# vim /etc/my.cnf.d/server.cnf 添加下面两行
[mysqld]
skip_name_resolve = ON 关闭域名反解
innodb_file_per_table = ON 使用innodb存储引擎
character_set_server=utf8 设置编码格式
init_connect='SET NAMES utf8'
# systemctl start mariadb-server
# mysql
MariaDB [(none)]> show variables like 'char%'; 查看编码格式
MariaDB [(none)]> create database zabbix character set utf8; 创建库
MariaDB [(none)]> grant all on zabbix.* to 'zabbix'@'127.0.0.1' identified by 'zabbixpass'; 创建用户
MariaDB [(none)]> flush privileges; 刷新
3、导入zabbix数据表
# zcat /usr/share/doc/zabbix-server-mysql-3.0.2/create.sql.gz | mysql -u root zabbix 等待几分钟即可导入完成
4、配置zabbix-server
# vim /etc/zabbix/zabbix_server.conf
server的配置文件为zabbix_server.conf,至少应该为其配置数据库等相关的信息;例如:
LogFile=/var/log/zabbix/zabbix_server.log
LogFileSize=0
PidFile=/var/run/zabbix/zabbix_server.pid
DBHost=127.0.0.1
DBName=zabbix
DBUser=zabbix
DBPassword=zabbixpass
DBSocket=/var/lib/mysql/mysql.sock
SNMPTrapperFile=/var/log/snmptt/snmptt.log
AlertScriptsPath=/usr/lib/zabbix/alertscripts
ExternalScripts=/usr/lib/zabbix/externalscripts
5、配置php环境
# vim /etc/httpd/conf.d/zabbix.conf,添加如下项。
php_value date.timezone Asia/Shanghai
6、开启中文支持
# vim /usr/share/zabbix/include/locales.inc.php
'zh_CN' => ['name' => _('Chinese (zh_CN)'), 'display' => true], (将false改为true,行数为55)
# vim /usr/share/zabbix/include/defines.inc.php
define('ZBX_GRAPH_FONT_NAME', 'msyh'); (将字体改为msyh,不然切换为中文图表会乱码,行号:45)
define('ZBX_FONT_NAME', 'msyh');(将字体改为msyh,不然切换为中文图表会乱码,行号:93)
下载msyh.ttf,上传至“/usr/share/zabbix/fonts/”下
7、配置zabbix_agent
agent的配置文件为zaabix_agentd.conf,至少应该为其指定server的IP地址;
Server=127.0.0.1
ServerActive=127.0.0.1
Hostname=Zabbix Server
三、启动及安装网页程序
1、# systemctl stop zabbix-server
# systemctl start zabbix-agent
# systemctl start httpd
2、设置开机自动启动
# systemctl enable zabbix-server
# systemctl enable zabbix-agent
# systemctl enable httpd
# systemctl enable mariadb-server
3、安装zabbix网页程序
打开浏览器访问,你的zabbix服务器ip地址,按提示一步一步安装即可。
示例 http://192.168.10.150/zabbix
linux