cf2000 发表于 2019-1-17 07:59:05

nagios 监控 内存

前提:把check_mem.sh放到/usr/local/nagios/libexec下,并赋予执行权限
chmod 755 check_mem.sh

一,监控本地(监控端本身)内存使用:
#修改commands配置
vim /usr/local/nagios/etc/objects/commands.cfg
#增加以下内容
define command{
                command_name      check_mem
                command_line      $USER1$/check_mem.sh -w $ARG1$ -c $ARG2$
                }

#修改localhost.cfg
vim /usr/local/nagios/etc/objects/localhost.cfg
#增加以下内容
define service{
                use                                                         local-service
                host_name                                             localhost
                service_description                         memory
                check_command                                     check_mem!20!10!
                }


二,监控客户端内存使用情况:

1,#修改客户端配置文件
    vim /usr/local/nagios/etc/nrpe.cfg

      #增加以下内容   
    command=/usr/local/nagios/libexec/check_mem.sh -w 20 -c 10
            
2,#修改主控制端相关配置文件
   vim /usr/local/nagios/etc/service/liguxk.cfg    #主控端定义的被控端的配置文件
   #增加以下内容
                  define service{
                  use                                                         generic-service
                  host_name                                             liguxk
                  service_description                         Memory
                  check_command                                     check_nrpe!check_mem
                  }


三,总结

监控本地资源的调用流程为:
localhost.cfg—>command.cfg—>libexec
监控客户端流程:
liguxk.cfg—>服务器nrpe——>客户端nrpe.cfg—>客户端libexec


附件:http://down.运维网.com/data/2354622

页: [1]
查看完整版本: nagios 监控 内存