免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 3417 | 回复: 1
打印 上一主题 下一主题

Nagios3.0.5在CentOS5.2中安装(三)--使用Nagios监控Windows服务器 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2011-05-05 22:29 |只看该作者 |倒序浏览
使用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
        }
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

作者:石头 来源:http://blog.sina.com.cn/s/blog_4e424e210100b6vk.html

论坛徽章:
0
2 [报告]
发表于 2011-05-19 21:37 |只看该作者
测试过nagios监控另一个网段的windows主机吗?

我现在设置同一网段正常, 但是nagios要监视另一个网段的windows主机, 出现错误. 网络是联通的.可以查看我写的<<naigos如何跨网段监控???>> .... 跨网段监视一直不成功.
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP