One of the cool features released in vCloud Director SP 5.6.x was the ability to expose VM metrics that service providers could expose to their clients via a set of API calls. Some service providers took advantage of this and where able to offer basic VM metrics to their tenants through customer written portals. Zettagrid was one of those service providers and while I was at Zettagrid, I worked with the developers to get VM metrics out to our customers.
Part of the backend configuration to enable the vCloud Director cells to export the metric data was to stand up a Cassandra/KairosDB cluster. This wasn’t a straight forward exercise but after a bit of tinkering due to a lack of documentation, most service providers where able to have the backend in place to support the metrics.
With the release of vCloud Director 9.0, the requirement to have KairosDB managed by Apache has been removed and metrics can now be accessed natively in Cassandra using the cell management tool. Even cooler is that the metrics can now be viewed from the new HTML5 tenant UI, meaning that all service providers should be able to offer this to their customers.
Cassandra is an open source database that you can use to provide the backing store for a scalable, high-performance solution for collecting time series data like virtual machine metrics. If you want vCloud Director to support retrieval of historic metrics from virtual machines, you must install and configure a Cassandra cluster and use the cell-management-tool to connect the cluster to vCloud Director. Retrieval of current metrics does not require optional database software.
The vCloud Director online docs have a small install guide but it’s not very detailed. It basically says to install and configure the Cassandra cluster with four nodes, two of which are seed nodes, enabling encryption and user authentication with Java Native Access installed. Not overly descriptive. I’ve created an script below that installs and configures a basic single node Cassandra cluster that will suffice for most labs/testing environments.
Setting up Cassandra on Ubuntu 16.04 LTS:
I’ve forked an existing bash script on Github and added modifications that goes through the installation and configuration of Cassandra 2.2.6 (as per the vCD 9.0 release notes) on a single node, enabling authentication while disabling encryption in order to keep things simple.
This will obviously work on any distro that supports apt-get. Once configured you can view the Cassandra status by using the nodetool status command as shown below.
The manual steps for the Cassandra installation are below…note that they don’t include the configuration file changes required to enable authentication and set the seeds.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# #SETUP JAVA java -version apt-get install default-jre apt-get install default-jdk update-alternatives --config java echo $JAVA_HOME #ADD JAVA HOME vi /etc/environment # append JAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java" to the file source /etc/environment #ADD CASSANDRA REPOS TO APT curl -L http://debian.datastax.com/debian/repo_key | sudo apt-key add - echo "deb http://debian.datastax.com/community stable main" | sudo tee -a /etc/apt/sources.list.d/cassandra.sources.list apt-get update #INSTALL AND START CASSANDRA 2.2.6 apt-get install cassandra=2.2.6 apt-get install cassandra-tools=2.2.6 cd /etc/cassandra/ # modify cassandra settings - see below for details vi cassandra.yaml service cassandra start service cassandra status #CONFIRM CASSANDRA NODE IS UP nodetool status Datacenter: datacenter1 ======================= Status=Up/Down |/ State=Normal/Leaving/Joining/Moving -- Address Load Tokens Owns (effective) Host ID Rack UN 10.0.30.7 144.7 KB 256 100.0% c88f1657-dd55-4f95-8175-55b45defb479 rack1 |
From here you are ready to configure vCD to push the metrics to the Cassandra database. I’ll cover that in a seperate post.
References: