溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

nagios的搭建及配置----(上)

發(fā)布時間:2020-06-25 08:25:38 來源:網(wǎng)絡(luò) 閱讀:706 作者:皖教育廳長 欄目:移動開發(fā)

首先說下自己的搭建環(huán)境。RedHat6.4系統(tǒng) nagios-4.0.7。關(guān)閉selinux和iptables服務(wù)

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使用的賬號和組,首先要切換成管理員賬號

    [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

nagios的搭建及配置----(上)

配置管理員的郵箱地址,當(dāng)監(jiān)控到有問題時會發(fā)送郵件到管理員郵箱
6,配置web界面管理接口,并創(chuàng)建登陸到nagios管理界面的賬號密碼,然后重啟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 
        //檢查配置文件是否有錯誤或者警告,如果沒有的話啟動nagios服務(wù)
[root@localhost ~]#service nagios start
7,現(xiàn)在我們就可以測試nagios監(jiān)控本機(jī)localhost的情況了,登陸 server ip/nagios 
進(jìn)去之后會讓你輸入方才htpasswd創(chuàng)建的用戶名和密碼(藍(lán)色邊框)

我擦,圖片怎么上傳不了呀?上傳不了圖片就算了。
向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI