首先說下自己的搭建環(huán)境。RedHat6.4系統(tǒng) nagios-4.0.7。關(guān)閉selinux和iptables服務(wù)
創(chuàng)新互聯(lián)建站網(wǎng)站建設(shè)公司,提供成都做網(wǎng)站、網(wǎng)站制作、成都外貿(mào)網(wǎng)站建設(shè),網(wǎng)頁(yè)設(shè)計(jì),建網(wǎng)站,PHP網(wǎng)站建設(shè)等專業(yè)做網(wǎng)站服務(wù);可快速的進(jìn)行網(wǎng)站開發(fā)網(wǎng)頁(yè)制作和功能擴(kuò)展;專業(yè)做搜索引擎喜愛的網(wǎng)站,是專業(yè)的做網(wǎng)站團(tuán)隊(duì),希望更多企業(yè)前來合作!
1,準(zhǔn)備工作,安裝好nagios所需要的軟件
Apache
PHP
GCC compiler
GD development libraries
yum install httpd php gcc glibc glibc-common gd gd-devel
2,創(chuàng)建nagios使用的賬號(hào)和組,首先要切換成管理員賬號(hào)
[root@localhost ~]useradd -m nagios
[root@localhost ~]echo nagios |passwd --stdin nagios
[root@localhost ~]# groupadd nagcmd
[root@localhost ~]# usermod -aG nagcmd nagios
[root@localhost ~]# usermod -aG nagcmd apache
3,下載nagios和nagio-plugin
[root@localhost ~]#wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-3.2.3.tar.gz
[root@localhost ~]#wget http://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.11.tar.gz
4,編譯安裝(Install binaries, init script, sample config files and set permissions on the external command directory.)
[root@localhost ~]#./configure --with-command-group=nagcmd
[root@localhost ~]#make all
[root@localhost ~]#make install
[root@localhost ~]#make install-init
[root@localhost ~]#make install-config
[root@localhost ~]#make install-commandmodes
[root@localhost ~]#make install-commandmode
5,自定義配置文件
[root@localhost ~]#vim /usr/local/nagios/etc/objects/contacts.cfg
配置管理員的郵箱地址,當(dāng)監(jiān)控到有問題時(shí)會(huì)發(fā)送郵件到管理員郵箱 6,配置web界面管理接口,并創(chuàng)建登陸到nagios管理界面的賬號(hào)密碼,然后重啟Apache服務(wù),使配置文件生效 [root@localhost ~]#make install-webconf [root@localhost ~]#htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin //htpasswd.users的文件名稱一定要寫正確 [root@localhost ~]#service httpd restart 7,編譯安裝nagios-plugin [root@localhost ~]#tar -zxvf nagios-plugins-2.0.3.tar.gz -C /usr/src/ [root@localhost ~]#cd /usr/src/nagios-plugins-2.0.3/ [root@localhost ~]#ls [root@localhost ~]#./configure --with-nagios-user=nagios --with-nagios-group=nagios [root@localhost ~]#make [root@localhost ~]#make install [root@localhost ~]#cd [root@localhost ~]#chkconfig --add nagios [root@localhost ~]#chkconfig nagios on [root@localhost ~]#service nagios start [root@localhost ~]#service nagios restart [root@localhost ~]#/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg //檢查配置文件是否有錯(cuò)誤或者警告,如果沒有的話啟動(dòng)nagios服務(wù) [root@localhost ~]#service nagios start 7,現(xiàn)在我們就可以測(cè)試nagios監(jiān)控本機(jī)localhost的情況了,登陸 server ip/nagios 進(jìn)去之后會(huì)讓你輸入方才htpasswd創(chuàng)建的用戶名和密碼(藍(lán)色邊框) 我擦,圖片怎么上傳不了呀?上傳不了圖片就算了。