標籤:監控 nagios
nagios監控vsphere ESXi主機硬體狀態(CPU風扇、電源模組、硬碟、溫度)
esxi 的唯讀賬戶和密碼(本文以chkhardware/chkreadonly為例)
插架,此地址附有相關說明:http://www.claudiokuenzler.com/nagios-plugins/check_esxi_hardware.php
ESXI主機:DELL R410
ESXI版本:ESXI4.0
配置
1)check_esxi_hardware.py 複製到nagios外掛程式目錄/usr/local/nagios/libexec
2)command.cfg
要實現如下的效果: -U 使用者名稱 -P 密碼
check_esxi_hardware.py -H 192.168.0.130 -U chkhardware -P chkreadonly -V dell
下面這是根據模板,按照實際環境添加的內容:commands.cfg
# ‘check_esxi_hardware‘ command definition chkhardware/chkreadonly
define command{
command_name check_esxi_hardware
command_line $USER1$/check_esxi_hardware.py -H $HOSTADDRESS$ -U $ARG1$ -P $ARG2$ -t $ARG3$ -V $ARG4$
}
增加監控主機,在主機設定檔中
# chkhardware/chkreadonly
define service{
use remote-service
host_name vsphere.0.xxx
service_description check_esxi_hardware
check_command check_esxi_hardware!chkhardware!chkreadonly!500!dell
}
建立一隻讀帳號,進行測試
# /root/check_esxi_hardware.py -H 192.168.0.130 -U chkhardware -P chkreadonly -V dell
OK - Server: Dell Inc. PowerEdge R410 s/n: 2FPTV2X System BIOS: 1.3.9 2010-04-07
這個指令碼用到了PyWEEM模組,如果機器上沒有,需要安裝的:
PyWEEM模組首頁:http://pywbem.sourceforge.net/
# wget http://downloads.sourceforge.net/project/pywbem/pywbem/pywbem-0.7/pywbem-0.7.0.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fpywbem%2Ffiles%2Fpywbem%2F&ts=1299742557&use_mirror=voxel
# tar -xvzf pywbem-0.7.0.tar.gz
# cd pywbem-0.7.0
# python setup.py build
# python setup.py install
####
參考文檔:
http://www.claudiokuenzler.com/nagios-plugins/check_esxi_hardware.php#PasswordFile
http://blog.163.com/x_b_xuebi/blog/static/59649492201135102817844/
nagios監控vsphere ESXi主機硬體狀態(CPU風扇、電源模組、硬碟、溫度)