Monitoring VMware ESXi hosts with Zabbix

As Lukas Camenzind points it out (http://www.looke.ch/wp/monitoring-esx-servers-with-zabbix), you can monitor ESXi hosts with Zabbix. It is not that easy though, but here is a little guide that can help you along the way. This is a mix of Lukas’ findings, some official VMware documentation and my experience.

Do not forget to read the official Zabbix documentation on installing the agent!

Use Zabbix agent for Linux 2.6

The builds (from http://www.zabbix.com/download.php) for Linux 2.6.23 are not working with VMware ESXi VMkernel 5.1.0, so you have to grab the build for Linux 2.6.

zabbix_agentd: /lib64/libc.so.6: version `GLIBC_2.7' not found
(required by zabbix_agentd)

You need to modify the ESXi’s firewall

The VMware Knowledge Base has a nice tutorial on this – however it is not the best solution. They say you have to edit the main services.xml – I prefer adding a new XML file, just as Lukas describes it:

~ # cat > /etc/vmware/firewall/zabbix.xml
<!-- Firewall configuration information for Zabbix Monitoring system -->
<ConfigRoot>
 <service>
 <id>zabbixMonitoring</id>
 <rule id='0000'>
 <direction>inbound</direction>
 <protocol>tcp</protocol>
 <port type='dst'>10050</port>
 <flags>-m state --state NEW</flags>
 </rule>
 <rule id='0001'>
 <direction>outbound</direction>
 <protocol>tcp</protocol>
 <port type='dst'>10051</port>
 <flags>-m state --state NEW</flags>
 </rule>
 </service>
</ConfigRoot>
~ #

However, the command service mgmt-vmware restart did not work in my case, so I used esxcli network firewall refresh to refresh the firewall rules. After that, you can enable the new rule to allow the agent to communicate with the Zabbix server.

Create a user for the agent

~ # zabbix_agentd --config /conf/zabbix_agentd.conf 
zabbix_agentd [2517454]: user zabbix does not exist
zabbix_agentd [2517454]: cannot run as root!

You have to create a user named zabbix, so the daemon can change its EUID. I did this with the vCenter client – no explanation here.

I did not create an init script for the service, I just started the agent daemon – the VMware host will not shut down or restart in the near future.

~ # zabbix_agentd --config /conf/zabbix_agentd.conf
~ # ps | grep zabbix
2518261 2518261 zabbix_agentd        zabbix_agentd
2518262 2518262 zabbix_agentd        zabbix_agentd
2518263 2518263 zabbix_agentd        zabbix_agentd
2518264 2518264 zabbix_agentd        zabbix_agentd
2518265 2518265 zabbix_agentd        zabbix_agentd
2518266 2518266 zabbix_agentd        zabbix_agentd
~ #

2 Replies to “Monitoring VMware ESXi hosts with Zabbix”

Leave a Reply

Your email address will not be published. Required fields are marked *