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/