使用Nagios监控Esxi
公司为了能够节约成本,方便维护将部分服务器都虚拟化
虚拟系统使用ESXI搭建,有系统,有服务,就免不了会出问题,所以使用Nagios来监控ESXI
使用插件check_esx3.pl监控
1. 在Nagios服务端上安装VMware-vSphere-Perl-SDK-4.1.0-254719.x86_64.tar.gz (到vmware官方网站去下载,如果是32位操作系统,就安装i386的)
2. 下载check_esx3.pl到/usr/local/nagios/libexec/ (wget http://exchange.nagios.org/components/com_mtree/attachment.php?link_id=727&cf_id=29)
最近发现上面提供的下载链接已经失效了, 可以 用这个下载 http://tangyou.me/wp-content/uploads/2012/06/check_esx3.zip
3. 这样之后,有可能check_esx3.pl插件不能使用,在运行命令的时候可能会提示缺少XXXX插件,就要自己安装了
4. 例如再我的Nagios服务端在上,提示缺少Nagios::plugin Compress::Zlib
5. 使用perl -MCPAN -e shell 安装软件包install Nagios::plugin , install Compress::Zlib
6. /usr/local/nagios/libexec/check_esx3.pl 命令具体使用看帮助
在/usr/local/nagios/etc/objects/commands.cfg定义命令
######################### Check ESXI Command #########################
define command{
command_name check_esx_service
command_line $USER1$/check_esx3.pl -H $HOSTADDRESS$ -u root -p password -l $ARG1$ -s usage -w $ARG2$ -c $ARG3$
}
define command{
command_name check_esx_status
command_line $USER1$/check_esx3.pl -H $HOSTADDRESS$ -u root -p password -l $ARG1$ -s $ARG2$
}
define command{
command_name check_esx_net
command_line $USER1$/check_esx3.pl -H $HOSTADDRESS$ -u root -p password -l net
}
define command{
command_name check_esx_io
command_line $USER1$/check_esx3.pl -H $HOSTADDRESS$ -u root -p password -l io
}
define command{
command_name check_esx_vmfs
command_line $USER1$/check_esx3.pl -H $HOSTADDRESS$ -u root -p password -l vmfs
}
在/usr/local/nagios/etc/services/esxi.cfg中添加监控项目
define host{
use linux-server
host_name 192.168.10.139
alias VMWARE-139
address 192.168.10.139
contact_groups admins
}
define service{
use generic-service ; Inherit values from a template
host_name 192.168.10.139
service_description CPU Load
check_command check_esx_service!cpu!80!90
}
define service{
use generic-service ; Inherit values from a template
host_name 192.168.10.139
service_description Mem Status
check_command check_esx_service!mem!90!95
}
define service{
use generic-service ; Inherit values from a template
host_name 192.168.10.139
service_description Net Status
check_command check_esx_net
}
define service{
use generic-service ; Inherit values from a template
host_name 192.168.10.139
service_description IO Status
check_command check_esx_io
}
define service{
use generic-service ; Inherit values from a template
host_name 192.168.10.139
service_description Uptime Status
check_command check_esx_status!runtime!status
}
define service{
use generic-service ; Inherit values from a template
host_name 192.168.10.139
service_description Vmfs Suatus
check_command check_esx_vmfs
}
重启nagios,搞定.最后在看看效果吧!
能说的再详细些吗?按照上述方法我没有做成功。
哪里出现了问题?
[root@nagios ~]# /usr/local/nagios/libexec/check_esx3 -h
Can’t locate Nagios/Plugin.pm in @INC (@INC contains: /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl /usr/lib/perl5/5.8.8/i386-linux-thread-multi /usr/lib/perl5/5.8.8 .) at /usr/local/nagios/libexec/check_esx3 line 31.
BEGIN failed–compilation aborted at /usr/local/nagios/libexec/check_esx3 line 31.
一执行这文件就会出现这个错误 😥
错误提示 /usr/local/nagios/libexec/check_esx3 第31行,打开看一看,显示 use Nagios::Plugin; 说明这个脚本需要用到use Nagios::Plugin;所以需要安装use Nagios::Plugin; 安装的方法 执行命令 perl -MCPAN -e shell 然后 install Nagios::Plugin
就可以了.
我安装完了Nagios::Plugin,但还是出现这个错误提示
在安装Nagios::Plugin的时候有出现什么错误吗,是否确定安装成功了 ❓
哥们,这是监控ESXi还是监控ESX ,ESXi和ESX差别很大,还有被监控端是通过什么向nagios监控端发送信息,是SNMP吗?能否给我留一个你的联系方式
成功了
成功了
VMware-vSphere-Perl-SDK 安装了没?
安装了
HI,我卡在perl安装nagios模块的过程了,安装的时候提示有错误,强制安装的话,还是不能用,
有神马错误提示,到google里面去搜一下,应该会有解决的办法的 😳
哥们,照你说的方法不行啊。该装的模块都装了,执行就报错啊
Bareword “ARRAYREF” not allowed while “strict subs” in use at /usr/lib/perl5/site_perl/5.8.8/Nagios/Plugin/Functions.pm line 207.
Bareword “ARRAYREF” not allowed while “strict subs” in use at /usr/lib/perl5/site_perl/5.8.8/Nagios/Plugin/Functions.pm line 207.
Bareword “ARRAYREF” not allowed while “strict subs” in use at /usr/lib/perl5/site_perl/5.8.8/Nagios/Plugin/Functions.pm line 207.
Bareword “SCALAR” not allowed while “strict subs” in use at /usr/lib/perl5/site_perl/5.8.8/Nagios/Plugin/Functions.pm line 207.
Compilation failed in require at /usr/lib/perl5/site_perl/5.8.8/Nagios/Plugin.pm line 4.
BEGIN failed–compilation aborted at /usr/lib/perl5/site_perl/5.8.8/Nagios/Plugin.pm line 4.
Compilation failed in require at check_esx3.pl line 31.
BEGIN failed–compilation aborted at check_esx3.pl line 31.
😐
首先感觉你的文档对我帮助很大,但是我在使用中出现一个问题。
提示是 check_esx3.pl 警告 SOAP 请求超时 不知道是为什么?
还有一个问题 在请求esx时 会很慢,会报出SSL相关的错误 提示http.pm 31。
你是否遇见过呢?