使用 NSClient++默认的那个监控的时候只检测到了虚拟内存,通过下面的方法可以监控windows的物理内存。
1. 修改 NSClient++.ini 文件里面的参数,默认路径在 C:\Program Files\NSClient++ 下面,用记事本打,做如下修改
[NRPE] ;# NRPE PORT NUMBER ; This is the port the NRPEListener.dll will listen to. port=5666 ;端口号 ; ;# COMMAND TIMEOUT ; This specifies the maximum number of seconds that the NRPE daemon will allow plug-ins to finish executing before killing them off. ;command_timeout=60 ; ;# COMMAND ARGUMENT PROCESSING ; This option determines whether or not the NRPE daemon will allow clients to specify arguments to commands that are executed. allow_arguments=1 ;充许传递参数 ; ;# COMMAND ALLOW NASTY META CHARS ; This option determines whether or not the NRPE daemon will allow clients to specify nasty (as in |`&><'"\[]{}) characters in arguments. allow_nasty_meta_chars=1 ;充许传递特殊字符的参数 ; ;# USE SSL SOCKET ; This option controls if SSL should be used on the socket. ;use_ssl=1 ; ;# BIND TO ADDRESS ; Allows you to bind server to a specific local address. This has to be a dotted ip adress not a hostname. ; Leaving this blank will bind to all avalible IP adresses. bind_to_address=192.168.110.119 ;监听在这个IP地址上 ; ;# ALLOWED HOST ADDRESSES ; This is a comma-delimited list of IP address of hosts that are allowed to talk to NRPE deamon. ; If you leave this blank the global version will be used instead. allowed_hosts=192.168.110.157 ;充许访问的IP,一般为Nagios服务端的IP
二、编辑Commands.cfg,增加如下内容:
vim /usr/local/nagios/etc/objects/commands.cfg define command{ command_name check_nrpe_memory command_line $USER1$/check_nrpe -H "$HOSTADDRESS$" -p 5666 -c CheckMEM -a MaxWarn=80% Max Crit=90% ShowAll=long type=physical }
三、编辑119server.cfg,增加如下内容:
vim /usr/local/nagios/etc/objects/119server.cfg define service{ use generic-service host_name 119server service_description physicalMEM check_command check_nrpe_memory!192.168.110.119 }