Zabbix 添加vmware esxi监控

1) Import the provided template.

- TEMPLATE.VMWARE_ESXi_6.0_CIM.xml


2) Install Dependencies:

# yum -y install sblim-wbemcli.x86_64 pywbem.noarch python2-pyvmomi.noarch python-setuptools jq python-setuptools zabbix-sender.x86_64
# pip install pysphere
# pip install  docopt

 

3) Create a read only account on your VMWare ESXi with enough privileges to collect the data you want to monitor.

You can create such account with the following commands:

# /usr/lib/vmware/auth/bin/adduser -s /sbin/nologin -D -H zabbix -G root
# echo "YOUR_PASSWORD" | /usr/lib/vmware/auth/bin/passwd --stdin zabbix
# vim-cmd vimsvc/auth/role_add CIM_ReadOnly Host.Cim.CimInteraction System.Anonymous
# vim-cmd vimsvc/auth/entity_permission_add vim.Folder:ha-folder-root ‘zabbix‘ false CIM_ReadOnly true


4) VMWare Host UUID information:

You need to enable MOB VIB, because esxcli may not provide a valid UUID for this template.

To enable mob via CLI:
vim-cmd proxysvc/add_np_service "/mob" httpsWithRedirect /var/run/vmware/proxy-mob

To disable mob via CLI:
vim-cmd proxysvc/remove_service "/mob" "httpsWithRedirect"

You can also enable MOB VIB via vSphere:

1. Go to your vsphere Advanced Settings, Config, Hostagent, plugins, solo, check "Config.HostAgent.plugins.solo.enableMob"
2. Browse to https://YOUR_ESX_HOST_IP/mob/?moid=ha-host&doPath=hardware.systemInfo and copy the UUID.
3. Disable MOB vib again (uncheck Config.HostAgent.plugins.solo.enableMob)

You can also obtain the UUID information through the collected data, on "CIM Hardware" item on Zabbix dashboard after 10 minutes of collected data.

An anternate way, is to execute "esxcfg-info -u". But you may need to convert the results to lowercase.


5) Zabbix Macros:

{$USERNAME} zabbix
{$PASSWORD} YOUR_PASSWORD
{$URL} https://YOUR_ESX_HOST_IP/sdk
{$UUID} your-uuid-collected-information


6) Scripts on ExternalScrips directory.

Put the bundled scripts on your ExternalScrips directory of your Zabbix Proxy or Zabbix Server, and apply the necessary privileges:

# chmod a+x agent_vsphere_wrapper agent_vsphere

7)restart zabbix-server

systemctl restart zabbix-server

 

附件可以下载

https://share.zabbix.com/index.php?option=com_mtree&task=att_download&link_id=755&cf_id=39

Zabbix 添加vmware esxi监控

上一篇:linux下centos7.2下安装redis 4.0.6


下一篇:【自制操作系统15】用户进程