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
$ cd /opt/
$ git clone https://github.com/abiquo/collectd-abiquo
$ git clone https://github.com/evoila/collectsphere
$ 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”
</Module>
</Plugin>
$ 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”
</Module>
</Plugin>
So, at this point, all that is left to do is to start the collectd daemon:
$ sudo systemctl start collectd