免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1207 | 回复: 0

Nagios3.0.5在CentOS5.2中安装(三)(转加修改) [复制链接]

论坛徽章:
0
发表于 2009-12-31 09:27 |显示全部楼层

使用Nagios监控Windows服务器
12.Nagios使用NSClient++监控远程Windows主机

下载NSClient++-Win32-0.3.5.msi并安装。
到安装目录打开NSC.ini文件进行修改:
在[modules]模块,将除CheckWMI.dll和RemoteConfiguration.dll外的所有dll文件明前的注释(;)去掉。
在[Settings]模块可以设置一个连接密码password=PWD,为了简单,在此不设密码。设置 allowed_hosts=127.0.0.1/32,192.168.0.19,可以连接的监控服务器的地址,如果写成192.168.0.0/24 则表示该子网内的所有机器都可以访问;如果这个地方是空白则表示所有的主机都可以连接上来(注意在[NSClient]有allowed_hosts的同 样设置,不要设置错了),最后不要忘记去掉前面的注释符(;)。
运行nsclient++
NSClient++ /install
NSClient++ SysTray install
NSClient++ /start
如果有防火墙,请开放相应端口。
创建监控配置文件,使用check_nt命令监控windows系统信息(此命令默认已定义)。
Windows监控示例配置文件:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
[root@tech etc]# cat /usr/local/nagios/etc/servers/print-w-80.cfg
###############################################################################
# WINDOWS.CFG - SAMPLE CONFIG FILE FOR MONITORING A WINDOWS MACHINE
#
# Last Modified: 06-13-2007
#
# NOTES: This config file assumes that you are using the sample configuration
# files that get installed with the Nagios quickstart guide.
#
###############################################################################
###############################################################################
###############################################################################
#
# HOST DEFINITIONS
#
###############################################################################
###############################################################################
# Define a host for the Windows machine we'll be monitoring
# Change the host_name, alias, and address to fit your situation
define host{
use windows-server ; Inherit default values from a template
host_name print80 ; The name we're giving to this host
alias Print80 ; A longer name associated with the host
address 192.168.0.80 ; IP address of the host
}
###############################################################################
###############################################################################
#
# HOST GROUP DEFINITIONS
# 主机组在/usr/local/nagios/etc/servers/hostgroup.cfg中单独配置
###############################################################################
###############################################################################
# Define a hostgroup for Windows machines
# All hosts that use the windows-server template will automatically be a member of this group
#define hostgroup{
# hostgroup_name windows-servers ; The name of the hostgroup
# alias Windows Servers ; Long name of the group
# }
###############################################################################
###############################################################################
#
# SERVICE DEFINITIONS
#
###############################################################################
###############################################################################
# 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 print80
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 print80
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 print80
service_description CPU Load
check_command check_nt!CPULOAD!-l 5,80,90
}
# Create a service for monitoring
# Change the host_name to match the name of the host you defined above
define service{
use generic-service
host_name print80
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 print80
service_description C_Drive_Space
check_command check_nt!USEDDISKSPACE!-l c -w 80 -c 90
}
# Create a service for monitoring the W3SVC service
# Change the host_name to match the name of the host you defined above
define service{
use generic-service
host_name print80
service_description W3SVC
check_command check_nt!SERVICESTATE!-d SHOWALL -l W3SVC
}
# Create a service for monitoring the Explorer.exe process
# Change the host_name to match the name of the host you defined above
define service{
use generic-service
host_name print80
service_description Explorer
check_command check_nt!PROCSTATE!-d SHOWALL -l Explorer.exe
}
#主机组配置文件
[root@tech etc]# cat /usr/local/nagios/etc/servers/hostgroup.cfg
define hostgroup{
hostgroup_name linux-servers ; The name of the hostgroup
alias Linux Servers ; Long name of the group
members localhost,wiki ; Comma separated list of hosts that belong to this group
}
define hostgroup{
hostgroup_name windows-servers ; The name of the hostgroup
alias Windows Servers ; Long name of the group
members print80 ; Comma separated list of hosts that belong to this group
}
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u3/109134/showart_2136050.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP