重慶分公司,新征程啟航
為企業(yè)提供網(wǎng)站建設(shè)、域名注冊(cè)、服務(wù)器等服務(wù)
為企業(yè)提供網(wǎng)站建設(shè)、域名注冊(cè)、服務(wù)器等服務(wù)
安裝配置nagios服務(wù)端:
安裝前的準(zhǔn)備工作
yum -y install httpd gcc glibc glibc-common gd gd-devel php php-mysql mysql mysql-devel mysql-server groupadd nagcmd useradd -G nagcmd nagios passwd nagios usermod -a -G nagcmd apache
vim /etc/httpd/conf/httpd.conf
DirectoryIndex index.php index.html index.html.var #找到這一行,添加index.php
編譯安裝nagios:
wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-4.0.5.tar.gz tar zxf nagios-4.0.5.tar.gz cd nagios-4.0.5 ./configure --with-command-group=nagcmd --enable-event-broker make all make install make install-init make install-commandmode make install-config
附:在解壓的時(shí)候如果提示下面的錯(cuò)誤,是因?yàn)橄到y(tǒng)時(shí)間不對(duì)
tar: nagios-4.0.5/xdata/xsddefault.c: time stamp 2014-04-12 02:37:42 is 250653.223481153 s in the future
tar: nagios-4.0.5/xdata/xsddefault.h: time stamp 2014-04-12 02:37:42 is 250653.223419364 s in the future
tar: nagios-4.0.5/xdata: time stamp 2014-04-12 02:37:42 is 250653.223359922 s in the future
修改系統(tǒng)時(shí)間
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
service ntpd stop
ntpdate asia.pool.ntp.org ; hwclock -w
需要在httpd的配置文件目錄(conf.d)中生成Nagios的Web程序配置文件,繼續(xù)在此編譯安裝目錄輸入一條命令:
# make install-webconf
創(chuàng)建一個(gè)登錄nagios web程序的用戶,這個(gè)用戶帳號(hào)在以后通過(guò)web登錄nagios認(rèn)證時(shí)所用:
# htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin #輸入登陸nagios的密碼
# service httpd restart
編譯、安裝nagios-plugins
nagios的所有監(jiān)控工作都是通過(guò)插件完成的,因此,在啟動(dòng)nagios之前還需要為其安裝官方提供的插件。http://exchange.nagios.org/directory/Plugins nagios插件鏈接
wget http://nagios-plugins.org/download/nagios-plugins-2.0.tar.gz tar zxf nagios-plugins-2.0.tar.gz cd nagios-plugins-2.0 ./configure --with-nagios-user=nagios --with-nagios-group=nagios make make install
配置并啟動(dòng)Nagios
# chkconfig --add nagios
# chkconfig nagios on
檢查其主配置文件
# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
# service nagios start
關(guān)閉selinux,
vim /etc/sysconfig/selinux 將其中的selinux后面的值“force”修改為“disable”或者
臨時(shí)性的改動(dòng)selinux也可以
# setenforce 0 # getenforce Permissive
或者將nagios的CGI程序運(yùn)行于SELinux/targeted模式而不用關(guān)閉selinux:
# chcon -R -t httpd_sys_content_t /usr/local/nagios/sbin
# chcon -R -t httpd_sys_content_t /usr/local/nagios/share
通過(guò)web界面查看nagios:
http://your_nagios_IP/nagios
輸入帳號(hào)和密碼
這時(shí)候可以看到本機(jī)的服務(wù)狀態(tài),如果沒有出現(xiàn)頁(yè)面,請(qǐng)檢查iptables的80端口是否開放
如果出現(xiàn)下面提示,說(shuō)明是selinux的問(wèn)題,setenforce 0即可
Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator, root@localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error. More information about this error may be available in the server error log.
安裝NRPE,服務(wù)端需要自己的check_nrpe,和被監(jiān)控端聯(lián)系
下載頁(yè)面
http://downloads.sourceforge.net/project/nagios/nrpe-2.x/nrpe-2.15/nrpe-2.15.tar.gz?r=&ts=1363788540&use_mirror=hivelocity
另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內(nèi)外云服務(wù)器15元起步,三天無(wú)理由+7*72小時(shí)售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國(guó)服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡(jiǎn)單易用、服務(wù)可用性高、性價(jià)比高”等特點(diǎn)與優(yōu)勢(shì),專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場(chǎng)景需求。