Nagios监控ESXi服务器硬件

  • Post author:
  • Post category:Nagios
  • Page Views 799 阅读

注:部分内容来自书籍或者网络,如有侵权,请联系删除。

参考资料:https://www.claudiokuenzler.com/monitoring-plugins/check_esxi_hardware.php#.VWV5_JCUfTA

1.下载插件

wget https://www.claudiokuenzler.com/monitoring-plugins/check_esxi_hardware.py

2.安装pywbem扩展

yum install pywbem

3.在ESXI上创建用户监控的用户(ESXI6.7),并开启SSH

创建用户:管理>安全和用户>用户>添加用户

设置权限:主机>操作>权限>添加用户,设置为只读即可。

4.测试连接

[root@nagiosmonitor libexec]# ./check_esxi_hardware.py -H IP地址 -U nagios -P 密码 -V dell
OK - Server: Dell Inc. PowerEdge R740 s/n: 6ZGVJ53 System BIOS: 2.7.7 2020-05-04

5.定义命令(commands.cfg)

define command {
    command_name check_esxi_hardware
    command_line $USER1$/check_esxi_hardware.py -H $HOSTADDRESS$ -U nagios -P 密码 -V dell -p -t 20
}

6.添加服务后重新加载Nagios服务

可能会遇到的错误:

错误一

[root@nagiosmonitor libexec]# ./check_esxi_hardware.py -H IP地址 -U nagios -P 密码 -V dell
Traceback (most recent call last):
File "./check_esxi_hardware.py", line 617, in <module>
wbemclient = pywbem.WBEMConnection(hosturl, (user,password), no_verification=True)
...

解决办法:

编辑check_esxi_hardware.py文件,删除“no_verification=True”

#raise
verboseoutput("Connection error, disable SSL certification verification (probably patched pywbem)")
wbemclient = pywbem.WBEMConnection(hosturl, (user,password))

错误二

UNKNOWN: Authentication Error

解决办法:

注释或删除-“nagios:ALL”,添加”+:nagios:sfcb”

[root@vm025:~]  cat /etc/security/access.conf
# This file is autogenerated and must not be edited.
+:nagios:sfcb
+:dcui:ALL
+:root:ALL
+:vpxuser:ALL
+:vslauser:ALL
-:ALL:ALL


「 文章如果对你有帮助,请点个赞哦^^ 」 

0