Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2342989
  • 博文数量: 2110
  • 博客积分: 18861
  • 博客等级: 上将
  • 技术积分: 24420
  • 用 户 组: 普通用户
  • 注册时间: 2008-04-05 18:23
文章分类

全部博文(2110)

文章存档

2011年(139)

2010年(1971)

我的朋友

分类: LINUX

2010-01-21 13:24:36

由于业务需要,新上了两台windows 服务器。IDC安装好系统后,剩下的工作全部是我的。安装IIS,FTP ,配置windows 防火墙,设置安全策略,开放用户。这些都做完以后,就是监控了。运维最基本的是监控,这也是一个做运维的基本条件吧。由于之前一直管理Linux,对windows已经有两年多没有接触过了,开始还是碰到一些困难。如IIS权限设置,SQL Server 2000 。习惯了命令行,在在图形下面操作,还真有些不习惯吧!!当然通过nagios监控windows 有几种方法,我个人喜欢nrpe吧。之前没有监控过windows,所以所有东西全部要在网上来找。中间走了一些弯路,不过问题总算解决,记下来做个笔记吧。下次直接拿来用就OK啦!


1,下载软件包 nrpe_nt,下载nrpe_nt_plugins

我用的是 nrpe_nt.0.8b-bin.zip


下载nrpe_nt_plugins



2,解压nrpe_nt.0.8b-bin.zip 到c盘下,命名为nrpe_nt


打开命令提示符,cd c:\nrpe_nt\bin ,输入nrpe_nt /i 安装为系统服务


3,把check_nt_plugins.zip 下面的.exe 拷到c:\nrpe_nt\bin 下面


4,编辑c:\nrpe_nt\bin\nrpe.cfg


allowed_hosts=10.10.9.100,10.10.9.101,192.168.1.100  //改成你允许监控的主机的IP,可以设置多个,以“,”号隔开



设置监控命令,暂时我只设置了这四个。还有的等以后全部上线后再测试




command[check_diskc]=C:\NRPE_NT\bin\diskspace_nrpe_nt.exe c: 80 90

command[check_diskd]=C:\NRPE_NT\bin\diskspace_nrpe_nt.exe d: 80 90

command[check_cpuload]=C:\NRPE_NT\bin\cpuload_nrpe_nt.exe 80 90

command[check_memload]=C:\NRPE_NT\bin\memload_nrpe_nt.exe 80 90




5,启动npre_nt


打开命令提示符,cd c:\nrpe_nt\bin ,输入net start nrpe_nt  ##细心的朋友去服务里面看看,第2步就已经安装为系统服务了。所以,以后重新启动并不需要手工启动的。netstat -an 确认5666端口在运行,开了windows 防火墙的朋友记得放行5666端口。




余下的事情就是在监控主机端做了,这里我定义的



1,设置command




####windows



define command{

command_name nt_check_disk_c

command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c nt_check_disk_c

}


define command{

command_name nt_check_disk_d

command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c nt_check_disk_d

}


define command{

command_name nt_check_disk_e

command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c nt_check_disk_e

}


define command{

command_name nt_cpuload

command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c nt_cpuload

}


define command{

command_name nt_memload

command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c nt_memload

}


define command{

command_name nt_service

command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c nt_service

}


define command{

command_name nt_eventlog

command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c nt_eventlog

}




2.windows 主机组,这一步大家可以省略,我是为了自己管理方便



vi /usr/local/nagios/etc/objects/hostgroup.cfg



添加如下内容



define hostgroup{

hostgroup_name windows

members         windows1,windows2

}



3,添加主机 windows1 ,windows2



#定义主机

define host{

use                     windows-server            ; Name of host template to use

; This host definition will inherit all variables that are defined

; in (or inherited by) the linux-server host template definition.

host_name              windows1   ;定义主机名

alias                   windows1   ;别名

address                xxx.xxx.xxx.xxx ##你的服务器IP

}

#检查D盘使用情况


define service{

use             generic-service

host_name       windows1

service_description check_disk_c

is_volatile                     0

check_period                    24×7

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             24×7

check_command nt_check_disk_c


}

#检查D盘使用情况


define service{

use             generic-service

host_name       windows1

service_description check_disk_d

is_volatile                     0

check_period                    24×7

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             24×7

check_command nt_check_disk_d


}

#检查E盘使用情况

define service{

use             generic-service

host_name       windows1

service_description check_disk_e

is_volatile                     0

check_period                    24×7

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             24×7

check_command nt_check_disk_e


}


##检查CPU负载


define service{

use             generic-service

host_name       windows1

service_description check_cpuload

is_volatile                     0

check_period                    24×7

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             24×7

check_command nt_cpuload


}



##检查内存使用情况

define service{

use             generic-service

host_name       windows1

service_description check_memload

is_volatile                     0

check_period                    24×7

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             24×7

check_command nt_memload


}


4,/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg 确认没有错误提示后

service nagios reload



余下的就是等等观看监控数据咯


上张我的图吧




nagios监控windows 主机

nagios监控windows 主机

阅读(1299) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~