xxggmmxx 发表于 2019-1-13 11:48:44

监控软件nagios之添加Linux主机

  nagios监控windows和linux主机示意图:
http://s3.运维网.com/wyfs02/M02/75/02/wKiom1YweoTDy8pZAAH2FnORSwA486.jpg
  1.首先要确定nagios监控软件在服务器端安装
http://s3.运维网.com/wyfs02/M00/5C/2A/wKiom1UbsOzjKJeBAAR2k-QP5TY349.jpg
  2.在监控端要安装nrpe插件
  # yum install xinetd openssl openssl-devel -y
  # wget http://liquidtelecom.dl.sourceforge.net/project/nagios/nrpe-2.x/nrpe-2.15/nrpe-2.15.tar.gz
  # tar xvf nrpe-2.15.tar.gz
  # cd /root/nrpe-2.15
  # ./configure--prefix=/usr/local/nagios-plugins-2.0.3/
  # make all
  # make install-plugin
  # ll /usr/local/nagios-4.0.8/libexec/check_nrpe
-rwxrwxr-x. 1 nagios nagios 76769 Apr1 17:35 /usr/local/nagios-4.0.8/libexec/check_nrpe
#
  3.在Linux被控端安装客户端软件(nagios-plugins和nrpe)
  # yum install openssl openssl-devel xinetd -y
  # groupadd-g 500 nagios
  # useradd-r -s /sbin/nologin -u 500 -g nagios nagios
  # wget http://nagios-plugins.org/download/nagios-plugins-2.0.3.tar.gz
  # wget http://liquidtelecom.dl.sourceforge.net/project/nagios/nrpe-2.x/nrpe-2.15/nrpe-2.15.tar.gz
  # tar xvf nagios-plugins-2.0.3.tar.gz
  # tar xvf nrpe-2.15.tar.gz
  # cd nagios-plugins-2.0.3
  # ./configure --prefix=/usr/local/nagios-plugins-2.0.3 --with-nagios-user=nagios --with-nagios-group=nagios
  # make && make install
  # cd /usr/local/
  # chown-R nagios:nagios nagios-plugins-2.0.3/
  # cd /root/nrpe-2.15
  # ./configure--prefix=/usr/local/nagios-plugins-2.0.3/
  # make all
  # make install-plugin
  # make install-daemon
  # make install-daemon-config
  # make install-xinetd
  # ll /usr/local/nagios-plugins-2.0.3/
total 20
drwxrwxr-x. 2 nagios nagios 4096 Apr1 17:18 bin
drwxrwxr-x. 2 nagios nagios 4096 Apr1 17:18 etc
drwxr-xr-x. 2 nagios nagios 4096 Apr1 17:10 include
drwxrwxr-x. 2 nagios nagios 4096 Apr1 17:18 libexec
drwxr-xr-x. 3 nagios nagios 4096 Apr1 17:10 share
  # vim /etc/xinetd.d/nrpe
  only_from       = 127.0.0.1 192.168.1.247             --添加监控服务器端地址
  # vim /usr/local/nagios-plugins-2.0.3/etc/nrpe.cfg
  allowed_hosts=127.0.0.1,192.168.1.247            --添加监控服务器主机的IP地址
  # vim /etc/services
  nrpe            5666/tcp                # nrpe            --添加服务器监听端口
  # /etc/init.d/xinetd restart
Stopping xinetd:                                          
Starting xinetd:                                          
# netstat -antup | grep 5666
tcp      0      0 :::5666                     :::*                        LISTEN      32747/xinetd      
# /usr/local/nagios-plugins-2.0.3/libexec/check_nrpe -H localhost
NRPE v2.15
#
  3.在监控端测试连接被控端,添加被控端主机
  # /usr/local/nagios-4.0.8/libexec/check_nrpe -H 192.168.1.248
NRPE v2.15
  # cd /usr/local/nagios-4.0.8/etc/objects/
  # cp -a templates.cfgtong2.cfg
# vim tong2.cfg



页: [1]
查看完整版本: 监控软件nagios之添加Linux主机