- 在被监控的Windows server 主机上安装NSClinet++
下载地址:https://www.nsclient.org/download/
32bit:http://files.nsclient.org/released/NSCP-0.4.3.143-Win32.msi
64bit:http://files.nsclient.org/released/NSCP-0.4.3.143-x64.msi
安装过程中会提示填写监控端的IP地址和密码,以及勾选所有的Modules,如下图所示:
按win + R 键,输入:services.msc, 若NSClient++服务已启动则运行正常。
默认安装目录为:C:\Program Files\NSClient++, nsclient.ini为NSClient的配置文件,当监控服务器IP改变时,需要修改此文件
注意,防火墙需要开通TCP的12489端口,否则Nagios检查此服务会提示错误 - 修改监控端服务器
检查windows server 监控能否正常工作
cd /usr/lib64/nagios/plugins
./check_nt -H 10.10.0.124 -p 12489 -s Hello2014 -v USEDDISKSPACE -w 80 -c 90 -l C
./check_nt -H 10.10.0.124 -p 12489 -s Hello2014 -v UPTIME
./check_nt -H 10.10.0.124 -p 12489 -s Hello2014 -v MEMUSE
./check_nt -H 10.10.0.142 -p 12489 -s Hello2014 -v USEDDISKSPACE -l c -w 80 -c 90
定义windows执行命令
vi /etc/nagios/objects/commands.cfg# vi commands.cfg
define command{
command_name check_win
command_line $USER1$/check_nt -H "$HOSTADDRESS$" -p -s -v $ARG1$ $ARG2$
} # $..$表示系统内置的宏,也就是所谓的变量
# $USER1$表示插件所在的目录
# -H 指定主机地址
# $HOSTADDRESS$ 应用到哪个主机,就用哪个主机的地址
# $ARG1$传递的参数,形参
# -s指定密码,如果有需要加,如上面安装时设置了密码为123456commands.cfg Code
定义主机
define host{
use generic-host
host_name windows-server
alias win server
address 10.10.0.124
}host.cfg
定义服务
define service{
use generic-service
host_name windows_server
service_description NSClient++ Version
check_command check_win!CLIENTVERSION
} define service{
use generic-service
host_name windows_server
service_description Uptime
check_command check_win!UPTIME
} define service{
use generic-service
host_name windows_server
service_description CPU Load
check_command check_win!CPULOAD! -l ,,
} define service{
use generic-service
host_name windows_server
service_description Memory Usage
check_command check_win!MEMUSE! -w -c
} define service{
use generic-service
host_name windows_server
service_description C: Drive Space
check_command check_win!USEDDISKSPACE -l c -w -c
} define service{
use generic-service
host_name windows_server
service_description D: Drive Space
check_command check_win!USEDDISKSPACE -l d -w -c
} define service{
use generic-service
host_name windows_server
service_description TCP
check_command check_tcp!
}services.cfg
检查配置是否正常,重启nagios
参考文档:http://skypegnu1.blog.51cto.com/8991766/1533590
相关文章
- nagios 配置 check_traffic 流量监控模块(Server 端)
- DHCP Server (推荐使用Windows)
- 使用微软分布式缓存服务Velocity(Windows Server AppFabric Caching Service)
- 外网zabbix-server使用主动模式监控公司内网windows服务器
- 在Windows Server 2008 R2中使用web方式修改域用户账户密码
- Windows Server 2008 R2服务器内存使用率过高,但与任务管理器中进程占用内存和不一致
- 使用Gitblit 在windows 上部署你的Git Server
- Python监控SQL Server数据库服务器磁盘使用情况
- windows server中使用nginx进行负载均衡
- 使用Windows身份验证模式连接到VM上的SQL Server实例