溫馨提示×

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

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

Nagios+NSClient+nrpe環(huán)境搭建

發(fā)布時(shí)間:2020-04-06 15:05:22 來源:網(wǎng)絡(luò) 閱讀:540 作者:Cinyann 欄目:建站服務(wù)器

Nagios是一款開源的免費(fèi)網(wǎng)絡(luò)監(jiān)視工具,能有效監(jiān)控Windows、Linux和Unix的主機(jī)狀態(tài),交換機(jī)路由器等網(wǎng)絡(luò)設(shè)備,打印機(jī)等。在系統(tǒng)或服務(wù)狀態(tài)異常時(shí)發(fā)出郵件或短信報(bào)警第一時(shí)間通知網(wǎng)站運(yùn)維人員,在狀態(tài)恢復(fù)后發(fā)出正常的郵件或短信通知。

NSClient:Windows 7監(jiān)控插件

NRPE是監(jiān)控軟件nagios的一個(gè)擴(kuò)展,它被用于被監(jiān)控的服務(wù)器上,向nagios監(jiān)控平臺(tái)提供該服務(wù)器的一些本地的情況。例如,cpu負(fù)載、內(nèi)存使用、硬盤使用等等。NRPE可以稱為nagios的for linux 客戶端。



1.安裝軟件:

yum install -y gcc*

yum install -y httpd mysql mysql-server mysql-devel php php-mysql glibc glibc-common *gd*


2.添加用戶:

Nagios+NSClient+nrpe環(huán)境搭建


3.編譯安裝nagios:

此次安裝使用的軟件包是 nagios.iso

Nagios+NSClient+nrpe環(huán)境搭建

tar -xvf nagios-3.3.1.tar.gz -C /root/

然后進(jìn)入nagios目錄下

./configure --with-command-group=nagcmd --enable-event-broker

make all

make install

make install-init

make install-commandmode

make install-config

make install-webconf


4.生成密碼配置文件:

Nagios+NSClient+nrpe環(huán)境搭建

Nagios+NSClient+nrpe環(huán)境搭建


開啟Apache服務(wù)

5.瀏覽器查看:

Nagios+NSClient+nrpe環(huán)境搭建

Nagios+NSClient+nrpe環(huán)境搭建


6.安裝插件管理器nagios-plugins:

tar -xvf nagios-plugins-1.4.14.tar.gz -C /root/

進(jìn)入目錄編譯安裝(nagios-plugins-1.4.14)

./configure --with-nagios-user=nagios --with-nagios-group=nagios --with-mysql  --enable-perl-modules

make && make install

Nagios+NSClient+nrpe環(huán)境搭建

檢查配置文件是否有錯(cuò)誤:

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

Nagios+NSClient+nrpe環(huán)境搭建


重啟nagios服務(wù)

此時(shí)再去瀏覽器檢查:

Nagios+NSClient+nrpe環(huán)境搭建



Windows主機(jī)的監(jiān)控:

7.Windows安裝NSClient:

Nagios+NSClient+nrpe環(huán)境搭建

Nagios+NSClient+nrpe環(huán)境搭建

Nagios+NSClient+nrpe環(huán)境搭建

Nagios+NSClient+nrpe環(huán)境搭建

Nagios+NSClient+nrpe環(huán)境搭建

Nagios+NSClient+nrpe環(huán)境搭建


服務(wù)器設(shè)置監(jiān)控Windows:

Nagios+NSClient+nrpe環(huán)境搭建

Nagios+NSClient+nrpe環(huán)境搭建

Nagios+NSClient+nrpe環(huán)境搭建


檢測(cè)并重新啟動(dòng)nagios

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

service nagios restart

瀏覽器再查看:

Nagios+NSClient+nrpe環(huán)境搭建


Linux客戶機(jī)監(jiān)控:


8.Linux客戶端的監(jiān)控:

在Linux客戶的上面:

安裝環(huán)境支持:

yum install -y gcc* openssl openssl-devel

編譯安裝nagios-plugins

tar -xvf nagios-plugins-1.4.14.tar.gz

需要?jiǎng)?chuàng)建用戶

useradd nagios

./configure --with-nagios-user=nagios --with-nagios-group=nagios

make all

make install

編譯安裝nrpe-2.8.1.tar.gz

./configure --enable-ssl --with-ssl-lib=/usr/lib

Nagios+NSClient+nrpe環(huán)境搭建

Nagios+NSClient+nrpe環(huán)境搭建

Nagios+NSClient+nrpe環(huán)境搭建


回到服務(wù)器端:

安裝nagios-plugins(已安裝)

安裝nrpe

tar -xvf nrpe-2.8.1.tar.gz -C /root/

./configure --enable-ssl --with-ssl-lib=/usr/lib

make all

make install-plugin

不用啟用daemon和daemon-config

Nagios+NSClient+nrpe環(huán)境搭建

define host{

use linux-server

host_name nagios

address 192.168.115.174

}

define service{

use generic-service

host_name nagios

service_description check-load

check_command check_nrpe!check_load

}

define service{

use generic-service

host_name nagios

service_description check-users

check_command check_nrpe!check_users

}

Nagios+NSClient+nrpe環(huán)境搭建

Nagios+NSClient+nrpe環(huán)境搭建


/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

service nagios restart

再檢查瀏覽器:

Nagios+NSClient+nrpe環(huán)境搭建


9.服務(wù)的監(jiān)控:

Linux客戶端:

安裝軟件:

yum install -y mysql mysql-server

service mysqld start

mysqladmin -uroot password ‘123456’

Nagios+NSClient+nrpe環(huán)境搭建


服務(wù)器端:

測(cè)試連接:

/usr/local/nagios/libexec/check_mysql -H 192.168.115.174 -u nagios -d nagios -p 123456

Nagios+NSClient+nrpe環(huán)境搭建

Nagios+NSClient+nrpe環(huán)境搭建

define host{

use linux-server

host_name Mysql

address 192.168.115.174

}

define service{

host_name Mysql

check_period 24x7

max_check_attempts 2

normal_check_interval 1

retry_check_interval 1

contact_groups admins

notification_interval 5

notification_period 24x7

notification_options w,u,c,r

check_command check_mysql

}Nagios+NSClient+nrpe環(huán)境搭建

Nagios+NSClient+nrpe環(huán)境搭建

Nagios+NSClient+nrpe環(huán)境搭建


service nagios restart

Nagios+NSClient+nrpe環(huán)境搭建

向AI問一下細(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