海运的博客

Centos下Nginx环境安装Nagios

发布时间:June 1, 2012 // 分类:Nagios // No Comments

首先Nginx需添加perl-fastcgi支持,请参考:http://www.haiyun.me/archives/nginx-perl-fastcgi.html
安装Nagios

#http://www.haiyun.me
useradd nagios
groupadd nagcmd
usermod -G nagcmd nagios
usermod -G nagcmd www
cd /usr/local/src/
wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-3.4.1.tar.gz
tar zxvf nagios-3.4.1.tar.gz 
cd nagios
./configure --with-command-group=nagcmd --prefix=/usr/local/nagios --with-nagios-user=nagios --with-nagios-group=nagios 
make all
make install
make install-init
make install-config
make install-commandmode
cd ../
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
./configure --with-nagios-user=nagios --with-nagios-group=nagios --prefix=/usr/local/nagios
make
make install
ln -s  /usr/local/nagios/share/  /home/wwwroot/nagios.www.haiyun.me
/etc/init.d/nagios start

Nginx配置:

server
    {
        listen       80;
        server_name nagios.www.haiyun.me;
        root  /home/wwwroot/nagios.www.haiyun.me;
                index index.php;
 
                auth_basic "Login";
                auth_basic_user_file /home/wwwroot/nagios.www.haiyun.me/passwd;
                location ~ .*\.cgi?$
                {
                root /usr/local/nagios/sbin;
                rewrite ^/nagios/cgi-bin/(.*)\.cgi /$1.cgi break;
                fastcgi_pass  unix:/tmp/perl-fastcgi.sock;
                fastcgi_index index.cgi;
                fastcgi_param   SCRIPT_FILENAME  $document_root$fastcgi_script_name;  
                include         fastcgi_params;  
                }
                location ~ .*\.(php|php5)?$
                        {
                                fastcgi_pass  unix:/tmp/php-cgi.sock;
                                fastcgi_index index.php;
                                include fcgi.conf;
                        }
                access_log none;
}

配置Nginx验证:

perl -e 'print crypt($ARGV[0], "pwdsalt")' passwd;echo
#生成passwd加密字符,将结果以user:passwd的方式填入/home/wwwroot/nagios.www.haiyun.me/passwd

标签:lnmp, centos, 服务器监控, nagios, lnmp安装nagios

评论已关闭

分类
最新文章
最近回复
  • 海运: 正常情况下编译整个内核执行make menuconfig后就不会出现此提示,当单独编译单个模块...
  • oijq: 就是用的armbian的配置文件哈,按你的教程做的,在执行make LOCALVERSION=...
  • 海运: 使用armbian的配置文件,其它添加或修改自己懂的部分,不懂的就不要碰了。
  • oijq: 编译时这些选项全部选Y吗?Actions Semi Platforms (ARCH_ACTIO...
  • 海运: n1编译bbr内核模块参考这个:https://www.haiyun.me/archives/...
  • jiqz: make M=net/ipv4/ CONFIG_TCP_CONG_BBR=m modules编...
  • ruralhunter: 哦,文档里应该是对的,是.config
  • ruralhunter: cp /mnt/boot/config-4.18.7-aml-s9xxx .config这里应...
  • 海运: 你是编译不成功呢?还是编译后不能运行呢?还是运行后不能访问web界面呢?
  • 白墨: 可能不清楚就是编译安装后启动后访问不了web界面