EricaYue 2014-03-06
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
解决:
1)yum install perl-SOAP-Lite perl-Data-Dumpperl-Class-MethodMaker perl-Crypt-SSLeay perl-libxml-perlperl-XML-LibXML-Common libuuid-devel uuid-perl -y
2)perl -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"……………..
有时因为网络的连通状况,还需要设置cpan的urllist
#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%;;
Nagios 的详细介绍:请点这里
Nagios 的下载地址:请点这里
相关阅读: