摘要
本文介绍了如何使用nagios通过nsclient监控windows主机。
此次实验环境基于上篇文章,监控端在linux环境下,windows服务器使用的时windows server 2012。
1. 安装nsclient
访问http://nsclient.org/nscp/下载nsclient ,这里我使用的是nscp-0.4.3.143-x64的msi安装包。下载之后直接安装,过程中会提示输入nagios监控服务器地址和密码。地址填写正确,密码不用设置。nagios监控服务器事先在监控linux服务器时候已经搭建好,需要的小伙伴看这里。
2.配置nsclient
在 nsclient 的安装目录打开 nsclient.ini,将监控服务器的ip地址加到 allowed hosts 指令后面。
然后检查下12489端口是否正常监听
netstat -an | more
因为安装时候需要的模块已经勾选了,所以配置文件中不用再作设置。否则可以通过去掉每个模块前的;来启用该模块。
到这里即完成了windows server 2012上的配置。接下来我们设置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模块,然后保存。
接着编辑
找到并设置监控的服务器:
设置被监控主机名和被监控的windows服务器地址。
此地址为linux服务端的ip地址
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 }
接下来搜索各种监控的服务并设置:
#监控nsclient版本。 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 } #监控服务器在线时间。 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 } #监控服务器cpu负载。 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 } #监控服务器的内存占用。 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 } #监控系统c盘的磁盘占用。 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 }
进入目录 /usr/local/nagios/libexec/
在nagios监控端验证是否可以监控到windows主机,用命令./check_nt -h 192.168.13.132 -p 12489 -v uptime可以检测到windows服务器已经启动的时长,也表示可以从windows服务器拿到数据了。
现在就可以登录到nagios的web界面,查看你的监控信息了
网站设计哪个好,具有什么特点?网站推广,学会这些帮你省一半费用老域名利于网站建设吗?从建站角度谈域名选择注册top域名格式有哪些要求?云服务器开私服需要备案吗网站云服务器一年的费用网站建立之前,需要域名先注册手机网站设计方案有哪些注意事项?手机网站要达到啥要求?