溫馨提示×

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

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

nagios、nrpe 在centsos 和ubuntu 環(huán)境下的編譯安裝

發(fā)布時(shí)間:2020-07-30 11:08:17 來(lái)源:網(wǎng)絡(luò) 閱讀:1094 作者:xiaoou1217 欄目:移動(dòng)開(kāi)發(fā)

nagios 的編譯安裝

yum install httpd php  gcc glibc glibc-common gd gd-devel  openssl openssl-devel  -y


ubuntu 安裝openssl-devel 是

apt-get 無(wú)法安裝 openssl-devel請(qǐng)執(zhí)行:  sudo apt-get install openssl apache2 php gcc glibc glibc-common gb gd-devel

sudo apt-get install libssl-dev


/usr/sbin/useradd -M  -s /sbin/nologin  nagios

mkdir -p /opt/nagios_install_packages

cd /opt/nagios_install_packages

wget http://softlayer-dal.dl.sourceforge.net/project/nagios/nagios-4.x/nagios-4.0.1/nagios-4.0.1.tar.gz

wget https://www.nagios-plugins.org/download/nagios-plugins-1.5.tar.gz

# nagios

tar -xf nagios-4.0.1.tar.gz

cd nagios-4.0.1

./configure --prefix=/usr/local/nagios

make all

make install

make install-init

make install-config

make install-commandmode

make install-webconf

htpasswd -c -m  /usr/local/nagios/etc/htpasswd nagios

service httpd restart

cd /opt

# plugins

tar -xf nagios-plugins-1.5.tar.gz

cd nagios-plugins-1.5

./configure --prefix=/usr/local/nagios/

make

make install


chkconfig --add nagios

chkconfig nagios on

service nagios start

-------------------------------------------------------------------

nrpe 的編譯安裝

#nrpe 的下載http://sourceforge.net/projects/nagios/files/nrpe-2.x/


wget  http://sourceforge.net/projects/nagios/files/nrpe-2.x/nrpe-2.15/nrpe-2.15.tar.gz/download?use_mirror=hivelocity&r=&use_mirror=hivelocity

nrpe 在被監(jiān)控服務(wù)端的安裝

服務(wù)器監(jiān)控:nrpe監(jiān)控客戶端安裝

注:安裝過(guò)程需要有root用戶權(quán)限,關(guān)閉主機(jī)防火墻(或者開(kāi)放5666端口)。

所需軟件包:nagios-plugins-1.5.tar.gz


  nrpe-2.15.tar.gz


安裝環(huán)境說(shuō)明:


  nagios監(jiān)控端IP:192.168.0.10


  nrpe監(jiān)控客戶端IP:192.168.0.20


1、添加nagios用戶

useradd nagios -s /sbin/nologin -M

注意:在ubuntu 中這樣添加用戶 useradd nagios -M -s /usr/sbin/nologin


2、安裝過(guò)程

安裝nrpe

tar zxvf nrpe-2.15.tar.gz

cd nrpe-2.15

./configure --prefix=/usr/local/nrpe --enable-command-args


#make all

#make install-plugin

#make install-daemon

#make install-daemon-config

***以上安裝完成后會(huì)在/usr/local/nrpe目錄下產(chǎn)生bin、etc、libexec三個(gè)目錄***

注意在ubuntu 下:

./configure --prefix=/usr/local/nrpe --enable-command-args  --with-ssl=/usr/bin/openssl --with-ssl-lib=/usr/lib/x86_64-linux-gnu


安裝nagios插件

tar zxvf nagios-plugins-1.5.tar.gz

cd nagios-plugins-1.5

./configure --prefix=/usr/local/nrpe

make && make install

***以上安裝完成后會(huì)在/usr/local/nrpe目錄下產(chǎn)生libexec、share兩個(gè)目錄***


3、修改nrpe.cfg配置文件

allowed_hosts=127.0.0.1, 192.168.0.10

dont_blame_nrpe=1

定義命令,如:

command[check_tcp]=/usr/local/nrpe/libexec/check_tcp -p $ARG1$ -w $ARG2$ -c $ARG3$


4、修改目錄/文件權(quán)限

chown -R nagios.nagios /usr/local/nrpe


5、啟動(dòng)nrpe守護(hù)進(jìn)程

/usr/local/nrpe/bin/nrpe -c /usr/local/nrpe/etc/nrpe.cfg -d


6、nagios監(jiān)控端測(cè)試nrpe是否安裝成功

/usr/local/nagios/libexec/check_nrpe -H 192.168.0.20

如果返回“NRPE v2.15”即為已安裝成功并啟動(dòng)

-------------------------------------------------------------------------

nrpe 在nagios 服務(wù)器器端的安裝

tar zxvf nrpe-2.5.tar.gz

cd nrpe-2.5

./configure

make && make install-plugin

/usr/local/nagios/libexec/check_nrpe -H 被監(jiān)控主機(jī)的IP

NRPE V.2.5


向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