Nagios监测Windows服务器的一个指定进程,要怎么实现

Nagios监测Windows服务器的一个指定进程,要怎么实现,第1张

Windows服务器的监控方式有三种,分别为Agent监测方式、SNMP监测方式和WMI监测方式,下面分别对每一种监测方式进行介绍:

Agent监测方式

使用Agent方式来采集数据,首先需要在被监测服务器上安装Windows Agent代理程序,安装过程请参考安装Agent代理。

1、登录CreCloud云网管平台后,点击系统右上方的【监测】按钮,再点击左下方的【设备管理】。右键点击【设备管理】树下的【设备列表】,d出菜单。

(也可在设备列表的空白处【图标视图】和【详细信息】中右键选择【增加管理对象】或在快速工具栏中点击【增加管理对象】,下同)

2、选择【增加管理对象】,d出【添加管理对象】对话框,在【全部设备】下看到“AgentWindows”。

选中上图中的【AgentWindows】,点击【确定】,d出【AgentWindows】对话框,如下图所示(也可左键双击【AgentWindows】d出下面对话框)。

3、在“基本设置”栏下进行设置:

Windows服务器地址:输入被监测的服务器的IP地址

Agent端口号:Agent端口,默认为2198

标题:填写显示的标题,可以自己定义

是否禁止:禁止则不进行监测

监测服务器:默认即可

4、在“高级设置”栏可以对该管理对象进行详细描述以及设置依靠条件,如下图:

依靠:从下拉列表中选择要依靠的监测点,可以设置多个监测点依靠。

描述:填写对该设备的简单描述,可以不填写。

5、“基本设置”和“高级设置”填写完毕,点击【确定】即可,d出显示正在获取管理对象属性提示框。如果获取正常,就会d出【配置监测点】对话框。

勾选要监测的选项后,点击右边的【确定】即可,Agent监测方式添加完成。添加完成后,在【设备管理】的树下和设备列表的图标视图中都会有添加的设备显示。

SNMP监测方式

注意:如果采用SNMP方式监控,请检查远程机器的SNMP协议是否打开 。

1、登录CreCloud云网管平台后,点击系统右上方的【监测】按钮。

再点击左下方的【设备管理】,如下图所示:

2、右键点击【设备管理】树下的【设备列表】,d出菜单,如下图所示:

3、选择【增加管理对象】,d出【添加管理对象】对话框,在【全部设备】下选择设备类型为“SNMP Windows”,点击【确定】,如下图所示:

4、选择“SNMP Windows”,点击【确定】后,d出如下图所示对话框:

5、“基本设置”选项卡:

Windows服务器IP:填写被监测服务器的IP地址

SNMP端口号:填写SNMP的端口号

可读共同体名称:填写SNMP的可读共同体名称

标题:填写显示的标题

监测服务器:默认即可

6、“高级设置”选项卡:

该选项卡中的设置和Agent中的设置相同。

点击【确定】后,SNMP Windows的监测方式添加完成。添加完成后在设备管理中设备列表下和右侧【设备列表】的图标视图中都会有该设备。

WMI监测方式

注意:如果用WMI方式,需要安装WMI和服务

1、用WMI方式监测,需要将CreCloud Task Server 服务改为用管理员用户启动。

CreCloud Task Server 服务右键“属性”,选择“登录”选项卡

登录帐户选择“此帐户”,点击“浏览”按钮,d出“选择用户”窗口

点击“高级”按钮后,点击“一般性查询”右侧的“立即查找”按钮,在下方查询结果中选择“Administartor”用户后确定

返回到属性窗口,点击确认,并重启CreCloud Task Server服务

2、登录CreCloud云网管平台后,点击系统右上方的【监测】按钮。

再点击左下方的【设备管理】,如下图所示:

3、右键点击【设备管理】树下的【设备列表】,d出菜单,如下图所示:

4、选择【增加管理对象】,d出【添加管理对象】对话框,在【全部设备】下选择设备类型为“WMI Windows”,点击【确定】,如下图所示:

点击【确定】后,d出如下图对话框:

5、“基本设置”选项卡

Windows服务器IP:填写被监测的服务器的IP地址

登录名:填写被监测的服务器的系统管理员名称

登陆密码:填写被监测服务器的系统管理员密码

标题:填写显示的标题

6、“高级设置”选项卡中设置和以Agent、SNMP方式中的设置相同。

7、点击【确定】后,WMI Windows的监测方式添加完成,完成后会在设备管理中设备列表下和右侧【设备列表】的图标视图中都会有该设备。

监控主机配置:redhat linux as4,nagios3

被监控主机:Windows Server 2008 R2 Enterprise,nsclient++0.4.4.172

Nagios是一款开源的免费网络监视工具,其功能强大,灵活性强。能有效监控Windows、Linux和Unix的主机状态,交换机路由器等网络设置,打印机等。nagios监控windows系统有三种实现方式:SNMP、NSClient++、NRPE。

下面介绍使用NSClient++方式来监控Windows:

首先在windows下安装nsclient++,运行NSCP-0.4.0.172-x64.msi安装文件,一步一步往下走,其中需要设置nagios监控主机IP和NSClient密码(值当使用check_nt时使用),如图1所示:

Allowed hosts:填写nagios监控主机IP

NSClient Password:当使用命令check_nt时需要设置密码,根据自己情况设置

Module to load:根据自己的需要选择相应的模块

安装完毕以后,打开windows服务管理器,查看nsclient服务是否启动,如图2所示:

然后在nagios监控主机上面进行相关的配置,主要涉及两个配置文件nagios.cfg和windows.cfg

(1)因为nagios是模块化调用,先到配置文件打开windows相关模块,编辑nagios.cfg文件

[root@localhost etc]# ls

cgi.cfg htpasswd nagios.cfg nrpe.cfg objects objects.bak objects.tar resource.cfg

[root@localhost etc]# pwd

/usr/local/nagios/etc

[root@localhost etc]# vi nagios.cfg

将#cfg_file=/usr/local/nagios/etc/objects/windows.cfg该行前面的#注释去掉即可.

(1)修改windows.cfg配置文件,需要修改define host和define service两部分

# 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 video4-beijing The name we're giving to this host 被监控主机的主机名

alias video4-beijing A longer name associated with the host

contact_groupssa

address 10.12.4.169 IP address of the host 被监控主机的IP

}

# 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 video4-beijing

service_description CPU Load

check_command check_nt!CPULOAD!-l 5,80,90

contact_groups sa

}

# 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 video4-beijing

service_description Memory Usage

check_command check_nt!MEMUSE!-w 80 -c 90

contact_groups sa

}

# 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 video4-beijing

service_description C:\ Drive Space

check_command check_nt!USEDDISKSPACE!-l c -w 80 -c 90

contact_groups sa

}

修改完相关的配置文件以后,执行如下命令检查配置文件是否正确:

[root@localhost objects]# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

遇到的问题,在检查配置文件时错误信息如下:

Checking services...

Error: Contact group 'admins' specified in service 'C:\ Drive Space' for host 'video4-beijing' is not defined anywhere!

Error: Contact group 'admins' specified in service 'Explorer' for host 'video4-beijing' is not defined anywhere!

Error: Contact group 'admins' specified in service 'Memory Usage' for host 'video4-beijing' is not defined anywhere!

Checked 14 services.

Checking hosts...

Error: Contact group 'admins' specified in host 'video4-beijing' is not defined anywhere!

Checked 7 hosts.

Checking host groups...

Checked 2 host groups.

Checking service groups...

Checked 0 service groups.

Checking contacts...

Checked 1 contacts.

Checking contact groups...

Checked 1 contact groups.

Checking service escalations...

Checked 0 service escalations.

Checking service dependencies...

Checked 0 service dependencies.

Checking host escalations...

Checked 0 host escalations.

Checking host dependencies...

Checked 0 host dependencies.

Checking commands...

Checked 25 commands.

Checking time periods...

Checked 5 time periods.

Checking for circular paths between hosts...

Checking for circular host and service dependencies...

Checking global event handlers...

Checking obsessive compulsive processor commands...

Checking misc settings...

Total Warnings: 0

Total Errors: 4

***>One or more problems was encountered while running the pre-flight check...

Check your configuration file(s) to ensure that they contain valid

directives and data defintions. If you are upgrading from a previous

version of Nagios, you should be aware that some variables/definitions

may have been removed or modified in this version. Make sure to read

the HTML documentation regarding the config files, as well as the

'Whats New' section to find out what has changed.

以上问题的原因是因为一开始在windows.cfg文件中定义host和service时没有增加contact_groups sa这个字段,host和service默认所在的contact_group为admins,而我的nagios监控主机contacts.cfg文件中配置的contactgroup为sa。


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/bake/11232696.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-14
下一篇 2023-05-14

发表评论

登录后才能评论

评论列表(0条)

保存