码迷,mamicode.com
首页 > 其他好文 > 详细

zabbix的部署

时间:2018-03-06 12:02:45      阅读:255      评论:0      收藏:0      [点我收藏+]

标签: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

[root@room1pc21 zabbix]# vim /apps/srv/zabbix/etc/zabbix_server.conf

DBUser=root
BPassword=hpf123

[root@room1pc21 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的部署练习

原文地址:http://blog.51cto.com/45545613/2083363

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!