Nagios監控vmware-esxi5.0

Nagios監控vmware-esxi5.0

1.下載vSphere SDK for Perl

http://www.vmware.com/support/developer/viperltoolkit/index.html

解壓,運行

export http_proxy=

export ftp_proxy=

./vmware-install.pl回車即可。

在安裝sdk時,安裝腳本使用cpan安裝perl模塊,會有一些perl模塊安裝不上,這些安裝不上的模塊,得手動使用cpan去安裝,若還安裝不上那麼就用yum去安裝,例如 UUID

error:installed manuallyfor use by vSphere CLI:

UUID 0.03 or newer

解決:

1yum install perl-SOAP-Lite perl-Data-Dumpperl-Class-MethodMaker perl-Crypt-SSLeay perl-libxml-perlperl-XML-LibXML-Common libuuid-devel  uuid-perl  -y


2perl -MCPAN -e'install UUID'

##

……In which directorydo you want to install the executable files?

[/usr/bin]

Please wait whilecopying vSphere CLI files...

The installation ofvSphere CLI 5.0.0 build-615831 for Linux completed

successfully. You candecide to remove this software from your system at any

time by invoking thefollowing command:

"/usr/bin/vmware-uninstall-vSphere-CLI.pl"……………..


有時因爲網絡的連通狀況,還需要設置cpanurllist


#install Nagios::Plugin 使用 i/Implementation/方式查詢;

yum install perl-CPAN

perl -MCPAN -e shell  

install YAML

install HTML::Parser

install URI

install Compress::Zlib

install Module::Runtime    //如果這裏最後報錯,重啓下再insatll就成功了

reboot

install Module::Runtime  

install Module::Implementation

install Attribute::Handlers

install Params::Validate  

install Nagios::Plugin



2.然後下載監控插件http://exchange.nagios.org/directory/Plugins/Operating-Systems/*-Virtual-Environments/VMWare/Vmware-ESX-%26-VM-host/details

check_esx3.pl  記得給執行權限。

測試:/usr/local/nagios/libexec/check_esx3.pl –help   #顯示幫助信息證明安裝成功


Error:

[root@nagios libexec]#./check_esx3.pl  -H 10.168.0.109 -u root-p 'w4n9w3i_!1' -l cpu

CHECK_ESX3.PL CRITICAL -Server version unavailable at 'https://10.168.0.109:443/sdk/vimService.wsdl' at/usr/share/perl5/VMware/VICommon.pm line 545.

解決:修改check_esx3.pl腳本:添加參數

#!/usr/bin/perl -w

$ENV{PERL_LWP_SSL_VERIFY_HOSTNAME}=0;

#

# Nagios plugin to monitor vmware esxservers


測試:

[root@nagioslibexec]# ./check_esx3.pl  -H10.168.0.109 -u root -p 'w4n9w3i_!1' -l cpu

CHECK_ESX3.PL OK -cpu usage=55.00 MHz (0.12%) | cpu_usagemhz=55.00Mhz;; cpu_usage=0.12%;;



發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章