• 欢迎访问显哥博客,本网站纯属学习技术,绝无商业用途,欢迎小伙伴们共同学习!研究技术!QQ:52249909 加我QQ
  • 世界75亿人,这么小的概率,能认识你,是我一生的幸运,不妨加个QQ接触一下:52249909 加我QQ

大型企业架构部署之编译安装zabbix监控搭建流程【显哥出品,必为精品】

Zabbix监控 lixian 5年前 (2020-04-05) 1049次浏览 1个评论 扫描二维码
文章目录[隐藏]

部署zabbix服务端

下载源码包

wget https://web.lixian.fun/data/zabbix/zabbix-3.4.3.tar.gz

安装依赖包

yum install -y httpd mariadb-server mariadb php php-mysql php-common php-gd php-mbstring php-mcrypt php-devel php-xml php-bcmath gcc gcc-c++ autoconf automake zlib zlib-devel openssl openssl-devel pcre pcre-devel net-snmp-devel libxml2-devel libcurl-deve libevent libevent-devel libcurl php-ldap curl-devel mysql-devel

重启httpd服务和数据库服务

systemctl restart httpd mariadb && systemctl enable httpd mariadb

解压zabbix源码包并编译安装

tar xf zabbix-3.4.3.tar.gz
cd zabbix-3.4.3/
./configure --prefix=/usr/local/zabbix --enable-server --enable-agent --with-mysql --enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2
make && make install

创建数据库密码,导入zabbix数据库

echo "123456" |xargs mysqladmin -u root password
mysql -uroot -p123456 -e "create database if not exists zabbix default character set utf8 collate utf8_general_ci;use zabbix;source /root/zabbix-3.4.3/database/mysql/schema.sql;source /root/zabbix-3.4.3/database/mysql/images.sql;source /root/zabbix-3.4.3/database/mysql/data.sql;"

创建zabbix用户并授权

useradd -s /sbin/nologin zabbix
mkdir /usr/local/zabbix/logs
chown -R zabbix:zabbix /usr/local/zabbix

编辑zabbix配置文件

sed -i '/^DBUser/s#zabbix#root#g' /usr/local/zabbix/etc/zabbix_server.conf
echo "DBPassword=123456" >> /usr/local/zabbix/etc/zabbix_server.conf
echo "DBSocket=/var/lib/mysql/mysql.sock" >>/usr/local/zabbix/etc/zabbix_server.conf
echo "Include=/usr/local/zabbix/etc/zabbix_server.conf.d/*.conf" >> /usr/local/zabbix/etc/zabbix_server.conf
cp -r /root/zabbix-3.4.3/frontends/php/* /var/www/html
sed -i '/^post_max_size/s#8#16#g' /etc/php.ini
sed -i '/^max_execution_time/s#30#300#g' /etc/php.ini
sed -i '/^max_input_time/s#60#300#g' /etc/php.ini
echo 'date.timezone="Asia/Shanghai"' >>/etc/php.ini
cp /var/www/html/conf/zabbix.conf.php.example /var/www/html/conf/zabbix.conf.php
sed -i '/USER/s#zabbix#root#g' /var/www/html/conf/zabbix.conf.php
chmod o+w /var/www/html/conf/zabbix.conf.php

启动httpd服务和zabbix服务

systemctl restart httpd
/usr/local/zabbix/sbin/zabbix_server

部署zabbix客户端

安装依赖包

yum install -y gcc gcc-c++ autoconf automake zlib zlib-devel openssl openssl-devel pcre pcre-devel net-snmp-devel libxml2-devel libcurl-deve libevent libevent-devel libcurl php-ldap curl-devel mysql-devel

解压依赖包并编译安装zabbix-agent

tar xf zabbix-3.4.3.tar.gz
cd zabbix-3.4.3/
./configure --prefix=/usr/local/zabbix --enable-server --enable-agent --with-mysql --enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2
make && make install

创建zabbix用户并授权

useradd -s /sbin/nologin zabbix
mkdir /usr/local/zabbix/logs
chown -R zabbix:zabbix /usr/local/zabbix

编辑zabbix客户端配置文件

vim /usr/local/zabbix/etc/zabbix_agentd.conf
Server=172.16.1.71 #指向服务端IP
ServerActive=172.16.1.71  #指向服务端IP
Hostname=web01  #本机主机名

启动zabbix服务

/usr/local/zabbix/sbin/zabbix_agentd

本站博主 , 版权所有丨如未注明 , 均为原创
转载请注明原文链接:大型企业架构部署之编译安装zabbix监控搭建流程【显哥出品,必为精品】
喜欢 (1)

您必须 登录 才能发表评论!

(1)个小伙伴在吐槽
  1. Reading your article helped me a lot and I agree with you. But I still have some doubts, can you clarify for me? I'll keep an eye out for your answers.