The following example describes how to set up Zabbix for monitoring VMware virtual machines. This involves:
This example does not cover the configuration of VMware. It is assumed that VMware is already configured.
Before proceeding, set the StartVMwareCollectors
parameter in Zabbix server configuration file to 2
or more (the default value is 0
).
1. Go to Data collection → Hosts.
2. Create a host:
3. Click the Add button to create the host. This host will represent your VMware environment.
1. Click Discovery for the created host to go to the list of low-level discovery rules for that host.
2. Create a low-level discovery rule:
vmware.vm.discovery[{$VMWARE.URL}]
3. Click the Add button to create the low-level discovery rule. This discovery rule will discover virtual machines in your VMware environment.
1. In the list of low-level discovery rules, click Host prototypes for the previously created low-level discovery rule.
2. Create a host prototype. Since host prototypes are blueprints for creating hosts through low-level discovery rules, most fields will contain low-level discovery macros. This ensures that the hosts are created with properties based on the content retrieved by the previously created low-level discovery rule.
3. Click the Add button to create the host prototype. This host prototype will be used to create hosts for virtual machines discovered by the previously created low-level discovery rule.
After the host prototype has been created, the low-level discovery rule will create hosts for discovered VMware virtual machines, and Zabbix will start to monitor them. Note that the discovery and creation of hosts can also be executed manually, if necessary.
To view the created hosts, navigate to the Data collection → Hosts menu section.
To view collected metrics, navigate to the Monitoring → Hosts menu section and click Latest data for one of the hosts.
The vmware.vm.discovery[{$VMWARE.URL}]
item key, configured in the Create a low-level discovery rule section, returns network interfaces data in the "net_if" field:
"net_if": [
{
"ifname": "5000",
"ifdesc": "Network adapter 1",
"ifmac": "00:11:22:33:44:55",
"ifconnected": true,
"iftype": "VirtualVmxnet3",
"ifbackingdevice": "VLAN(myLab)",
"ifdvswitch_uuid": "",
"ifdvswitch_portgroup": "",
"ifdvswitch_port": "",
"ifip": [
"127.0.0.1",
"::1"
]
},
{
"ifname": "5001",
"ifdesc": "Network adapter 2",
"ifmac": "00:11:22:33:44:55",
"ifconnected": false,
"iftype": "VirtualVmxnet3",
"ifbackingdevice": "VLAN(myLab2)",
"ifdvswitch_uuid": "",
"ifdvswitch_portgroup": "",
"ifdvswitch_port": "",
"ifip": []
}
]
This data can be used to configure a custom host interface.
1. When creating a low-level discovery rule, additionally configure a low-level discovery macro. In the LLD macros tab, create a custom LLD macro with a JSONPath value. For example:
$.net_if[?(@.ifbackingdevice=="VLAN(myLab)")].ifip[0].first()
2. When creating a host prototype, add a custom host interface and enter the LLD macro in the DNS name or IP address field.