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

zabbix-3.4.6安装

时间:2018-02-07 14:58:52      阅读:690      评论:0      收藏:0      [点我收藏+]

标签:pmi   ima   pass   代理   evel   12px   plain   php7   dbus   


先安装myql和php
mysql5.7.17: http://www.cnblogs.com/cjsblogs/p/8116782.html

php7.2.1: http://www.cnblogs.com/cjsblogs/p/8116782.html

安装zabbix
# tar -zxf zabbix-3.4.6.tar.gz
# cd zabbix-3.4.6

# mkdir -p /usr/local/zabbix/logs
# ./configure --prefix=/usr/local/zabbix --with-mysql=/usr/local/mysql/bin/mysql_config --with-net-snmp --enable-server --enable-agent --enable-proxy --with-libcurl --with-ssh2 --with-openipmi --with-unixodbc --enable-java

make && make install

  

创建zabbix用户和用户组

# groupadd zabbix
# useradd -r -g zabbix zabbix
# cd /usr/local && chown -R zabbix:zabbix zabbix

  


创建zabbix数据库,并导入表结构
# mysql -uroot -p
mysql> create database if not exists zabbix default character set utf8 collate utf8_general_ci;
mysql> use zabbix;
mysql> source /tmp/zabbix-3.4.6/database/mysql/schema.sql;
mysql> source /tmp/zabbix-3.4.6/database/mysql/images.sql;
mysql> source /tmp/zabbix-3.4.6/database/mysql/data.sql;

 

修改zabbix_server.conf

LogFile=/usr/local/zabbix/logszabbix_server.log
LogFileSize=50
PidFile=/usr/local/zabbix/etc/zabbix_server.pid
SocketDir=/var/run/zabbix
DBName=zabbix
DBPassword=zabbix
DBUser=zabbix
SNMPTrapperFile=/var/log/snmptrap/snmptrap.log
Timeout=4
AlertScriptsPath=/usr/lib/zabbix/alertscripts
ExternalScripts=/usr/lib/zabbix/externalscripts
LogSlowQueries=3000

  

启动zabbix_server 

# ln -s /usr/local/mysql/lib/libmysqlclient.so.20 /usr/lib/
# ldconfig
# /usr/local/zabbix/sbin/zabbix_server

 

 

安装NGINX

yum install -y gcc openssl-devel pcre-devel

mkdir -p /usr/local/nginx/html

tar -xf tengine-2.1.2.tar.gz
cd tengine-2.1.2
./configure --prefix=/usr/local/nginx --with-http_ssl_module --with-http_stub_status_module

make:
make install

  

修改配置文件

#user  ops;
worker_processes  auto;
worker_cpu_affinity auto;

error_log  logs/error.log  error;

pid        logs/nginx.pid;

worker_rlimit_nofile 65535;

events {
	use epoll;
    worker_connections  65535;
}


http {
    include       mime.types;
    default_type  application/octet-stream;
    log_format  main  ‘$remote_addr - $remote_user [$time_local] "$request" ‘
                      ‘$status $body_bytes_sent "$http_referer" ‘
                      ‘"$http_user_agent" "$http_x_forwarded_for"‘;

	log_format  json  ‘{"@timestamp":"$time_iso8601",‘
                      ‘"remote_addr":"$remote_addr",‘
                      ‘"remote_user":"$remote_user",‘
                      ‘"http_host":"$http_host",‘
                      ‘"request":"$request",‘
                      ‘"status":"$status",‘
                      ‘"body_bytes_sent":$body_bytes_sent,‘
                      ‘"http_referer":"$http_referer",‘
                      ‘"http_user_agent":"$http_user_agent",‘
                      ‘"http_x_frowarded_for":"$http_x_forwarded_for",‘
   		      ‘"upstream_status":"$upstream_status",‘
                      ‘"upstream_addr":"$upstream_addr",‘
                      ‘"upstream_response_time":"$upstream_response_time",‘
                      ‘"request_time":$request_time}‘;


    access_log  logs/access.log  json;

    sendfile        on;
    #tcp_nopush     on;

    keepalive_timeout  65;

    client_header_buffer_size    20m;
    large_client_header_buffers  4 2048k;
    client_max_body_size 20m;
    proxy_buffer_size 64k;
    proxy_buffers   4 32k;
    proxy_busy_buffers_size 64k;
    proxy_temp_file_write_size 64k;

    proxy_ignore_client_abort  on;  #让代理服务端不要主动关闭客户端的连接。

    gzip  on;
    gzip_min_length 1k;
    gzip_buffers 4 16k;
    gzip_http_version 1.1;
    gzip_comp_level 2;
    gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript image/jpeg image/gif image/png application/javascript;
    gzip_proxied any;
    gzip_disable "MSIE [1-6]\.";

server {
        listen 80 default;
        server_name _;
        return 499;
        }

include /usr/local/nginx/conf/vhosts/*.conf;
}

 

配置zabbix.conf

mkdir -p /usr/local/nginx/conf/vhosts

cd /usr/local/nginx/conf/vhosts
vim zabbix.conf
server {
    listen 80;
    server_name 10.19.65.67;
    root /usr/local/nginx/html/zabbix;
    index index.html index.htm index.php;

    location ~* ^.+\.(js|ico|gif|jpg|jpeg|pdf|png|css|swf)$ {
         expires      30d;
         access_log   off;
         }

    location ~ ^/.*\.php?$ {
         include fcgi.conf;
         fastcgi_pass 127.0.0.1:9000;
         fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
         include        fastcgi_params;
         }
}

 

拷贝网页文件到 nginx 目录

cp -r ~/zabbix-3.4.6/frontends/php/ /usr/local/nginx/html/zabbix
chown -R www.www /usr/local/nginx/html/zabbix

 

启动nginx

 

/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf

 

  

 

zabbix-3.4.6安装

标签:pmi   ima   pass   代理   evel   12px   plain   php7   dbus   

原文地址:https://www.cnblogs.com/cjsblogs/p/8425444.html

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