1. 程式人生 > >zabbix4.0構建實錄

zabbix4.0構建實錄

pre charset RoCE input roo must frontend 語句 ash

【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構建實錄