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

CentOS 5.5+Nginx+Nagios监控端和被控端安装配置指南

[日期:2011-09-27] 来源:Linux社区  作者:yuhaibao324 [字体: ]
一、nagios监控端安装
1. nagios安装
# wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-3.2.2.tar.gz
# tar zxvf nagios-3.2.2.tar.gz
# cd nagios-3.2.2
# useradd -m -s /bin/bash nagios
# groupadd nagios
# usermod -G nagios nagios
# groupadd nagcmd
# usermod -a -G nagcmd nagios
# usermod -a -G nagcmd www
# ./configure --prefix=/data/nagios --with-command-group=nagcmd
# make
# make all
# make install
# make install-init     # 生成init启动脚本
# make install-config     # 安装示例配置文件
# make install-commandmode     # 设置相应的目录权限
2. nagiox插件安装
# wget http://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.15.tar.gz
# tar zxvf nagios-plugins-1.4.15.tar.gz
# cd nagios-plugins-1.4.15
# ./configure --with-nagios-user=nagios --with-nagios-group=nagios --prefix=/data/nagios
# make
# make install
3. nrpe安装
# tar zxvf nrpe-2.12.tar.gz
# cd nrpe-2.12
# ./configure
# make all
# cp src/check_nrpe /data/nagios/libexec/
4. 配置
# 加入系统服务并设为开机自动
# chkconfig --add nagios
# chkconfig nagios on
# mkdir /data/nagios/var/rw
# chown nagios.nagios /data/nagios/var/rw
# 测试配置文件可用
# /data/nagios/bin/nagios -v /data/nagios/etc/nagios.cfg
# 取消用户认证(方便调试)
# vi /data/nagios/etc/cgi.cfg
找到use_authentication=1并把值改为0
# 修改联系人邮箱
# vi /data/nagios/etc/objects/contacts.cfg
# 定义check_nrpe命令
# vi /data/nagios/etc/objects/commands.cfg

define command{
command_name check_nrpe
command_line /data/nagios/libexec/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
}

# 启动服务
# service nagios start

5. nginx 配置
Nginx 的 cgi 支持参见 Nginx fastcgi perl (pl、cgi)支持 http://www.linuxidc.com/Linux/2011-09/44019.htm

server {
    listen       88;
    server_name  _;

    location / {
        root   /data/nagios/share;
        index  index.html index.htm index.php;
    }

    location ~ .*\.(php|php5)?$
    {
      root /data/nagios/share;
      fastcgi_pass  127.0.0.1:9000;
      fastcgi_index index.php;
      include fcgi.conf;
    }

    location /nagios {
        alias /data/nagios/share;
    }

    location /cgi-bin/images {
        alias /data/nagios/share/images;
    }

    location /cgi-bin/stylesheets {
        alias /data/nagios/share/stylesheets;
    }

    location /cgi-bin {
        alias /data/nagios/sbin;
    }

    location ~ .*\.(cgi|pl)?$
    {
      gzip off;
      root   /data/nagios/sbin;
      rewrite ^/nagios/cgi-bin/(.*)\.cgi /$1.cgi break;
      fastcgi_pass  unix:/data/nginx/logs/perl-fcgi.sock;
      fastcgi_index index.cgi;
      include fcgi.conf;
      fastcgi_read_timeout   60;
    }
}

linux
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

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