网络运营 > 服务器 > Windows

Nagios监控Windows Server 2008配置方法

289人参与2019-05-31

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 2008 R2防火墙,允许被ping的设置方法

05-29

Windows Server 2012 R2或2016无法安装.NET Framework 3.5.1的解决方法

05-28

IIS部署asp.net报404错误的解决方法

04-18

win2003 iis配置PHP环境图文教程

06-01

通过windows自带的系统监视器来查看IIS并发连接数(perfmon.msc)

05-31

Windows平台的 PHP 报错 Fatal error: Class COM not found in 的解决方法

04-17

iis应用程序池监控方法实例

05-31

Windows安装MySQL8.0.16 的步骤及出现错误问题解决方法

07-18

热门评论