1. 程式人生 > >Zabbix 3.2.6監控虛擬機VMware

Zabbix 3.2.6監控虛擬機VMware

zabbix3.2.6

一、總覽

從Zabbix 2.2.0開始支持監控 VMware 虛擬化環境,Zabbix使用低水平(low-level)的規則自動發現VMware hypervisors 和virtual machines,並創建主機監控他們,Zabbix提供的默認的模板用來監控VMware vCenter 或者 ESX hypervisor。

1、監控原理

虛擬機的監控主要分為兩步,第一,vmware collector Zabbix processes回去收集虛擬機的數據,這些進程通過SOAP協議從VMware web服務獲取必要的數據,對這些數據進行預處理,然後存入Zabbix server共享內存,然後

,這些數據Zabbix通過VMware keys檢查取回。

我翻譯渣渣,懶得翻譯了,直接貼官方文檔了。

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).

Currently only datastore, network interface and disk device statistics and custom performance counter items are based on the VMware performance counter information.

2、發現

Zabbix可以使用低水平的發現規則自動發現VMware虛擬機,下圖中就是一個key的示例。

技術分享

3、主機樣機

主機樣機創建使用低水平的發現規則,當虛擬機被發現,這些樣機會自動變成真正的主機,在他們被發現前,這些虛擬機沒有自己的監控條目和觸發器,不用於哪些鏈接了模板的主機,被發現的主機屬一個存在的主機,並且會使用他的IP和主機配置。

技術分享

4、虛擬機模板

“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.

技術分享

二、安裝配置

1、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

技術分享

2、主機配置

技術分享

使用虛擬機簡單檢查主機必須配有下面的宏變量。

  • {$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來去查看詳細的日誌信息。

三、驗證

為了加快監控的添加,我們這裏修改一下查下的時間間隔,添加好之後再修改回來。

技術分享

不久之後,我們在主機列表區域發現了很多虛擬機,如下圖:

技術分享

為了方便,我們可以點擊某個主機,為其添加監控圖像。

技術分享

查看監控數據。

技術分享


參考文檔:https://www.zabbix.com/documentation/3.2/manual/vm_monitoring


技術分享


本文出自 “運維點滴記錄” 博客,請務必保留此出處http://wzlinux.blog.51cto.com/8021085/1947572

Zabbix 3.2.6監控虛擬機VMware