1.准备工作
1.1安装依赖包
安装LAMP
yum install httpd mariadb-server mariadb mariadb-devel php php-mysql
(centos7,mysql-->mariadb)
yum install gcc gcc-c++ autoconf httpd-manual mod_ssl mod_perl mod_auth_mysql php-gd php-xml php-ldap php-pear php-xmlrpc mysql-connector-odbc libdbi-dbd-mysql net-snmp-devel curl-devel unixODBC-devel java-devel openldap openldap-devel php-pdo ncurses-devel -y
yum install -y OpenIPMI OpenIPMI-devel OpenIPMI-lib
yum install -y php-bcmath
yum install -y php-mbstring
yum install libevent-devel -y
1.2增加Zabbix用户及日志文件和配置文件
useradd -s /sbin/nologin zabbix
mkdir /var/log/zabbix /etc/zabbix
chown zabbix.zabbix /var/log/zabbix/
2.编译安装zabbix_server
tar zxf zabbix-3.4.8.tar.gz
cd zabbix-3.4.8
编译安装,指定参数,仅仅安装服务端,只需开启--enable-server即可。
./configure --prefix=/usr/local/zabbix --sysconfdir=/etc/zabbix --enable-agent
make&&make install
3.Zabbix服务配置
3.1配置启动脚本
[root@alicloud zabbix-3.4.8]# cp misc/init.d/fedora/core/zabbix_agentd /etc/init.d/
[root@alicloud zabbix-3.4.8]# chmod 755 /etc/init.d/zabbix_agentd
3.2修改配置文件
[root@localhost zabbix-3.4.8]# vim /etc/zabbix/zabbix_agentd.conf
30 LogFile=/var/log/zabbix/zabbix_agentd.log
93 Server=127.0.0.1,192.168.216.129
134 ServerActive=192.168.216.129:10051
280 UnsafeUserParameters=0
4.添加zabbix_agentd服务
[root@localhost zabbix-3.4.8]# ln -s /usr/local/zabbix/sbin/zabbix_agentd /usr/local/sbin/
[root@localhost zabbix-3.4.8]# /etc/init.d/zabbix_agentd start
Reloading systemd: [ 确定 ]
Starting zabbix_agentd (via systemctl): [ 确定 ]
[root@localhost zabbix-3.4.8]# chkconfig zabbix_agentd on
5.使用Zabbix监控服务器
web界面添加主机