Written by Marc Cirauqui, Support Engineer @ Abiquo

Abiquo enables you to use metrics from virtual machines, applications and physical host machines to drive Action Plans, which can be used to auto scale VMs in the same or another cloud (“Cloud bursting”), and to perform other actions such as sending an email, rebooting VMs, increasing VM resources and more.

In addition to collecting metrics through each hypervisor and cloud plugin’s interface (vCenter, libvirt for KVM, AWS, Azure etc.), Abiquo allows you to push custom metrics to the platform that will behave just like any other metrics. Even better, these are automatically incorporated into the Abiquo database and UI, so there’s no development or even configuration required! To simplify it even more, Abiquo API implements a parser for the collectd JSON format, so you can use collectd to push metrics into Abiquo without needing to write direct to our REST API.

Abiquo 4.4 adds the capability to push metrics not only to VMs but to other entities across the platform. This makes it possible to push metrics for a datacenter, or rack (a group of hosts in Abiquo), or hosts. When you have such metrics fed into Abiquo you will be able to create alarms and alerts based on those metrics that in turn will be able to trigger action plans.

Enterprise cloud platform admins often ask us if it’s possible to alert on physical infrastructure events, such as a rapid change to the number of VMs, or the CPU utilization of an ESX server. By pushing vCenter metrics into Abiquo, they can use Action Plans to do just that, and even to take other actions. How about stopping development VMs when the host CPU is busy? Or scaling down a less important app when too much RAM is being consumed? The possibilities are endless!

To implement this, I searched for plugins for collectd that collect metrics from vCenter, and found  collectsphere. So in this blog post I’m going to install collectd in a CentOS 7 machine and configure it to collect metrics from vCenter and post them to Abiquo so they become available under a certain rack.

Ready? Here we go:

The first thing will be to make sure we have the EPEL repos available, then install collectd and git, which we will use to get the necessary collectd plugins:


$ sudo yum install epel-release
$ sudo yum install collectd git
Once you have that, you will need both the collectd output plugin for Abiquo and the collectsphere plugin:
$ cd /opt/
$ git clone https://github.com/abiquo/collectd-abiquo
$ git clone https://github.com/evoila/collectsphere
Now we need to configure collectd to load these two plugins with the appropriate configurations:
$ sudo vi /etc/collectd.d/abiquo.conf
<Plugin “python”>
 # abiquo-writer.py is at /opt/collectd-abiquo/abiquo-writer.py
 ModulePath “/opt/collectd-abiquo/”
 Import “abiquo-writer”
 <Module “abiquo-writer”>
 URL “https://demonstration.abiquo.com:443/api/admin/datacenters/2/racks/2/metrics/collectd”
 Authentication “basic”
 Username “collectd”
 Password “somesecretpassword”
 TypesDB “/opt/collectsphere/vmware-types.db”
This file will make collectd load the Abiquo output plugin posting metrics to a rack URL using basic auth. Note the “TypesDB” sentence is needed because collectsphere uses a custom types db. Then, to configure collectsphere:
$ sudo vi /etc/collectd.d/collectsphere.conf
TypesDB “/opt/collectsphere/vmware-types.db”
<Plugin “python”>
 ModulePath “/opt/collectsphere/”
 Import “collectsphere”
 <Module “collectsphere”>
 Name “demo”
 Host “somevcenter”
 Port “443”
 Verbose true
 VerifyCertificate false
 UseFriendlyName true
 Username “root”
 Password “verysecret”
 Host_Counters “cpu.usage,mem.usage,disk.usage”
 VM_Counters “cpu.usage,mem.usage”
For specifics on configuration of the collectsphere plugin please refer to the plugin documentation. Now, as this instance of collectd will be used to gather metrics from vCenter, we could edit the main config file for collectd and disable any other collection plugin, preventing this instance of collectd from pushing metrics from the host it is running in. If that host is, for example, the RS managing the datacenter, it could push its own metrics to the Abiquo datacenter, for example.

So, at this point, all that is left to do is to start the collectd daemon:

$ sudo systemctl start collectd
And wait some time until it gathers metrics and starts pushing them into Abiquo. After some minutes, you will be able to go to the Abiquo UI, infrastructure, Alarms tab and create alarms over the metrics you are currently gathering from vCenter!