1、总览web
从Zabbix 2.2.0开始支持监控 VMware 虚拟化环境,Zabbix使用低水平(low-level)的规则自动发现VMware hypervisors 和virtual machines,并建立主机监控他们,Zabbix提供的默认的模板用来监控VMware vCenter 或者 ESX hypervisor。vim
一、监控原理bash
虚拟机的监控主要分为两步,第一,vmware collector Zabbix processes回去收集虚拟机的数据,这些进程经过SOAP协议从VMware web服务获取必要的数据,对这些数据进行预处理,而后存入Zabbix server共享内存,而后,这些数据Zabbix经过VMware keys检查取回。app
我翻译渣渣,懒得翻译了,直接贴官方文档了。curl
Starting with Zabbix version 2.4.4 the collected data is divided into 2 types: VMware configuration data and VMware performance counter data. Both types are collected independently by vmware collectors. Because of this it is recommended to enable more collectors than the monitored VMware services. Otherwise retrieval of VMware performance counter statistics might be delayed by the retrieval of VMware configuration data (which takes a while for large installations).ide
Currently only datastore, network interface and disk device statistics and custom performance counter items are based on the VMware performance counter information.this
二、发现 url
Zabbix可使用低水平的发现规则自动发现VMware虚拟机,下图中就是一个key的示例。spa
三、主机样机翻译
主机样机建立使用低水平的发现规则,当虚拟机被发现,这些样机会自动变成真正的主机,在他们被发现前,这些虚拟机没有本身的监控条目和触发器,不用于哪些连接了模板的主机,被发现的主机属一个存在的主机,而且会使用他的IP和主机配置。
四、虚拟机模板
“Template Virt VMware” template should be used for VMware vCenter and ESX hypervisor monitoring. The “Template Virt VMware Hypervisor” and “Template Virt VMware Guest” templates are used by discovery and normally should not be manually linked to a host.
2、安装配置
一、Zabbix server配置
要知足虚拟机的监控,Zabbix在编译的时候须要加上--with-libxml2和--with-libcurl,关于依赖关系,你们请自行百度,很是简单。
不但编译的时候须要加上上面的参数,还须要在Zabbix server的配置文件中开启如下几项,具体的数值你们能够根据本身的实际状况修改,并重启zabbix_server服务。
# vim /etc/zabbix/zabbix_server.conf
StartVMwareCollectors=5 #开启的监控进程数量,详解看官方介绍 VMwareFrequency=60 VMwarePerfFrequency=60 VMwareCacheSize=80M VMwareTimeout=10
service zabbix_server restart
二、主机配置
使用虚拟机简单检查主机必须配有下面的宏变量。
{$URL} - VMware service (vCenter or ESX hypervisor) SDK URL(https://servername/sdk).
{$USERNAME} - VMware service user name
{$PASSWORD} - VMware service {$USERNAME} user password
而后连接虚拟机模板。
建立好以后就能够自动发现虚拟机了,你能够调整配置文件DebugLevel为5来去查看详细的日志信息。
3、验证
为了加快监控的添加,咱们这里修改一下查下的时间间隔,添加好以后再修改回来。
不久以后,咱们在主机列表区域发现了不少虚拟机,以下图:
为了方便,咱们能够点击某个主机,为其添加监控图像。
查看监控数据。
参考文档:https://www.zabbix.com/documentation/3.2/manual/vm_monitoring