標籤:監視軟體nagios之添加linux主機
1.首先要確定nagios監視軟體在伺服器端安裝
650) this.width=650;" title="6.jpg" src="http://s3.51cto.com/wyfs02/M00/5C/2A/wKiom1UbsOzjKJeBAAR2k-QP5TY349.jpg" alt="wKiom1UbsOzjKJeBAAR2k-QP5TY349.jpg" />
2.在監控端要安裝nrpe外掛程式
[[email protected] ~]# yum install xinetd openssl openssl-devel -y
[[email protected] ~]# wget http://liquidtelecom.dl.sourceforge.net/project/nagios/nrpe-2.x/nrpe-2.15/nrpe-2.15.tar.gz
[[email protected] ~]# tar xvf nrpe-2.15.tar.gz
[[email protected] ~]# cd /root/nrpe-2.15
[[email protected] nrpe-2.15]# ./configure --prefix=/usr/local/nagios-plugins-2.0.3/
[[email protected] nrpe-2.15]# make all
[[email protected] nrpe-2.15]# make install-plugin
[[email protected] nrpe-2.15]# ll /usr/local/nagios-4.0.8/libexec/check_nrpe
-rwxrwxr-x. 1 nagios nagios 76769 Apr 1 17:35 /usr/local/nagios-4.0.8/libexec/check_nrpe
[[email protected] nrpe-2.15]#
3.在Linux被控端安裝用戶端軟體(nagios-plugins和nrpe)
[[email protected] ~]# yum install openssl openssl-devel xinetd -y
[[email protected] ~]# groupadd -g 500 nagios
[[email protected] ~]# useradd -r -s /sbin/nologin -u 500 -g nagios nagios
[[email protected] ~]# wget http://nagios-plugins.org/download/nagios-plugins-2.0.3.tar.gz
[[email protected] ~]# wget http://liquidtelecom.dl.sourceforge.net/project/nagios/nrpe-2.x/nrpe-2.15/nrpe-2.15.tar.gz
[[email protected] ~]# tar xvf nagios-plugins-2.0.3.tar.gz
[[email protected] ~]# tar xvf nrpe-2.15.tar.gz
[[email protected] ~]# cd nagios-plugins-2.0.3
[[email protected] nagios-plugins-2.0.3]# ./configure --prefix=/usr/local/nagios-plugins-2.0.3 --with-nagios-user=nagios --with-nagios-group=nagios
[[email protected] nagios-plugins-2.0.3]# make && make install
[[email protected] nagios-plugins-2.0.3]# cd /usr/local/
[[email protected] local]# chown -R nagios:nagios nagios-plugins-2.0.3/
[[email protected] local]# cd /root/nrpe-2.15
[[email protected] nrpe-2.15]# ./configure --prefix=/usr/local/nagios-plugins-2.0.3/
[[email protected] nrpe-2.15]# make all
[[email protected] nrpe-2.15]# make install-plugin
[[email protected] nrpe-2.15]# make install-daemon
[[email protected] nrpe-2.15]# make install-daemon-config
[[email protected] nrpe-2.15]# make install-xinetd
[[email protected] nrpe-2.15]# ll /usr/local/nagios-plugins-2.0.3/
total 20
drwxrwxr-x. 2 nagios nagios 4096 Apr 1 17:18 bin
drwxrwxr-x. 2 nagios nagios 4096 Apr 1 17:18 etc
drwxr-xr-x. 2 nagios nagios 4096 Apr 1 17:10 include
drwxrwxr-x. 2 nagios nagios 4096 Apr 1 17:18 libexec
drwxr-xr-x. 3 nagios nagios 4096 Apr 1 17:10 share
[[email protected] nrpe-2.15]# vim /etc/xinetd.d/nrpe
only_from = 127.0.0.1 192.168.1.247 --添加監控伺服器端地址
[[email protected] nrpe-2.15]# vim /usr/local/nagios-plugins-2.0.3/etc/nrpe.cfg
allowed_hosts=127.0.0.1,192.168.1.247 --添加監控伺服器主機的IP地址
[[email protected] nrpe-2.15]# vim /etc/services
nrpe 5666/tcp # nrpe --添加伺服器監聽連接埠
[[email protected] nrpe-2.15]# /etc/init.d/xinetd restart
Stopping xinetd: [ OK ]
Starting xinetd: [ OK ]
[[email protected] nrpe-2.15]# netstat -antup | grep 5666
tcp 0 0 :::5666 :::* LISTEN 32747/xinetd
[[email protected] nrpe-2.15]# /usr/local/nagios-plugins-2.0.3/libexec/check_nrpe -H localhost
NRPE v2.15
[[email protected] nrpe-2.15]#
3.在監控端測試連接被控端,添加被控端主機
[[email protected] nrpe-2.15]# /usr/local/nagios-4.0.8/libexec/check_nrpe -H 192.168.1.248
NRPE v2.15
[[email protected] etc]# cd /usr/local/nagios-4.0.8/etc/objects/
[[email protected] objects]# cp -a templates.cfg tong2.cfg
[[email protected] objects]# vim tong2.cfg
本文出自 “一起走過的日子” 部落格,請務必保留此出處http://tongcheng.blog.51cto.com/6214144/1627424
監視軟體nagios之添加Linux主機