1. nagios安装# wgethttp://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插件安装# wgethttp://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
序列号 | CPU | RAM | HDD | 带宽 | 售价(美元) | 免费试用 |
---|---|---|---|---|---|---|
香港服务器1 | E5-2620 | 32G | 1T HDD | 50M/无限流量 | $196.00 | 立即申请 |
香港服务器2 | E5-2650 | 32G | 1T HDD | 50M/无限流量 | $256.00 | 立即申请 |
香港服务器3 | E5-2680 | 32G | 1T HDD | 50M/无限流量 | $316.00 | 立即申请 |
香港服务器4 | E5-2690 | 32G | 1T HDD | 50M/无限流量 | $336.00 | 立即申请 |
香港服务器5 | E5-2697 | 32G | 1T HDD | 50M/无限流量 | $376.00 | 立即申请 |
香港服务器6 | E5-2620*2 | 32G | 1T HDD | 50M/无限流量 | $376.00 | 立即申请 |
香港服务器7 | E5-2650*2 | 32G | 1T HDD | 50M/无限流量 | $436.00 | 立即申请 |
香港服务器8 | E5-2680*2 | 32G | 1T HDD | 50M/无限流量 | $476.00 | 立即申请 |
香港服务器9 | E5-2690*2 | 32G | 1T HDD | 50M/无限流量 | $556.00 | 立即申请 |
香港服务器10 | E5-2697*2 | 32G | 1T HDD | 50M/无限流量 | $596.00 | 立即申请 |
香港服务器11 | E5-2680v4*2 | 32G | 1T HDD | 50M/无限流量 | $696.00 | 立即申请 |
香港服务器12 | E5-2698v4*2 | 32G | 1T HDD | 50M/无限流量 | $796.00 | 立即申请 |
3. nrpe安装# apt-get install libssl-dev# wgethttp://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 fcgiwrapapache2# htpasswd -c -m /usr/local/nagios/etc/nagiosAdmin.netnagiosadmin# 启动服务# /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
nagios的完整WEB配置
server{listen80;server_name1.1.1.2;root/usr/local/nagios/share;indexindex.htmlindex.htmindex.phpdefault.htmldefault.htmdefault.php;location~.*.php?${fastcgi_pass127.0.0.1:9000;fastcgi_indexindex.php;includefastcgi_params;fastcgi_paramSCRIPT_FILENAME/usr/local/nagios/share$fastcgi_script_name;auth_basic"nagiosadmin";auth_basic_user_file/usr/local/nagios/etc/nagiosAdmin.net;}location~.*.cgi${root/usr/local/nagios/sbin;rewrite^/nagios/cgi-bin/(.*).cgi/$1.cgibreak;fastcgi_passunix:/var/run/fcgiwrap.socket;fastcgi_indexindex.cgi;fastcgi_paramSCRIPT_FILENAME/usr/local/nagios/sbin$fastcgi_script_name;includefastcgi_params;auth_basic"nagiosadmin";auth_basic_user_file/usr/local/nagios/etc/nagiosAdmin.net;}location/nagios{alias/usr/local/nagios/share;auth_basic"nagiosadmin";auth_basic_user_file/usr/local/nagios/etc/nagiosAdmin.net;}location~.*.pl${fastcgi_passunix:/var/run/fcgiwrap.socket;fastcgi_indexindex.pl;fastcgi_paramSCRIPT_FILENAME/usr/local/nagios/sbin$fastcgi_script_name;includefastcgi_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。最终效果如下
错误总结:
1、安装nrpe的时候报错
checking for SSL libraries... configure: error: Cannot find ssllibraries
解决办法:
#dpkg -L libssl-dev #找到libssl.so文件做个链接
[email protected]:/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 viewinformation for any of the services you requested...
If you believe this is an error, check the HTTP serverauthentication requirements for accessing this CGIand check the authorization options in your CGI configurationfile.
解决办法:
# vim /usr/local/nagios/etc/cgi.conf
use_authentication=1 #第78行,把1改为0