Nagios监控Windows server 2003 系统

简介:

 一、Nagios监控主机配置

[root@nagios ~]# cp /usr/local/nagios/etc/nagios.cfg /usr/local/nagios/etc/nagios.cfgbak20130318   //备份nagios.cfg

编辑nagios.cfg配置文件

[root@nagios ~]# vim /usr/local/nagios/etc/nagios.cfg

把下面这行最前面的#号去掉:

39 #cfg_file=/usr/local/nagios/etc/objects/windows.cfg

修改为:#去掉这句话的注释

39 cfg_file=/usr/local/nagios/etc/objects/windows.cfg

 

编辑windows.cfg配置 文件

[root@nagios ~]# vim /usr/local/nagios/etc/objects/windows.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       winserver       ; The name we're giving to this host

        alias           My Windows Server       ; A longer name associated with the host

        address         10.10.10.252      ; IP address of the host

        }

###############################################################################

###############################################################################

#

# HOST GROUP DEFINITIONS

#

###############################################################################

###############################################################################

# 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               winserver

        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               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 5,80,90

        }

 

# 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

        }

 

define service{

        use                     generic-service

        host_name               winserver

        service_description     D:\ Drive Space

        check_command           check_nt!USEDDISKSPACE!-l d -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               winserver

        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               winserver

        service_description     Explorer

        check_command           check_nt!PROCSTATE!-d SHOWALL -l Explorer.exe

        }

:wq

 

重启Nagios httpd 服务

[root@nagios ~]# service nagios restart

[root@nagios ~]# service httpd restart

 

二、Windows被监控主机配置

NSClient++Nagios服务器通信,主要使用Nagios服务器的check_nt插件。原理图如下

 

1、下载NSClient++插件

http://nsclient.org/nscp/downloads

http://files.nsclient.org/0.3.x/NSClient%2B%2B-0.3.9-Win32.zip

http://files.nsclient.org/0.3.x/NSClient%2B%2B-0.3.9-x64.zip

 

2NSClient++安装插件与配置

解压到C盘:

C:\NSClient++-0.3.9-Win32

打开cmd 切换到C:\>cd C:\NSClient++-0.3.9-Win32

执行NSClient++ /install进行安装

Microsoft Windows [版本 5.2.3790]

(C) 版权所有 1985-2003 Microsoft Corp.

C:\Documents and Settings\Administrator>cd C:\NSClient++-0.3.9-Win32

C:\NSClient++-0.3.9-Win32>NSClient++ /install

Service NSClientpp installed...

l NSClient++.cpp(233) Service installed!

 

执行nsclient++ SysTray 注意大小写,这一步是安装系统托盘,时间稍微有点长

C:\NSClient++-0.3.9-Win32>NSClient++ SysTray

d NSClient++.cpp(1216) Enabling debug mode...

Invalid command line argument: SysTray

Usage: -version, -about, -install, -uninstall, -start, -stop, -encrypt

Usage: [-noboot] <ModuleName> <commnd> [arguments]

 

在运行里面输入services.msc打开”服务”

看到下图就说明NSClient服务已经安装上了

双击打开,点”登录”标签,在”允许服务与桌面交互”前打勾

编辑C:\NSClient++-0.3.9-Win32下的nsc.ini文件

[modules]选项

所有模块前面的注释都去掉,除了CheckWMI.dll and RemoteConfiguration.dll这两个;

[Settings]选项

password选项来设置密码,作用是在nagios连接过来时要求提供密码.这一步是可选,我这里方便起见跳过它,不要密码;

allowed_hosts选项的注释去掉,并且加上运行nagios的监控主机的IP.我改为如下:allowed_hosts=127.0.0.1/32,10.10.10.254 以逗号相隔.这个地方是支持子网的,如果写成192.168.0.0/24则表示该子网内的所有机器都可以访问.如果这个地方是空白则表示所有的主机都可以连接上来.注意是[Settings]部分的,因为[NSClient]部分也有这个选项;

[NSClient]选项

port选项去掉注释,并且它的值是'12489',这是NSClient的默认监听端口;

 

CMD中执行NSClient++ /start启动服务,注意所在目录是C:\NSClient++-0.3.9-Win32

C:\NSClient++-0.3.9-Win32>NSClient++ /start

Starting NSClientpp

 

cmd里面执行netstat an可以看到已经开始监听tcp12489端口了

C:\NSClient++-Win32-0.3.5>netstat -an

TCP    0.0.0.0:12489    0.0.0.0:0     LISTENING

 

已经正常启动了.注意服务默认设的是”自动”,也就是说是开机自动启动的.

这时在桌面右下角的系统托盘处会出现一个图标

这样被Windows server 2003监控机的配置完成,它就等待nagios发出某个监控请求,然后它执行请求将监控的结果发回到nagios监控主机上。

 

最后,在服务端监控端执行检测windows server 2003工作站nrpe信息

[root@nagios ~]# /usr/local/nagios/libexec/check_nrpe -H 10.10.10.252

I (0.3.9.329 2011-09-02) seem to be doing fine...

 

验证通过,测试完成!

 

3、登录到WEB界面

输入用户名密码:nagiosadmin  123456

http://localhost/nagios

Services




本文转自 yhw85 51CTO博客,原文链接:http://blog.51cto.com/yanghuawu/1156806,如需转载请自行联系原作者

相关文章
|
6天前
|
安全 Unix 虚拟化
Windows 7 & Windows Server 2008 R2 简体中文版下载 (2025 年 2 月更新)
Windows 7 & Windows Server 2008 R2 简体中文版下载 (2025 年 2 月更新)
32 11
Windows 7 & Windows Server 2008 R2 简体中文版下载 (2025 年 2 月更新)
|
6天前
|
Unix 虚拟化 Windows
Windows Server 2025 中文版、英文版下载 (2025 年 2 月更新)
Windows Server 2025 中文版、英文版下载 (2025 年 2 月更新)
28 7
Windows Server 2025 中文版、英文版下载 (2025 年 2 月更新)
|
6天前
|
安全 虚拟化 Windows
Windows Server 2019 中文版、英文版下载 (2025 年 2 月更新)
Windows Server 2019 中文版、英文版下载 (2025 年 2 月更新)
41 22
|
13天前
|
安全 网络安全 数据安全/隐私保护
Windows Server 2025 Active Directory 重置用户密码
密码重置是管理员日常任务之一,用户因忘记或多次输错密码导致账户锁定时需进行重置。本文介绍在Active Directory服务器上重置密码的三种方法。
|
1月前
|
监控 搜索推荐 开发工具
2025年1月9日更新Windows操作系统个人使用-禁用掉一下一些不必要的服务-关闭占用资源的进程-禁用服务提升系统运行速度-让电脑不再卡顿-优雅草央千澈-长期更新
2025年1月9日更新Windows操作系统个人使用-禁用掉一下一些不必要的服务-关闭占用资源的进程-禁用服务提升系统运行速度-让电脑不再卡顿-优雅草央千澈-长期更新
162 2
2025年1月9日更新Windows操作系统个人使用-禁用掉一下一些不必要的服务-关闭占用资源的进程-禁用服务提升系统运行速度-让电脑不再卡顿-优雅草央千澈-长期更新
|
2月前
|
安全 关系型数据库 MySQL
Windows Server 安装 MySQL 8.0 详细指南
安装 MySQL 需要谨慎,特别注意安全配置和权限管理。根据实际业务需求调整配置,确保数据库的性能和安全。
302 9
|
3月前
|
安全 Windows
【Azure Cloud Service】在Windows系统中抓取网络包 ( 不需要另外安全抓包工具)
通常,在生产环境中,为了保证系统环境的安全和纯粹,是不建议安装其它软件或排查工具(如果可以安装,也是需要走审批流程)。 本文将介绍一种,不用安装Wireshark / tcpdump 等工具,使用Windows系统自带的 netsh trace 命令来获取网络包的步骤
106 32
|
3月前
|
存储 负载均衡 Java
如何配置Windows主机MPIO多路径访问存储系统
Windows主机多路径(MPIO)是一种技术,用于在客户端计算机上配置多个路径到存储设备,以提高数据访问的可靠性和性能。本文以Windows2012 R2版本为例介绍如何在客户端主机和存储系统配置多路径访问。
225 13
如何配置Windows主机MPIO多路径访问存储系统
|
3月前
|
网络安全 Windows
Windows server 2012R2系统安装远程桌面服务后无法多用户同时登录是什么原因?
【11月更文挑战第15天】本文介绍了在Windows Server 2012 R2中遇到的多用户无法同时登录远程桌面的问题及其解决方法,包括许可模式限制、组策略配置问题、远程桌面服务配置错误以及网络和防火墙问题四个方面的原因分析及对应的解决方案。
239 4
|
3月前
|
监控 安全 网络安全
使用EventLog Analyzer日志分析工具监测 Windows Server 安全威胁
Windows服务器面临多重威胁,包括勒索软件、DoS攻击、内部威胁、恶意软件感染、网络钓鱼、暴力破解、漏洞利用、Web应用攻击及配置错误等。这些威胁严重威胁服务器安全与业务连续性。EventLog Analyzer通过日志管理和威胁分析,有效检测并应对上述威胁,提升服务器安全性,确保服务稳定运行。
103 2