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

zabbix4.0构建实录

时间:2018-11-16 19:12:59      阅读:213      评论:0      收藏:0      [点我收藏+]

标签:ted   init   数据库   进程数量   keepalive   pre   snmp   with   mcrypt   

【Nginx】

#wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo

[root@centos ~]# yum -y install zlib pcre pcre-devel openssl openssl-devel
[root@centos ~]# useradd -s /sbin/nologin nginx

[root@zabbix-server ~]# yum install -y nginx

【Mysql数据库部署】

# wget https://repo.mysql.com/mysql57-community-release-el7.rpm

# rpm -ivh mysql57-community-release-el7.rpm

[root@zabbix-server ~]# yum install mysql-server mysql mysql-devel

[root@zabbix-server ~]# systemctl start mysqld
[root@zabbix-server ~]# grep "password" /var/log/mysqld.log 
2018-10-23T00:47:33.152924Z 1 [Note] A temporary password is generated for root@localhost: 3e/=lUA;7#+B

mysql> alter user user() identified by 123456.Bxy;
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

【注意】

如果不更改密码的话,无法执行任何sql语句,会报错如下:同时要满足密码策略,如果非要修改简单的密码,可以对策略进行修改:

mysql> use mysql;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.

mysql> alter user user() identified by 123456.Bxy;   #注意,授权root密码必须要满足四种不同字符:否则修改失败~
Query OK, 0 rows affected (0.00 sec)


现在想要将密码策略修改一下,密码长度改成六位数;密码复杂度不要那么复杂,直接修改成123456即可

首先要修改set global validate_password_policy=0

第二要修改密码长度为6

set global validate_password_length=6;

【php安装】

#yum -y install libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel curl curl-devel openssl openssl-devel openldap openldap-devel

# wget http://soft.y100edu.net/php/php-7.2.11.tar.gz
#tar zxvf php-7.2.11.tar.gz -C /usr/src/

#cd /usr/src/php-7.2.11/

#./configure --prefix=/usr/local/php --with-config-file-scan-dir=/etc/php.d --with-config-file-path=/etc --with-mysqli=/usr/bin/mysql_config --enable-mbstring --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --with-openssl -enable-xml --enable-sockets --enable-fpm --with-mcrypt --with-bz2 --with-curl --enable-bcmath --with-gettext --with-pcre-regex --enable-xml --enable-fpm --with-imap-ssl --with-mhash --with-xmlrpc --with-gd

#make test
#make install

#cp php.ini-production /etc/php.ini

post_max_size = 16M
max_execution_time = 300
memory_limit = 128M
max_input_time = 300
date.timezone = Asia/Shanghai

 

#cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf

#cp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/www.conf

[root@zabbix-server php-7.2.11]# cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm

整合lnmp环境

[root@zabbix-server conf]# egrep -v "#|^$" /etc/nginx/nginx.conf
worker_processes  1;
events {
    worker_connections  1024;
}
http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    keepalive_timeout  65;
    server {
        listen       80;
        server_name  localhost;
        location / {
            root   /var/www/html/;
            index index.php index.html index.htm;
        }
           location ~ \.php$ {
             root           /var/www/html;
               fastcgi_pass   127.0.0.1:9000;
               fastcgi_index  index.php;
               fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
               include        fastcgi_params;
           }
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    }
}

 

[Zabbix部署]

[root@zabbix-server ~]# yum -y install net-snmp net-snmp-devel curl curl-devel libxml2 libevent libevent-devel

[root@zabbix-server ~]# cd /usr/src/zabbix-4.0.1/
[root@zabbix-server zabbix-4.0.1]# ./configure --prefix=/usr/local/zabbix --with-mysql --with-net-snmp --with-libcurl --enable-server --enable-agent --enable-proxy --with-libxml2

[root@zabbix-server zabbix-4.0.1]# make 

[root@zabbix-server zabbix-4.0.1]# make install

[root@zabbix-server conf]# ln -s /usr/local/zabbix/sbin/zabbix_server /usr/local/sbin/

LogFile=/var/log/zabbix/zabbix_server.log     #zabbix server日志输出位置
DBHost=localhost     #指定数据库地址,如果数据库在本机,默认即可
DBName=zabbixDB      #数据库名称
DBUser=zabbix        #连接数据库用户名称
DBPassword=123456.Bxy     #连接数据库对应的用户密码
StartPollers=5          #用于设置zabbix服务启动pollers(主动收集数据进程数),数值越大,则服务器吞吐量越大,但是对系统资源消耗很大
StartTrappers=5          #用于设置zabbix server启动时启动Trappers(负责处理agent推送过来的数据进程数量),Agent为主动模式时,该值需要设置大一些
StartDiscoverers=10       #用于设置zabbix server服务启动时启动的Discovers(发现)进程数量,如果discoveres进程忙时,需要提高数值
ListenIP=0.0.0.0       
Timeout=4
AlertScriptsPath=/usr/local/zabbix/share/zabbix/alertscripts    #存放zabbix server运行脚本
LogSlowQueries=3000    

 

mysql> create database zabbixDB charset=utf8;
Query OK, 1 row affected (0.01 sec)

mysql> grant all privileges on zabbixDB.* to zabbix@‘localhost‘ identified by ‘123.com‘;
Query OK, 0 rows affected, 1 warning (0.06 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

[root@zabbix_server mysql]# mysql -uzabbix -p123.com  zabbixDB < schema.sql 
[root@zabbix_server mysql]# mysql -uzabbix -p123.com zabbixDB < images.sql 
[root@zabbix_server mysql]# mysql -uzabbix -p123.com zabbixDB < data.sql 

root@zabbix-server mysql]# \cp -a /usr/src/zabbix-4.0.1/frontends/php/*   /var/www/html/

[root@zabbix-server mysql]# cp /usr/src/zabbix-4.0.1/misc/init.d/tru64/zabbix_* /etc/init.d/
[root@zabbix-server mysql]# chmod +x /etc/init.d/ -R

[root@zabbix-server mysql]# /etc/init.d/zabbix_server start

技术分享图片

技术分享图片

技术分享图片

技术分享图片

技术分享图片

技术分享图片

[root@zabbix-server ~]# cd /var/www/html/conf/

[root@zabbix-server conf]# mv zabbix.conf_\(3\).php zabbix.conf.php

技术分享图片

 

技术分享图片

 

zabbix4.0构建实录

标签:ted   init   数据库   进程数量   keepalive   pre   snmp   with   mcrypt   

原文地址:https://www.cnblogs.com/bixiaoyu/p/9966478.html

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