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

  • 相关阅读:
    jQuery的核心对象、原型对象、静态方法、动态方法
    请写出css中选择器(元素选择器、类选择器、id选择器)的优先级顺序,和当各种选择器组合时,优先级的计算规则是什么?
    css3中的box-sizing常用的属性有哪些?分别有什么作用?
    不同域的页面如何通信(跨域)
    浮动与定位
    获取DOM元素的方式有哪些
    简要说明盒子模型和flex布局
    牛逼哄哄的对象深复制
    欧拉函数
    P2659 美丽的序列
  • 原文地址:https://www.cnblogs.com/wangshaojun/p/5100487.html
Copyright © 2011-2022 走看看