溫馨提示×

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

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

Nagios監(jiān)控平臺(tái)之一:安裝

發(fā)布時(shí)間:2020-06-18 01:19:21 來(lái)源:網(wǎng)絡(luò) 閱讀:693 作者:xf_aj 欄目:移動(dòng)開(kāi)發(fā)

 

最近在學(xué)習(xí)使用Nagios監(jiān)控全網(wǎng)絡(luò),目前已經(jīng)完成監(jiān)控服務(wù)器的基本配置,主要參考了網(wǎng)上一些教程,但安裝配置下來(lái)遇到了很多這樣那樣的問(wèn)題,現(xiàn)在總結(jié)一下:

1、操作系統(tǒng)準(zhǔn)備:
系統(tǒng):CentOS x86_64 6.2最小化安裝
安裝httpd、php及編譯工具等基本軟件:

  [root@nagiostest ~]# yum -y install php-mysql mysql perl mysql-server perl-DBI perl-DBD-MySQL httpd gcc glibc glibc-common gd gd-devel php openssl openssl-devel

2、準(zhǔn)備軟件:
下載nagios-plugins

  [root@nagiostest ~]#wget http://sourceforge.net/projects/nagiosplug/files/nagiosplug/1.4.16/nagios-plugins-1.4.16.tar.gz/download

解壓:
  [root@nagiostest ~]#  tar -zxvf nagios-plugins-1.4.16.tar.gzt
下載中文版Nagios
  [root@nagiostest ~]#wget http://sourceforge.net/projects/nagios-cn/files/sourcecode/zh_CN%203.2.3/nagios-cn-3.2.3.tar.bz2/download

解壓:

[root@nagiostest ~]# tar -jxvf nagios-cn-3.2.3.tar.bz2
完成后ls如下:
[root@nagiostest ~]# ls
anaconda-ks.cfg     nagios-cn-3.2.3     nagios-plugins-1.4.16.tar.gz
install.log     nagios-cn-3.2.3.tar.bz2     install.log.syslog  nagios-plugins-1.4.16
3、建立nagios賬戶:
[root@nagiostest ~]#groupadd  nagcmd         /*建立組nagcmd*/
[root@nagiostest ~]#usermod –G nagcmd apache  /*添加用戶apache到組nagcmd*/
[root@nagiostest ~]#useradd  -G nagcmd  nagios  /*新建用戶nagios并添加到組nagcmd*/
[root@nagiostest ~]#passwd  nagios  /*修改nagios密碼*/
4、編譯安裝nagios-cn-3.2.3
[root@nagiostest ~]# cd nagios-cn-3.2.3
[root@nagiostest nagios-cn-3.2.3]# ./configure --prefix=/usr/local/nagios --with-nagios-user=nagios --with-nagios-group=nagios --with-command-group=nagcmd
[root@nagiostest nagios-cn-3.2.3]#make && make install
[root@nagiostest nagios-cn-3.2.3]#make install-init
[root@nagiostest nagios-cn-3.2.3]#make install-commandmode
[root@nagiostest nagios-cn-3.2.3]#make install-config
安裝完畢后返回root用戶主目錄:cd  ~

5、           編譯安裝nagios- plugins

[root@nagiostest ~]# cd nagios-plugins-1.4.16
[root@nagiostest nagios-plugins-1.4.16]# ./configure --with-nagios-user=nagios --with-nagios-group=nagios
[root@nagiostest nagios-plugins-1.4.16]# make && make install
6、           修改nagios網(wǎng)頁(yè)登錄賬戶密碼:
  [root@nagiostest ~]#htpasswd -c /usr/local/nagios/etc/htpasswd nagiosadmin
7、           配置相關(guān)服務(wù)的啟動(dòng)方式并啟動(dòng):
[root@nagiostest ~]#chkconfig --add nagios
[root@nagiostest ~]#chkconfig nagios on
[root@nagiostest ~]#chkconfig httpd on
[root@nagiostest ~]#chkconfig mysqld on
[root@nagiostest ~]#service httpd start
[root@nagiostest ~]#service nagios start
[root@nagiostest ~]#service mysqld start
8、           檢查配置是否正確:
[root@nagiostest ~]#/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
由于這個(gè)命令今后的配置中經(jīng)常會(huì)遇到,因此建議添加到別名,具體操作如下:
  [root@nagiostest ~]# vi /root/.bashrc
添加一行alias check='/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg'

Nagios監(jiān)控平臺(tái)之一:安裝

這樣以后只要輸入check就相當(dāng)于執(zhí)行上面的那一長(zhǎng)串命令。
執(zhí)行上述命令如果沒(méi)有錯(cuò),則出現(xiàn)如下圖:

Nagios監(jiān)控平臺(tái)之一:安裝

如果有錯(cuò),則根據(jù)錯(cuò)誤提示進(jìn)行修改配置。

9、           登錄控制臺(tái):
現(xiàn)在就可以用http://serverip/nagios 方式訪問(wèn)nagios web訪問(wèn)控制臺(tái)了
 

Nagios監(jiān)控平臺(tái)之一:安裝

 

 

向AI問(wèn)一下細(xì)節(jié)

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

AI