zabbix的部署

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了zabbix的部署相关的知识,希望对你有一定的参考价值。

系统环境:Centos7.2
zabbix版本:3.4.6
php、zabbix等rpm
php-bcmath-5.4.45-13.el7.remi.x86_64.rpm
php-mbstring-5.4.45-13.el7.remi.x86_64.rpm
zabbix.3.4.6.tar.gz


mkdir -p /apps/{srv,package,log,webroot}
cd /etc/yum.repo.d/
mkdir backup
mv ./*.repo backup/
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo

yum clean all
yum -y install nginx mariadb*
rpm -ivh /apps/package/php-fpm-7.1.10-2.x86_64.rpm

yum -y install libedit-devel libxml2-devel bzip2-devel libcurl-devel libjpeg-devel libpng-devel freetype-devel gmp-devel libmcrypt libmcrypt-devel readline-devel libxslt-devel ImageMagick-devel cyrus-sasl-devel gcc-c++ automake autoconf ImageMagick libmemcached-devel

rpm -ivh /apps/package/php-fpm-7.1.10-2.x86_64.rpm
rpm -ivh /apps/package/zabbix-server-3.4.6-1.x86_64.rpm
yum -y install unixODBC-devel net-snmp-devel OpenIPMI-devel libevent-devel libssh2-devel openldap-devel
rpm -ivh /apps/package/zabbix-server-3.4.6-1.x86_64.rpm
cp -r /apps/srv/zabbix/php /apps/webroot/zabbix
cp /apps/srv/zabbix/init.d/* /etc/init.d/
systemctl start mariadb
mysqladmin -uroot -p password hpf123456

cd /apps/srv/zabbix/mysql
mysql -uroot -phpf123

create database zabbix default charset utf8;
use zabbix;
source schema.sql;
source images.sql;
source data.sql;
show tables;
exit

useradd zabbix

chown -R nobody. /apps/webroot/zabbix

mkdir /apps/log/{zabbix,nginx}

chown -R zabbix. /apps/log/zabbix

vim /etc/nginx/conf.d/zabbix.conf
server {
listen 80;
server_name zabbix.tedu.cn;
root /apps/webroot/zabbix;
index index.php;
access_log /apps/log/nginx/zabbix.access.log main;
error_log /apps/log/nginx/zabbix.error.log;
location ~ .php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_connect_timeout 6000;
fastcgi_send_timeout 6000;
fastcgi_read_timeout 6000;
proxy_connect_timeout 600;
proxy_read_timeout 600;
proxy_send_timeout 600;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}

vim /apps/srv/php-fpm/etc/php.ini
max_execution_time = 300
max_input_time = 300
nginx -t #停止nginx
nginx #启动nginx
nginx -s reload #重启nginx
/etc/init.d/php-fpm start
/etc/init.d/zabbix_server start

vim /etc/hosts
127.0.0.1 zabbix.tedu.cn

访问 http:// zabbix.tedu.cn

[[email protected] zabbix]# vim /apps/srv/zabbix/etc/zabbix_server.conf

DBUser=root
BPassword=hpf123

[[email protected] zabbix]# /apps/srv/zabbix/sbin/zabbix_server -c /apps/srv/zabbix/etc/zabbix_server.conf

设置监控本机:
#vim /etc/zabbix/zabbix_agentd.conf
30 LogFile=/tmp/zabbix_agentd.log
91 Server=127.0.0.1
132 ServerActive=127.0.0.1:10051
:x

#systemctl status zabbix-agent

#/etc/init.d/zabbix_agentd start###这样不行的话应该是源码编译的时候没添加agent功能 另外安装要用上面的方法

以上是关于zabbix的部署的主要内容,如果未能解决你的问题,请参考以下文章

最全的zabbix部署(Serveragentproxy)

Zabbix实战之部署篇使用Docker部署Zabbix 6.2.7监控平台

zabbix部署的三大组件

zabbix监控之zabbix源码部署 (安装篇)

Zabbix 监控服务介绍

Saltstack批量安装部署Zabbix代理(附zabbix自动注册详解)