The current vmware infrastructure is a mix of ESX and ESXi at 3, 3.5 and 4.1 releases. What I would like to achieve is being able to monitore the free space of the datastores through zabbix which is our current monitoring solution.
Is there a way of achieving this?
This is trivial with the VMware API and VMware has some example scripts that you can use as a starting point. First, download the vSphere SDK for Perl 4.1 from http://www.vmware.com/support/developer/viperltoolkit/ and install it on your Zabbix server. You'll need this version to support ESX/ESXi 3.0.1 through 4.1.
Then you can use one of the included Perl scripts, such as dsbrowse.pl, as a starting point for making your own custom check in Zabbix. The SDK also includes other scripts which may be useful.
There are a lot of different ways you could go about this. Probably the most painless way would be to use zabbix 1.8.x's ssh login ability to run a simple shell script on the vmware server that would return the result to you. You have to compile zabbix_server with libssh for it to have the capability to do this.
Once you've compiled zabbix server with the ssh capability, just go to the vmware server "Host" and add an "Item". From the drop down list will be "SSH Agent". Choose that, have it login to the vmware host, run the simple shell script which returns the space utilization of the datastore.
Another possibility would be to install zabbix_sender (or a homemade equivalent) on the vmware host and have it periodically send the datastore results to zabbix_server.
If you have a vcenter server, and have upgraded to Zabbix 2.2 - the vmware monitoring is now a feature of Zabbix.
Read more here in the documentation: https://www.zabbix.com/documentation/2.2/manual/vm_monitoring