歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
您现在的位置: Linux教程網 >> UnixLinux >  >> Linux基礎 >> 關於Linux

Ubuntu中安裝Nginx+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=/usr/local/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=/usr/local/nagios

# make

# make install

3. nrpe安裝

# apt-get install libssl-dev

# wget http://sourceforge.net/projects/nagios/files/nrpe-2.x/nrpe-2.13/nrpe-2.13.tar.gz

# tar zxvf nrpe-2.12.tar.gz

# cd nrpe-2.12

# ./configure

# make all

# cp src/check_nrpe /usr/local/nagios/libexec/

4.安裝配置Nginx

#sudo apt-get install nginx php5-fpm libssl-dev fcgiwrap apache2

# htpasswd -c -m /usr/local/nagios/etc/nagiosAdmin.net nagiosadmin

# 啟動服務

# /etc/init.d/php5-fpm start

# /etc/init.d/fcgiwrap start        #默認是socket模式,socket文件在/var/run/fcgiwrap.socket

# /etc/init.d/nagios start

# /etc/init.d/nginx start

URL:http://www.bianceng.cn/OS/Linux/201410/46042.htm

nagios的完整WEB配置

     server {    
    listen          80;    
    server_name     1.1.1.2;    
    root            /usr/local/nagios/share;    
    index index.html index.htm index.php default.html default.htm default.php;    
        
    location ~ .*\.php?$ {    
            fastcgi_pass    127.0.0.1:9000;    
            fastcgi_index   index.php;    
            include fastcgi_params;    
            fastcgi_param SCRIPT_FILENAME /usr/local/nagios/share$fastcgi_script_name;    
            auth_basic      "nagios admin";    
            auth_basic_user_file    /usr/local/nagios/etc/nagiosAdmin.net;    
     }    
    location ~ .*\.cgi$ {    
            root    /usr/local/nagios/sbin;    
            rewrite ^/nagios/cgi-bin/(.*)\.cgi /$1.cgi break;    
            fastcgi_pass unix:/var/run/fcgiwrap.socket;    
            fastcgi_index index.cgi;    
            fastcgi_param SCRIPT_FILENAME /usr/local/nagios/sbin$fastcgi_script_name;    
            include fastcgi_params;    
            auth_basic      "nagios admin";    
            auth_basic_user_file    /usr/local/nagios/etc/nagiosAdmin.net;    
        
    }    
    location /nagios {    
            alias /usr/local/nagios/share;    
            auth_basic      "nagios admin";    
            auth_basic_user_file    /usr/local/nagios/etc/nagiosAdmin.net;    
        
    }    
    location ~ .*\.pl$ {    
            fastcgi_pass  unix:/var/run/fcgiwrap.socket;    
            fastcgi_index index.pl;    
            fastcgi_param SCRIPT_FILENAME  /usr/local/nagios/sbin$fastcgi_script_name;    
            include fastcgi_params;    
    }    
}

5、Nagios換主題

http://exchange.nagios.org/directory/Addons/Frontends-%28GUIs-and-CLIs%29/Web-Interfaces/Themes-and-Skins/Nuvola-Style/details

下載下來文件,然後解壓,把html重命名為share。覆蓋/usr/local/nagios/share即可,建立先備份原來的share。最終效果如下

URL:http://www.bianceng.cn/OS/Linux/201410/46042.htm

錯誤總結:

1、安裝nrpe的時候報錯

checking for SSL libraries... configure: error: Cannot find ssl libraries

解決辦法:

#dpkg -L libssl-dev         #找到libssl.so文件做個鏈接

root@node2:/usr/lib# ln -s /usr/lib/x86_64-linux-gnu/libssl.so /usr/lib/libssl.so

2、頁面提示

It appears as though you do not have permission to view information for any of the services you requested...

If you believe this is an error, check the HTTP server authentication requirements for accessing this CGI

and check the authorization options in your CGI configuration file.

解決辦法:

# vim /usr/local/nagios/etc/cgi.conf

use_authentication=1 #第78行,把1改為0

Copyright © Linux教程網 All Rights Reserved