I assume that you have fresh zabbix installed and had not customized it yet. Zabbix has built in ability to query VmWare ESXes, you only have to enable it before use. Edit server's configuration file /etc/zabbix/zabbix_server.conf. The only required directive is StartVMwareCollectors which should be slightly more than your amount of ESXes. I have 2 ESXes in this POC, then I start 3 collectors:
# grep StartVMwareCollectors /etc/zabbix/zabbix_server.conf StartVMwareCollectors=3
Restart zabbix server to apply changes:
# service zabbix-server restart
Login into GUI (http://YOUR-SERVER/zabbix) with user Admin. Navigate: Configuration -> Hosts -> Create host
Click Add.
Open this host for editing again, now continue with Macros tab. Insert the following at Host macros:
{$USERNAME} | root |
{$PASSWORD} | rootpassword |
{$URL} | https://ESX-IP-ADDRESS-OR-NAME/sdk |
Continue with Templates tab. Type "vmware" in search field and select Template Virt VMware from popup hint, then click Add to add selected template. Click Update to approve changes.
Verify Configuration -> Hosts to see new ESX host added. It takes time (at least one hour) to discover VMs. Be patient.
There is no any default trigger on discovered VMs. I was interested in Low free disk space alert on every discovered VMs despite of OS type and filesystem name. Therefore some changes were made to template itself:
Configuration -> Templates -> Template Virt VMware Guest -> Discovery rules
We should use VMware Guest template this time, because exactly this template applyed to discovered VMs.
Click on Trigger prototypes in Mounted filesystem discovery line.
Click Create trigger prototype button. Fill the data
Name | Low free disk space on {HOST.NAME} {#FSNAME} (percentage) |
Severity | High |
Expression | {Template Virt VMware Guest:vmware.vm.vfs.fs.size[{$URL},{HOST.HOST},{#FSNAME},pfree].last(#3)}<10 |
Create enabled | checked |
Click Add button to finish definitions.
Wait a lot for template be re-applyed. No reload, remove or rediscover required. Just wait.
Another usefull trigger is "power state" of VM.
Configuration -> Templates -> Template Virt VMware Guest -> Triggers
Click Create trigger button and fill the data:
Name | VM guest {HOST.NAME} is powered OFF |
Severity | High |
Expression | {Template Virt VMware Guest:vmware.vm.powerstate[{$URL},{HOST.HOST}].last()}=0 |
Enabled | checked |
Click Add button to finish definitions.
Administration -> Media types
Disable unwanted senders and click on Email to configure. Fill close SMTP server details. Puzzling entries are: SMTP helo that is your zabbix hostname and SMTP email that is sender's email address. It could be even non existent address, and will be used as FROM field. Click Update button.
Administration -> Users -> Create user
Create desired user and add it to Zabbix administrators group. There is Media tab in user's definitions. Fill the data. A destination e-mail address is here.
Configuration -> Actions
Click on Report problems to Zabbix administrators for edit. In Action tab you should add new condition, mine looks like Trigger severity >= Warning. Click Add link to insert constructed condition in conditions list. Update setup.
Enable action.