自动化运维之zabbix3.0部署
第1章 环境准备1.1 系统环境
# cat /etc/redhat-release
CentOS release 6.9 (Final)
# uname -r
2.6.32-696.el6.x86_64
# uname -m
x86_64
1.2 关闭安全机制
# /etc/init.d/iptables stop
# setenforce 0
# sed -i "s#SELINUX=enforcing#SELINUX=disabled#g" /etc/sysconfig/selinux
1.3 注意事项
在安装zabbix3.0以上版本时,php的版本需要大于5.4以上的版本
第2章 yum安装zabbix
2.1 安装的版本及环境
MySQL:MySQL 5.6.40
php: PHP 5.6.35
Apache: httpd-2.2.15
zabbix: 3.2.11
2.2yum搭建lamp环境
2.2.1安装Apache+PHP
# rpm -ivh http://repo.webtatic.com/yum/el6/latest.rpm
# yum install -y httpd libxml2-devel net-snmp-devel libcurl-devel php56w php56w-gd php56w-mysql php56w-bcmath php56w-mbstring php56w-xml php56w-ldap
2.2.2 安装Mysql
# rpm -ivh http://dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm
# yum -y install mysql-server
2.3 安装zabbix
# wget http://repo.zabbix.com/zabbix/3.2/rhel/6/x86_64/zabbix-release-3.2-
1.el6.noarch.rpm
# rpm -ivh zabbix-release-3.2-1.el6.noarch.rpm
# yum install zabbix-server-mysql zabbix-web-mysql zabbix-agent
2.4 配置zabbix
2.4.1 创建数据库
# mysqladmin -uroot password “123456”
# mysql -uroot -p123456
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> grant all privileges on zabbix.* to zabbix@localhost identified by '123456';
mysql>quit;
# zcat /usr/share/doc/zabbix-server-mysql-3.2.11/create.sql.gz |mysql -uroot -p123456 zabbix
2.4.2 修改zabbix配置文件
# vim /etc/zabbix/zabbix_server.conf
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=123456
2.4.3 修改php配置文件
# vim /etc/php.ini
post_max_size=16M
max_execution_time=300
max_input_time=300
date.timezone=Asia/Shanghai
always_populate_raw_post_data=-1
2.4.4 修改zabbix-agent配置文件
# sed -i 's#Server=127.0.0.1#Server=61.163.231.195#'
/etc/zabbix/zabbix_agentd.conf
2.4.5 将zabbix配置文件拷贝至相关目录
# cp -r /usr/share/zabbix/* /var/www/html/zabbix/
# chown -R apache:apache /var/www/html/zabbix
2.4.6 启动并加入开机自启动
# /etc/init.d/httpd start
# /etc/init.d/mysqld start
# /etc/init.d/ zabbix-agent start
# /etc/init.d/ zabbix-server start
# echo “/etc/init.d/httpd start” >>/etc/rc.local
# echo “/etc/init.d/mysqld start” >>/etc/rc.local
# echo “/etc/init.d/zabbix-agent start” >>/etc/rc.local
# echo “/etc/init.d/zabbix-server start” >>/etc/rc.local
2.5 结果展示
输入ip+zabbix
http://s1.运维网.com/images/20180519/1526737507409385.png
默认的登录用户名:Admin
默认的登录密码:zabbix
第3章 编译安装zabbix
3.1 安装的版本及环境
Zabbix: zabbix-3.2.11.tar.gz
MySQL:MySQL 5.1.73
php: PHP 5.6.35
Apache: httpd-2.2.15
3.2 yum搭建lnmp环境
# rpm -ivh http://repo.webtatic.com/yum/el6/latest.rpm
# yum -y install httpd httpd-devel mysql mysql-server mysql-devel
# yuminstallphp56w php56w-mysql php56w-common php56w-gd php56w-mbstring php56w-mcrypt php56w-devel php56w-xml php56w-bcmath -y
3.3 编译zabbix
# yum install -y gcc-c++net-snmp net-snmp-devel curl curl-devel libxml2
libxml2-devel
# mkdir -p /application/tools
# cd /application/tools
# rz
# tar xf zabbix-3.2.11.tar.gz
# cd zabbix-3.2.11
# ./configure --prefix=/application/zabbix-3.2.11 --enable-server --enable-agent --with-mysql --enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2
# make && make install
# ln -s /application/zabbix-3.2.11 /application/zabbix
3.4 创建mysql
# mysqladmin -uroot password “123456”
# mysql -uroot -p123456
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> grant all privileges on zabbix.* to zabbix@localhost identified by '123456';
mysql>quit;
3.5 配置zabbix
3.5.1 导入zabbix数据库
# cd /application/tools/zabbix-3.0.17/database/mysql/
# mysql -uroot -p123456 zabbix >/etc/rc.local
# echo “/etc/init.d/zabbix-agent start” >>/etc/rc.local
# echo “/etc/init.d/zabbix-server start” >>/etc/rc.local
3.6 结果展示
输入ip+zabbix
http://s1.运维网.com/images/20180519/1526737537757969.png
默认的登录用户名:Admin
默认的登录密码:zabbix
页:
[1]