当前位置:首页 > 系统运维 > 正文内容

Zabbix部署文档

zhangquanyu4年前 (2020-10-29)系统运维1429

一、数据库
(1)在RDS创建mysql数据库 
数据库名:zabbix
账户:zabbix
密码:
(2)自己安装mysql
  wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
  yum -y install mysql57-community-release-el7-10.noarch.rpm
  yum -y install mysql-community-server
  yum install mysql-devel -y
  
   vim /etc/my.cnf
[client]
default-character-set=utf8
 
[mysql]
default-character-set=utf8
 
 
[mysqld]
collation-server = utf8_unicode_ci
init-connect='SET NAMES utf8'
character-set-server = utf8
   
  systemctl start  mysqld.service
  
  grep "password" /var/log/mysqld.log
  
  mysql -uroot -p
  
  
  set global validate_password_policy=0;
  set global validate_password_length=1;
  
  ALTER USER 'root'@'localhost' IDENTIFIED BY '1q2w3e4r';
  
  create database zabbix CHARACTER SET utf8 COLLATE utf8_general_ci;
systemctl restart  mysqld.service
systemctl enable  mysqld.service
二、安装Nginx
安装依赖:
        yum -y install gcc automake autoconf libtool make gcc gcc-c++ git
        cd /usr/local/src 
        wget https://sourceforge.net/projects/pcre/files/pcre/8.34/pcre-8.34.tar.gz --no-check-certificate
        tar -zxvf pcre-8.34.tar.gz
        cd pcre-8.34
        ./configure && make && make install
     
         wget https://sourceforge.net/projects/libpng/files/zlib/1.2.11/zlib-1.2.11.tar.gz  --no-check-certificate
        tar -zxvf zlib-1.2.11.tar.gz
        cd zlib-1.2.11
        ./configure && make && make install
        wgethttps://www.openssl.org/source/old/1.0.1/openssl-1.0.1c.tar.gz
        tar -zxvf openssl-1.0.1c.tar.gz
               安装nginx (/data/tools)
       
        wget http://nginx.org/download/nginx-1.10.1.tar.gz
        tar -zxvf nginx-1.10.1.tar.gz
        cd nginx-1.10.1
        ./configure --prefix=/usr/local/nginx \
        --with-http_ssl_module \
        --with-pcre=/usr/local/src/pcre-8.34 \
        --with-zlib=/usr/local/src/zlib-1.2.11 \
        --with-openssl=/usr/local/src/openssl-1.0.1c \
         --with-http_dav_module --with-http_stub_status_module --with-http_addition_module --with-http_sub_module  --with-http_flv_module --with-http_mp4_module   --with-http_gzip_static_module
        make
        make install
三、安装php
    
yum -y install epel-release
yum -y install libmcrypt libmcrypt-devel mcrypt mhash
yum -y install libxml2-devel libpng-devel libjpeg-devel zlib bzip2 bzip2-devel libtool-ltdl-devel pcre-devel openssl-devel freetype-devel libcurl-devel icu perl-libintl postgresql libicu-devel
wget https://www.php.net/distributions/php-5.6.40.tar.gz
cd /usr/local/src/
cd php-5.6.27
./configure --prefix=/usr/local/php --with-config-file-path=/etc   --with-gd --with-iconv --with-libxml-dir=/usr --with-mhash --with-mcrypt --with-config-file-scan-dir=/etc/php.d --with-bz2 --with-zlib --with-freetype-dir --with-png-dir --with-jpeg-dir --enable-xml --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --enable-mbregex --enable-fpm --enable-mbstring --enable-ftp --enable-gd-native-ttf --with-openssl --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-gettext --enable-session --with-mcrypt --with-curl --with-pdo-mysql=mysqlnd --with-mysqli=mysqlnd --with-mysql=mysqlnd
make 
make install
cp php.ini-production /etc/php.ini
找到:
;date.timezone = 
修改为:
date.timezone = PRC #设置时区
找到:
expose_php = On 
修改为:
expose_php = Off #禁止显示php版本的信息
找到:
short_open_tag = Off 
修改为:
short_open_tag = On //支持php短标签
找到:
post_max_size = 8M
修改为:
post_max_size = 16M  //上传文件大小
找到:
max_execution_time = 30
修改为:
max_execution_time = 300  //php脚本最大执行时间
找到:
max_input_time = 60
修改为:
max_input_time = 300  //以秒为单位对通过POST、GET以及PUT方式接收数据时间进行限制
always_populate_raw_post_data = -1
mbstring.func_overload = 0
 
cp -ar /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
pid = run/php-fpm.pid
listen =127.0.0.1:9000
pm.max_children = 300
pm.start_servers = 10
pm.min_spare_servers = 10
pm.max_spare_servers =50
/usr/local/php/sbin/php-fpm
    
四、编译安装Zabbix3.2.1
useradd zabbix
yum install -y net-snmp net-snmp-devel curl-devel java-1.8.0-openjdk java-1.8.0-openjdk-devel  OpenIPMI-devel  libssh2-devel
wget http://fping.org/dist/fping-3.10.tar.gz
tar zxf fping-3.10.tar.gz
cd fping-3.10
./configure && make && make install
chown root:zabbix /usr/local/sbin/fping
chmod 4710 /usr/local/sbin/fping
tar -zxvf zabbix-3.2.1.tar.gz
cd zabbix-3.2.1
./configure --prefix=/usr/local/zabbix --enable-server --enable-agent --enable-java --with-mysql=/bin/mysql_config --with-net-snmp --with-libcurl --with-openipmi
make && make install
 cd database/mysql
mysql -uroot  -p'1q2w3e4r' zabbix < schema.sql
mysql -uroot  -p'1q2w3e4r' zabbix < images.sql
mysql -uroot  -p'1q2w3e4r' zabbix < data.sql
vim /usr/local/zabbix/etc/zabbix_server.conf
LogFile=/usr/local/zabbix/logs/zabbix_server.log
PidFile=/usr/local/zabbix/logs/zabbix_server.pid
DBHost=localhost
DBName=zabbix
DBUser=root
DBPassword=1q2w3e4r
DBPort=3306
FpingLocation=/usr/local/sbin/fping
mkdir -p /usr/local/zabbix/logs
   chown -R zabbix:zabbix /usr/local/zabbix/
   cp misc/init.d/fedora/core/zabbix_server /etc/rc.d/init.d/zabbix_server
   cp misc/init.d/fedora/core/zabbix_agentd /etc/rc.d/init.d/zabbix_agentd
vi /etc/rc.d/init.d/zabbix_server
BASEDIR=/usr/local/zabbix/ #zabbix安装目录
PIDFILE=/usr/local/zabbix/logs/$BINARY_NAME.pid    #pid文件路径
vi /etc/rc.d/init.d/zabbix_agentd #编辑客户端配置文件
BASEDIR=/usr/local/zabbix/ #zabbix安装目录
PIDFILE=/usr/local/zabbix/logs/$BINARY_NAME.pid  #pid文件路径
   chmod +x /etc/rc.d/init.d/zabbix_server
   chmod +x /etc/rc.d/init.d/zabbix_agentd
  
  
   /etc/init.d/zabbix_server start
 /etc/init.d/zabbix_agentd start
   chkconfig --add zabbix_server
   chkconfig --add zabbix_agentd
   chkconfig zabbix_server on
   chkconfig zabbix_agentd on
cp -r frontends/php/ /usr/local/nginx/html/zabbix
chmod 777 /usr/local/nginx/html/zabbix -R
vim /usr/local/nginx/conf/zabbix.conf
server {
        listen       80;
        server_name zabbix.iwommaster.com;
        index index.html index.php index.html;
        root /usr/local/nginx/html/zabbix;
        location /
        {
                try_files $uri $uri/ /index.php?$args;
        }
        location ~ ^(.+.php)(.*)$ {
                fastcgi_split_path_info ^(.+.php)(.*)$;
                include fastcgi.conf;
                fastcgi_pass  127.0.0.1:9000;
                fastcgi_index index.php;
                fastcgi_param  PATH_INFO          $fastcgi_path_info;
        }
}
/usr/local/nginx/sbin/nginx  -s reload
五、zabbix_agentd安装
    
 tar -xzvf cd zabbix-3.2.1tar.gz
cd cd zabbix-3.2.1
./configure --prefix=/usr/local/zabbix-agentd --enable-agent
 make
make install
 zabbix客户端配置:
vim /usr/local/zabbix-agentd/etc/zabbix_agentd.conf
Server=127.0.0.1
ServerActive=127.0.0.1
Hostname=
其中Server和ServerActive都指定zabbixserver的IP地址,不同的是,前者是被动后者是主动。也就是说Server这个配置是用来允许127.0.0.1这个ip来我这取数据。而serverActive的127.0.0.1的意思是,客户端主动提交数据给他。
useradd zabbix
cp misc/init.d/fedora/core/zabbix_agentd /etc/rc.d/init.d/zabbix_agentd
vi /etc/rc.d/init.d/zabbix_agentd #编辑客户端配置文件
BASEDIR=/usr/local/zabbix-agentd/  #zabbix安装目录
PIDFILE=/usr/local/zabbix-agentd/logs/$BINARY_NAME.pid  #pid文件路径
mkdir -p /usr/local/zabbix-agentd/logs
   chown -R zabbix:zabbix /usr/local/zabbix-agentd/
 chmod +x /etc/rc.d/init.d/zabbix_agentd
 /etc/init.d/zabbix_agentd start
 chkconfig --add zabbix_agentd
 
   chkconfig zabbix_agentd on


扫描二维码推送至手机访问。

版权声明:本文由张权予博客发布,如需转载请注明出处。

本文链接:https://zhangquanyu.com/?id=13

标签: zabbix
分享给朋友:
返回列表

上一篇:Jenkins配置Ansible

没有最新的文章了...

“Zabbix部署文档” 的相关文章

CentOS7安装Rancher并部署kubernetes

CentOS7安装Rancher并部署kubernetes

setenforce 0 sudo sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config systemctl stop fire...