Nagios监控

来源:互联网 发布:js截取字符串 编辑:程序博客网 时间:2024/05/21 08:29


使用nrpe监控linux/unix主机

被监控端安装nagios-plugins与nrpe软件包并启动nrpe服务。
 1、准备安装环境。
  # useradd -r nagios
  # yum -y install gcc gcc-c++ mysql mysql-server mysql-devel openssl-devel
  
 2、解压并编译安装nagios-plugins。
  # tar zxf nagios-plugins-2.1.2.tar.gz
  # cd nagios-plugins-2.1.2
  # ./configure --with-nagios-user=nagios --with-nagios-group=nagios --with-mysql
  # make all
  # make install
 
 3、解压并编译安装nrpe。
  # tar zxf nrpe-2.12.tar.gz
  # cd nrpe-2.12
  # ./configure --with-nagios-user=nagios --with-nagios-group=nagios --with-nrpe-user=nagios --with-nrpe-group=nagios --enable-ssl --enable-command-args
  # make all
  # make install
  # make install-plugin
  # make install-daemon
  # make install-daemon-config
 
 4、修改客户端的nrpe的配置文件并启动服务。
  # vim /usr/local/nagios/etc/nrpe.cfg
   allowed_hosts=192.168.1.4
  # /usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d
  # ss -tunlp | grep nrpe
   tcp    LISTEN     0      5  *:5666  *:*  users:(("nrpe",29550,4))
   
 5、配置nrpe被xinetd管理的配置文件。
  # vim /etc/xinetd.d/nrpe
   # default: off
   # nrpe service
   service nrpe
   {
    disable = no
    flags  = REUSE
    socket_type     = stream
    wait            = no
    user            = nagios
    group   = nagios
    server          = /usr/local/nagios/bin/nrpe
    server_args     = -c /usr/local/nagios/etc/nrpe.cfg -d
    log_on_failure  += USERID
   }

监控端安装nrpe。
 1、解压并安装nrpe。
  # tar zxf nrpe-2.12.tar.gz
  # cd nrpe-2.12
  # ./configure --with-nagios-user=nagios --with-nagios-group=nagios --with-nrpe-user=nagios --with-nrpe-group=nagios --enable-ssl --enable-command-args
  # make all
  # make install-plugin

 2、测试监控端与被监控端的连接。
  # cd /usr/local/nagios/libexec
  # ./check_nrpe -H 192.168.1.6


0 0
原创粉丝点击