歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux教程 >> Nagios監控Vmware ESXI 5.0

Nagios監控Vmware ESXI 5.0

日期:2017/2/28 14:35:26   编辑:Linux教程

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 的下載地址:請點這裡

Copyright © Linux教程網 All Rights Reserved