zoukankan      html  css  js  c++  java
  • 监控和安全运维 1.5 nagios监控客户端-1

    3. Nagios安装 - 客户端(192.168.0.12)
    在客户端机器上

     rpm -ivh  http://www.aminglinux.com/bbs/data/attachment/forum/month_1211/epel-release-6-7.noarch.rpm
    yum install -y nagios-plugins nagios-plugins-all nrpe nagios-plugins-nrpe 

    修改配置文件

    vim /etc/nagios/nrpe.cfg
    “allowed_hosts=127.0.0.1” 改为 “allowed_hosts=127.0.0.1,192.168.1.117” 服务端的ip为服务端ip; 意思就是允许哪个IP连接
    
    找到” dont_blame_nrpe=0” 改为  “dont_blame_nrpe=1

    启动客户端,服务端去客户端获得服务的状态的时候的中间介质。

    /etc/init.d/nrpe start

    4. 监控中心(192.168.1.117)添加被监控主机(192.168.1.111)

    在服务端

    cd /etc/nagios/conf.d/
    vim 192.168.1.111.cfg  
    
    

    define host{
    use linux-server ; Name of host template to use
    ; This host definition will inherit all variables that are defined
    ; in (or inherited by) the linux-server host template definition.
    host_name 192.168.1.111
    alias 1.111
    address 192.168.1.111
    }

    
    

    define service{
    use generic-service
    host_name 192.168.1.111
    service_description check_ping
    check_command check_ping!100.0,20%!200.0,50%
    max_check_attempts 5
    normal_check_interval 1
    }

    
    

    define service{
    use generic-service
    host_name 192.168.1.111
    service_description check_ssh
    check_command check_ssh
    max_check_attempts 5
    normal_check_interval 1
    }

    
    

    define service{
    use generic-service
    host_name 192.168.1.111
    service_description check_http
    check_command check_http
    max_check_attempts 5
    normal_check_interval 1
    }

     

    5. 配置文件的简单说明
    我们定义的配置文件中一共监控了三个service:ssh, ping, http

    这三个项目是使用本地的nagios工具去连接远程机器,也就是说即使客户端没有安装nagios-plugins以及nrpe也是可以监控到的。其他的一些service诸如负载、磁盘使用等是需要服务端通过nrpe去连接到远程主机获得信息,所以需要远程主机安装nrpe服务以及相应的执行脚本(nagios-plugins)
    max_check_attempts 5  #当nagios检测到问题时,一共尝试检测5次都有问题才会告警,如果该数值为1,那么检测到问题立即告警
    normal_check_interval 1#重新检测的时间间隔,单位是分钟,默认是3分钟
    notification_interval           60 #在服务出现异常后,故障一直没有解决,nagios再次对使用者发出通知的时间。单位是分钟。如果你认为,所有的事件只需要一次通知就够了,可以把这里的选项设为0


    检测配置文件

    nagios -v /etc/nagios/nagios.cfg

    重启

    service httpd restart; service nagios restart
    /etc/init.d/nrpe start

    http://www.apelearn.com/bbs/thread-7155-1-1.html

  • 相关阅读:
    UVa
    UVa 1630
    P3891 [GDOI2014]采集资源
    一个非常naive的小学数学魔术证明题
    P2831 [NOIP2016 提高组] 愤怒的小鸟
    P4211 [LNOI2014]LCA
    P4137 Rmq Problem / mex 强制在线做法
    P2272 [ZJOI2007]最大半连通子图
    P5664 [CSP-S2019] Emiya 家今天的饭
    盘点linux操作系统中的10条性能调优命令,一文搞懂Linux系统调优
  • 原文地址:https://www.cnblogs.com/wangshaojun/p/5100487.html
Copyright © 2011-2022 走看看