1.安装nsclient++
访问http://nsclient.org/nscp/下载nsclient++,这里我使用的是nsclient++-0.3.9-x64的msi安装包。下载之后直接安装,过程中会提示输入nagios监控服务器地址和密码。地址填写正确,密码不用设置。nagios监控服务器事先在监控linux服务器时候已经搭建好,以后再和大家分享。
安装如下图所示:
2.配置nsclient++
编辑安装目录下的nes.ini文件,打开nsclient++的端口。方法为找到:
[nsclient]
;port=12489
去掉port前的“;”就可以启用12489端口。
我的是安装在服务器的program files下的nsclient++-win32-0.3.9目录中。在cmd中执行:
cd c:\program files\nsclient++-win32-0.3.5
netstat -an | more
查看12489端口是否正常监听在。
因为安装时候需要的模块已经勾选了,所以配置文件中不用再作设置。否则可以通过去掉每个模块前的;来启用该模块。
到这里即完成了windows server 2008上的配置。接下来我们设置nagios监控服务器。
3.nagios监控服务器设置
vi /usr/local/nagios/etc/nagios.cfg
搜索找到:
# definitions for monitoring a windows machine
# cfg_file=/usr/local/nagios/etc/objects/windows.cfg
将第二行的#去掉打开nagios监控的windows模块,然后保存。
接着编辑
# vi /usr/local/nagios/etc/objects/windows.cfg
找到并设置监控的服务器:
define host{
use windows-server ; inherit default values from a template
host_name winserver ; the name we're giving to this host
alias my windows server ; a longer name associated with the host
address 192.168.0.2 ; ip address of the host
}
设置被监控主机名和被监控的windows服务器地址。
接下来搜索各种监控的服务并设置:
# create a service for monitoring the version of nsclient++ that is installed
# change the host_name to match the name of the host you defined above
define service{
use generic-service
host_name winserver
service_description nsclient++ version
check_command check_nt!clientversion
}
监控nsclient版本。
# create a service for monitoring the uptime of the server
# change the host_name to match the name of the host you defined above
define service{
use generic-service
host_name winserver
service_description uptime
check_command check_nt!uptime
}
监控服务器在线时间。
# create a service for monitoring cpu load
# change the host_name to match the name of the host you defined above
define service{
use generic-service
host_name winserver
service_description cpu load
check_command check_nt!cpuload!-l 20,30,50
}
监控服务器cpu负载。
# create a service for monitoring memory usage
# change the host_name to match the name of the host you defined above
define service{
use generic-service
host_name winserver
service_description memory usage
check_command check_nt!memuse!-w 80 -c 90
}
监控服务器的内存占用。
# create a service for monitoring c:\ disk usage
# change the host_name to match the name of the host you defined above
define service{
use generic-service
host_name winserver
service_description c:\ drive space
check_command check_nt!useddiskspace!-l c -w 80 -c 90
}
监控系统c盘的磁盘占用。
部署好之后在nagios中显示如下:
如对本文有疑问, 点击进行留言回复!!
Windows Server 2008 r2服务器无故自动重启故障的解决方法
Windows CVE-2019-0708 远程桌面代码执行漏洞复现问题
网友评论