Nagios针对Windows的监控操作指南之SNMP方式
2011-03-31 11:37
543 查看
此种方式通过snmp协议来获取Windows主机的相关系统信息。因此Windows端必须配置SNMP服务,Nagios端要安装net-snmp包;
安装配置过程如下:
Windows 端:
配置SNMP Service:
按照以下方式配置,
安装:
1、安装并启动snmp服务
![](https://oscdn.geek-share.com/Uploads/Images/Content/201103/4b9c42550fcf7f58e8973b1e715f8d12.gif)
1.GIF
![](https://oscdn.geek-share.com/Uploads/Images/Content/201103/c2b011a6df76f873ef9d2165befeba18.gif)
2.GIF
2、配置snmp community 和允许的主机列表
![](https://oscdn.geek-share.com/Uploads/Images/Content/201103/43be9976ff0871e70e16b34ed7e0c60e.gif)
3.GIF
3、开通防火墙的snmp协议端口udp 161(例如可以只允许Nagios Server如nagios.itnms.net访问)。
4、简单测试如下:
检测snmp service的运行状态:
H:/Chenl/bin>net start | grep -i snmp
SNMP Service
检查端口Listen情况:
H:/Chenl/bin>netstat -an | grep 161
UDP 0.0.0.0:161 *:*
Nagios Server端:
Server的安装配置已经说过很多,此处不在重复。有不明了的可以参考本论坛以前的文档。
其重要注明的有以下几点:
1)Server端需要安装net-snmp包。
可从如下地址下载,http://net-snmp.sourceforge.net/。
也可以通过安装盘,或者通过yum,apt等工具在线安装。
2)除了标准的plugins之后,还需要安装nagios-snmp-plugins,本文中使用的是V-1.1.1版本。
可从以下地址获取最新版本:http://sourceforge.net/projects/nagios-snmp
3)本文中还是用了一些自定义的plugins(使用net-snmp-utils和bash编写)如其中check_snmp_conn及check_snmp_proc。
这些plugins在CentOS4.4下测试通过,不保证在所有的平台下都可以正常工作。
部分配置文件示例如下:
checkcommands.cfg:
# 'check_snmp_stor" command definition
define command{
command_name check_snmp_stor
command_line $USER1$/check_snmp_storage.pl -H $HOSTADDRESS$ -C $ARG1$ -m $ARG2$ -w $ARG3$ -c $ARG4$
}
# 'check_snmp_load" command definition
define command{
command_name check_snmp_load
command_line $USER1$/check_snmp_load.pl -H $HOSTADDRESS$ -C $ARG1$ -w $ARG2$ -c $ARG3$
}
# 'check_snmp_proc" command definition
define command{
command_name check_snmp_proc
command_line $USER1$/check_snmp_proc $HOSTADDRESS$ $ARG1$ $ARG2$ $ARG3$ $ARG4$ $ARG5$ $ARG6$
}
# 'check_snmp_conn" command definition
define command{
command_name check_snmp_conn
command_line $USER1$/check_snmp_conn $HOSTADDRESS$ $ARG1$ $ARG2$ $ARG3$ $ARG4$ $ARG5$ $ARG6$
}
v-win2003.cfg:
define service{
use generic-service ; Name of service template to use
host_name v-win2003
service_description check_disk_c
is_volatile 0
check_period 24x7
max_check_attempts 4
normal_check_interval 5
retry_check_interval 1
contact_groups admins
notification_options w,u,c,r
notification_interval 960
notification_period 24x7
check_command check_snmp_stor!naios4windows!"^C"!80!90
}
define service{
use generic-service ; Name of service template to use
host_name v-win2003
service_description check_mem_phy
is_volatile 0
check_period 24x7
max_check_attempts 4
normal_check_interval 5
retry_check_interval 1
contact_groups admins
notification_options w,u,c,r
notification_interval 960
notification_period 24x7
check_command check_snmp_stor!naios4windows!"^Physical Memory$"!60!90
}
define service{
use generic-service ; Name of service template to use
host_name v-win2003
service_description check_load
is_volatile 0
check_period 24x7
max_check_attempts 4
normal_check_interval 5
retry_check_interval 1
contact_groups admins
notification_options w,u,c,r
notification_interval 960
notification_period 24x7
check_command check_snmp_load!naios4windows!75%!90%
}
define service{
use generic-service ; Name of service template to use
host_name v-win2003
service_description check_proc_mysqld-nt
is_volatile 0
check_period 24x7
max_check_attempts 4
normal_check_interval 5
retry_check_interval 1
contact_groups admins
notification_options w,u,c,r
notification_interval 960
notification_period 24x7
check_command check_snmp_proc!naios4windows!mysqld-nt.exe!0!0
}
define service{
use generic-service ; Name of service template to use
host_name v-win2003
service_description check_proc_w3wp
is_volatile 0
check_period 24x7
max_check_attempts 4
normal_check_interval 5
retry_check_interval 1
contact_groups admins
notification_options w,u,c,r
notification_interval 960
notification_period 24x7
check_command check_snmp_proc!naios4windows!w3wp.exe!0!0
}
define service{
use generic-service ; Name of service template to use
host_name v-win2003
service_description check_conn_554
is_volatile 0
check_period 24x7
max_check_attempts 4
normal_check_interval 5
retry_check_interval 1
contact_groups admins
notification_options w,u,c,r
notification_interval 960
notification_period 24x7
check_command check_snmp_conn!naios4windows!.1.3.6.1.2.1.6.13!554!5!3
}
define service{
use generic-service ; Name of service template to use
host_name v-win2003
service_description check_conn_80
is_volatile 0
check_period 24x7
max_check_attempts 4
normal_check_interval 5
retry_check_interval 1
contact_groups admins
notification_options w,u,c,r
notification_interval 960
notification_period 24x7
check_command check_snmp_conn!naios4windows!.1.3.6.1.2.1.6.13!80!5!3
}
安装配置过程如下:
Windows 端:
配置SNMP Service:
按照以下方式配置,
安装:
1、安装并启动snmp服务
![](https://oscdn.geek-share.com/Uploads/Images/Content/201103/4b9c42550fcf7f58e8973b1e715f8d12.gif)
1.GIF
![](https://oscdn.geek-share.com/Uploads/Images/Content/201103/c2b011a6df76f873ef9d2165befeba18.gif)
2.GIF
2、配置snmp community 和允许的主机列表
![](https://oscdn.geek-share.com/Uploads/Images/Content/201103/43be9976ff0871e70e16b34ed7e0c60e.gif)
3.GIF
3、开通防火墙的snmp协议端口udp 161(例如可以只允许Nagios Server如nagios.itnms.net访问)。
4、简单测试如下:
检测snmp service的运行状态:
H:/Chenl/bin>net start | grep -i snmp
SNMP Service
检查端口Listen情况:
H:/Chenl/bin>netstat -an | grep 161
UDP 0.0.0.0:161 *:*
Nagios Server端:
Server的安装配置已经说过很多,此处不在重复。有不明了的可以参考本论坛以前的文档。
其重要注明的有以下几点:
1)Server端需要安装net-snmp包。
可从如下地址下载,http://net-snmp.sourceforge.net/。
也可以通过安装盘,或者通过yum,apt等工具在线安装。
2)除了标准的plugins之后,还需要安装nagios-snmp-plugins,本文中使用的是V-1.1.1版本。
可从以下地址获取最新版本:http://sourceforge.net/projects/nagios-snmp
3)本文中还是用了一些自定义的plugins(使用net-snmp-utils和bash编写)如其中check_snmp_conn及check_snmp_proc。
这些plugins在CentOS4.4下测试通过,不保证在所有的平台下都可以正常工作。
部分配置文件示例如下:
checkcommands.cfg:
# 'check_snmp_stor" command definition
define command{
command_name check_snmp_stor
command_line $USER1$/check_snmp_storage.pl -H $HOSTADDRESS$ -C $ARG1$ -m $ARG2$ -w $ARG3$ -c $ARG4$
}
# 'check_snmp_load" command definition
define command{
command_name check_snmp_load
command_line $USER1$/check_snmp_load.pl -H $HOSTADDRESS$ -C $ARG1$ -w $ARG2$ -c $ARG3$
}
# 'check_snmp_proc" command definition
define command{
command_name check_snmp_proc
command_line $USER1$/check_snmp_proc $HOSTADDRESS$ $ARG1$ $ARG2$ $ARG3$ $ARG4$ $ARG5$ $ARG6$
}
# 'check_snmp_conn" command definition
define command{
command_name check_snmp_conn
command_line $USER1$/check_snmp_conn $HOSTADDRESS$ $ARG1$ $ARG2$ $ARG3$ $ARG4$ $ARG5$ $ARG6$
}
v-win2003.cfg:
define service{
use generic-service ; Name of service template to use
host_name v-win2003
service_description check_disk_c
is_volatile 0
check_period 24x7
max_check_attempts 4
normal_check_interval 5
retry_check_interval 1
contact_groups admins
notification_options w,u,c,r
notification_interval 960
notification_period 24x7
check_command check_snmp_stor!naios4windows!"^C"!80!90
}
define service{
use generic-service ; Name of service template to use
host_name v-win2003
service_description check_mem_phy
is_volatile 0
check_period 24x7
max_check_attempts 4
normal_check_interval 5
retry_check_interval 1
contact_groups admins
notification_options w,u,c,r
notification_interval 960
notification_period 24x7
check_command check_snmp_stor!naios4windows!"^Physical Memory$"!60!90
}
define service{
use generic-service ; Name of service template to use
host_name v-win2003
service_description check_load
is_volatile 0
check_period 24x7
max_check_attempts 4
normal_check_interval 5
retry_check_interval 1
contact_groups admins
notification_options w,u,c,r
notification_interval 960
notification_period 24x7
check_command check_snmp_load!naios4windows!75%!90%
}
define service{
use generic-service ; Name of service template to use
host_name v-win2003
service_description check_proc_mysqld-nt
is_volatile 0
check_period 24x7
max_check_attempts 4
normal_check_interval 5
retry_check_interval 1
contact_groups admins
notification_options w,u,c,r
notification_interval 960
notification_period 24x7
check_command check_snmp_proc!naios4windows!mysqld-nt.exe!0!0
}
define service{
use generic-service ; Name of service template to use
host_name v-win2003
service_description check_proc_w3wp
is_volatile 0
check_period 24x7
max_check_attempts 4
normal_check_interval 5
retry_check_interval 1
contact_groups admins
notification_options w,u,c,r
notification_interval 960
notification_period 24x7
check_command check_snmp_proc!naios4windows!w3wp.exe!0!0
}
define service{
use generic-service ; Name of service template to use
host_name v-win2003
service_description check_conn_554
is_volatile 0
check_period 24x7
max_check_attempts 4
normal_check_interval 5
retry_check_interval 1
contact_groups admins
notification_options w,u,c,r
notification_interval 960
notification_period 24x7
check_command check_snmp_conn!naios4windows!.1.3.6.1.2.1.6.13!554!5!3
}
define service{
use generic-service ; Name of service template to use
host_name v-win2003
service_description check_conn_80
is_volatile 0
check_period 24x7
max_check_attempts 4
normal_check_interval 5
retry_check_interval 1
contact_groups admins
notification_options w,u,c,r
notification_interval 960
notification_period 24x7
check_command check_snmp_conn!naios4windows!.1.3.6.1.2.1.6.13!80!5!3
}
相关文章推荐
- Nagios针对Windows的监控操作指南之SNMP方式
- 监控机为Linux主机的nagios安装与配置之利用snmp方式监控远程主机上的“本地信息”
- Nagios监控Windows服务器(SNMP方式)
- Nagios 利用NSClient++的check_nrpe方式使用自定义脚本监控windows
- Nagios使用SNMP方式监控Windows服务器
- 使用Nagios监控Windows服务器CPU利用率(SNMP方式)
- Nagios 利用NSClient++的check_nrpe方式使用自定义脚本监控windows
- nagios监控windows配置文件实例
- Windows系统中监控文件复制操作的几种方式
- Nagios 监控系列学习 ―― check_snmp_int.pl 监控交换机端口状态和流量
- Win7开启SNMP服务(被监控端的Windows主机的SNMP服务配置)
- nagios监控windows主机
- 实战Nagios NSCA方式监控Linux系统资源使用情况 -- Nagios配置篇 -- Nagios Server端
- nagios在第一次监控windows所必须修改的内容
- nagios全攻略(五)----监控windows系统的”本地信息”
- nagios监控windows客户端
- Nagios利用NSClient++监控Windows主机(4)
- nagios全攻略(五)----监控windows系统的”本地信息”
- nagios配置监控windows配置
- nagios监控windows主机 && linux主机 推荐