手机版
你好,游客 登录 注册 搜索
背景:
阅读新闻

安装部署分布式监控系统Zabbix 2.06

[日期:2013-07-06] 来源:zrwm.com  作者:Linux [字体: ]

Zabbix

  • 搭建环境说明

    A: 192.168.1.190, 系统CentOS 6.3,部署Zabbix Server, LEMP
    B: 192.168.1.191, 系统CentOS 6.3,部署Zabbix Agent, Nginx, MySQL, PHP, Redis, Memcached
    通过Zabbix Agent监控B机器的各项服务应用.

推荐阅读:

CentOS 6.3下Zabbix安装部署 http://www.linuxidc.com/Linux/2013-05/83786.htm

Zabbix分布式监控系统实践 http://www.linuxidc.com/Linux/2013-06/85758.htm

CentOS 6.3下Zabbix监控apache server-status http://www.linuxidc.com/Linux/2013-05/84740.htm

CentOS 6.3下Zabbix监控MySQL数据库参数 http://www.linuxidc.com/Linux/2013-05/84800.htm

更多关于ZABBIX 的详细信息,或者下载地址请点这里

  • Zabbix Server安装

    创建Zabbix运行的用户:

    # groupadd zabbix
    # useradd -g zabbix zabbix
    

    安装libcurl和net-snmp:

    # yum install net-snmp-devel curl-devel
    

    安装Fping:

    # wget -c http://fping.org/dist/fping-3.4.tar.gz
    # tar zxvf fping-3.4.tar.gz
    # cd fping-3.4
    # ./configure
    # make && make install
    # chown root:zabbix /usr/local/sbin/fping
    # chmod 4710 /usr/local/sbin/fping 
    

    安装Zabbix Server:

    # wget -c http://downloads.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/2.0.6/zabbix-2.0.6.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fzabbix%2F%3Fsource%3Ddlp&ts=1367916060&use_mirror=ncu
    # tar zxvf zabbix-2.0.6.tar.gz
    # cd zabbix-2.0.6
    # ./configure --prefix=/usr/local/zabbix --enable-server --enable-agent --with-mysql=/usr/local/mysql/bin/mysql_config --with-net-snmp --with-libcurl
    # make && make install
    
  • Zabbix Server配置与启动

    创建Zabbix数据库和MySQL用户:

    mysql> create schema zabbix character set utf8;
    Query OK, 1 row affected (0.05 sec)
    
    mysql> create user 'zabbix'@'%' identified by '123456';
    Query OK, 0 rows affected (0.16 sec)
    
    mysql> grant all on zabbix.* to 'zabbix'@'%';
    Query OK, 0 rows affected (0.03 sec)
    
    mysql> flush privileges;
    Query OK, 0 rows affected (0.04 sec)
    

    导入Zabbix初始数据:

    # cd database/mysql/
    # mysql -uroot -p
    mysql> set sql_log_bin=0;
    mysql> source ./schema.sql;
    mysql> source ./images.sql;
    mysql> source ./data.sql;
    mysql> set sql_log_bin=1;
    

    编辑/usr/local/zabbix/etc/zabbix_server.conf:

    LogFile=/usr/local/zabbix/logs/zabbix_server.log
    PidFile=/usr/local/zabbix/logs/zabbix_server.pid
    DBHost=192.168.1.190
    DBName=zabbix
    DBUser=zabbix
    DBPassword=123456
    DBPort=3306
    FpingLocation=/usr/local/sbin/fping
    

    从安装目录拷贝zabbix_server脚本,并编辑:

    # cd zabbix-2.0.6
    # cp misc/init.d/Fedora/core5/zabbix_server /etc/init.d/
    # mkdir -p /usr/local/zabbix/logs
    # chown -R zabbix:zabbix /usr/local/zabbix
    # vi /etc/init.d/zabbix_server
    # cat /etc/init.d/zabbix_server
    
    ...
    ZABBIX_BIN="/usr/local/zabbix/sbin/zabbix_server"
    CONF_FILE="/usr/local/zabbix/etc/zabbix_server.conf"
    ...
    start() {
            ...
            daemon $ZABBIX_BIN -c $CONF_FILE
            ...
    }
    

    调整防火墙规则(开放端口10051):

    # vi /etc/sysconfig/iptables
    ...                                                                                                           
    -A INPUT -p tcp -m state --state NEW -m tcp --dport 10051 -j ACCEPT
    ...
    # /etc/init.d/iptables restart
    

    启动Zabbix Server:

    # service zabbix_server start
    Starting Zabbix Server:                                    [  OK  ]
    

    停止Zabbix Server:

    # service zabbix_server stop
    Stopping Zabbix Server:                                    [  OK  ]
    

    配置开机自动启动:

    # chkconfig --add zabbix_server
    # chkconfig --level 35 zabbix_server on
    
  • Zabbix的Web前端

    在安装目录将frontends拷贝到指定的web root:

    # mkdir -p /data/www/zabbix
    # cd zabbix-2.0.6
    # cp -a frontends/php/* /data/www/zabbix/
    # chown -R www:www /data/www/zabbix
    

    Nginx配置:

    # cat /usr/local/nginx/conf/nginx.conf
    ...
    server {
        listen 80;
        server_name zabbix.zrwm.com;
        
        error_log logs/zabbix_error.log;
        access_log logs/zabbix_access.log;
    
        root /data/www/zabbix;
        index index.php index.html index.htm;
    
        location ~ \.php$ {
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            include        fastcgi_params;
        }
    }
    ...
    

    php.ini配置:

    ...
    memory_limit = 128M
    post_max_size = 16M
    max_execution_time = 300
    max_input_time = 300
    session.auto_start = 0  ;必须为0
    mbstring.func_overload = 2
    ...
    

    注:PHP需要至少开启扩展:gd,bcmath,ctype,libXML,xmlreader,xmlwriter,session,sockets,mbstring,gettext,mysql

    访问Web界面http://zabbix.zrwm.com,进行相关web配置,配置完成后使用默认用户admin(密码:zabbix)登陆即可.

    zabbix_web
    zabbix_web_dashboard 
linux
相关资讯       ZABBIX  分布式 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您��经阅读并接受上述条款