zoukankan      html  css  js  c++  java
  • Nagios 监控windows服务器

    下载:check_mk-1.1.10p2.tar.gz

    压缩包解压缩中agents里面的windows

    安装:check_mk_agent.exe install

    启动服务:net start check_mk_agent

    在windows检查服务状态:telnet 主机名/IP 6556

    从NAGIOS服务器检查状态:telnet 主机名/IP 6556

    修改check_mk服务器列表:vi /etc/check_mk/main.mk

    all_hosts参数添加windows服务器名

    例如:all_hosts = ['localhost','windows主机名',]

    重构check_mk服务列表:check_mk -L

    更新nagios:check_mk -O

    重启nagios服务:

    SUSE:/etc/init.d/nagios restart

    CentOS:service nagios restart

    Windows 下 NSClient++ 的建置

    1.取得最新版本:(Download)

    Windows Client 端「NSClient++」:NSClient++-Win32-0.3.0.zip(NSClient++-Win32-VERSION.zip)
    架构如下:


    参考官方网页
    http://nagios.sourceforge.net/docs/3_0/monitoring-windows.html

    2.解压缩 NSClient++-Win32-0.3.0.zip

    于 C:\ 下解压缩为 C:\NSClient++

    3.安装 NSClient++

    开启 cmd,切换到 C:\NSClient++,执行 NSClient++ /install 进行安装

    执行 NSClient++ SysTray install 注意大小写,这一步是安装系统小图标


    4.编辑 C:\NSClient++ 下的 NSC.ini 文件

    [modules] 中,所有的 .dll 注释都全都去掉,除了 CheckWMI.dll and RemoteConfiguration.dll
    [Settings] 中,'password' 这个项目是在设置密码,作用是在 nagios 监控主机进行联机时,要求提供密码才能进一步进行联机,这里为了方便起见,跳过它,不要设定密码。
    [Settings] 中,'allowed_hosts' 选项的 mark 去掉,并且加上 nagios 的监控主机的 IP,修改如下 allowed_hosts=127.0.0.1/32,192.168.0.11 以逗点相隔。
    [NSClient] 中,'port' 选项的 mark 须要拿掉,并且它的值是 '12489',这是 NSClient 的预设 port

    ● 设定完成之后,启动 NSClient++

    在 cmd 中 C:\NSClient++ 下,执行 NSClient++ /start


    在 cmd 下,执行 netstat -an ,检查 port 12489 是否开启


    5.监控端主机的设定:

    ● libexec 下须要 check_nt 执行程序。

    ● 设定 commands.cfg
    增加:
    # 'check_nt' windows client command definition for remote service
    define command{
            command_name    check_nt
            command_line    $USER1$/check_nt -H $HOSTADDRESS$ -p 12489  -v $ARG1$ $ARG2$
            }

    ● 设定主要监控项目 service.cfg

    # 监控 windows 主机的开机运作时间
    define service{
            use                             remote-service         ; Name of service template to use
            hostgroup_name                    windows-servers
            service_description             System Uptime
            check_command                   check_nt!UPTIME
            }
    # 监控 windows 主机的 CPU 负载
    define service{
            use                             remote-service         ; Name of service template to use
            hostgroup_name                    windows-servers
            service_description             CPU Load
            check_command                   check_nt!CPULOAD!-l 5,80,90
            }
    监控 windows 主机的内存使用状况
    define service{
            use                             remote-service         ; Name of service template to use
            hostgroup_name                    windows-servers
            service_description             Memory usage
            check_command                   check_nt!MEMUSE!-w 80 -c 90
            }
    监控 windows 主机的 C:\ 的空间使用量
    define service{
            use                             remote-service         ; Name of service template to use
            hostgroup_name                    windows-servers
            service_description             c:\ - total
            check_command                   check_nt!USEDDISKSPACE!-l c -w 80 -c 90
            }
    另外还有:
    监控 windows 主机的 MSSQLSERVER 服务的运作状况,如服务终止了,则会发 CRITICAL
    check_command           check_nt!SERVICESTATE!-d SHOWALL -l MSSQLSERVER
    监控 windows 主机的 Explorer.exe 执行程序的运作状况,如程序终止了,则会发 CRITICAL
    check_command           check_nt!PROCSTATE!-d SHOWALL -l Explorer.exe

    6.问题排除

    2008-02-12 17:44:24: error:.\PDHCollector.cpp:99: Detected language: 0x0404 but it could not be found in: counters.defs
    2008-02-12 17:44:24: error:.\PDHCollector.cpp:100: You need to manually configure performance counters!
    ● 初步安装好时, NSClient++ 会有上述的错误,原因是操作语系的问题,NSClient++ 默认支持 OS 的语言并不多,所以这部份须进行手动配置,检示错误讯息为「0x0404」这个语系,直接复制「English US」这个项目内所有的数据,以「0x0404」这个语系取代,如下: 
    修改 C:\NSClient++ 下 counters.defs 这个档案
    [0x0404]
    Description = "Chinese BIG5"
    NT4_SystemTotalProcessorTime = "\System\% Total Processor Time"
    NT4_SystemSystemUpTime = "\System\System Up Time"
    NT4_MemoryCommitLimit = "\Memory\Commit Limit"
    NT4_MemoryCommitByte = "\Memory\Committed Bytes"

    W2K_SystemTotalProcessorTime = "\Processor(_total)\% Processor Time"
    W2K_SystemSystemUpTime = "\System\System Up Time"
    W2K_MemoryCommitLimit = "\Memory\Commit Limit"
    W2K_MemoryCommitByte = "\Memory\Committed Bytes"

    ● 修改完后,重开 NSClient++ 即可

  • 相关阅读:
    JavaScript实现常用的排序算法
    jQuery学习之路(8)- 表单验证插件-Validation
    jQuery学习之路(7)- 用原生JavaScript实现jQuery的某些简单功能
    jQuery学习之路(6)- 简单的表格应用
    jQuery学习之路(5)- 简单的表单应用
    jQuery学习之路(4)- 动画
    JavaScript常见的五种数组去重的方式
    jQuery学习之路(3)- 事件
    jQuery学习之路(2)-DOM操作
    Docker使用非root用户
  • 原文地址:https://www.cnblogs.com/alanjl/p/3048773.html
Copyright © 2011-2022 走看看