Unable to start/edit vCenter Orchestrator Policies

After a vCenter Orchestrator (vCO) restart, I noticed that some vCO policies weren’t running.  The polices that weren’t running were set to run as a normal user account and not the service account that the running policies were configured with.  Here is how the policies looked.  Notice that the start, stop and edit buttons are not active.

2015-05-29_10-51-56

The issue was that the user account that the policies were running as had expired and the policy was configured to auto-start with the server.  I was stuck since I had no way of editing the policy and it started automatically.  I didn’t have time to research this so I opened a case with VMware support and they provided me the solution below:

  1. Stop vCO server service
  2. Connect to the vCO Oracle Database
  3. Run the following statement, substituting <vco_schema> and <policy_name> with the actual values:
    1. UPDATE <vco_schema>.vmo_policy SET startmode = 0, state = ‘stopped’ WHERE name = <policy_name>;
  4. Restart the vCO server service

After performing these steps I was able to edit the policy, correct the account to run as and successfully start it.

Advertisements

Listing all vCenter performance metrics with PowerCLI

Our big data team recently approached me and wanted to know if I could gather real time performance metrics on vCenter virtual machines and publish them to their API.  I asked which metrics they wanted they said, “all of them.”  I proceeded with gathering all of them but wanted to give them a list of all metrics so that they could pick and choose which ones they wanted.  I needed the name of the metric, the stat level it’s recorded at (in case they later wanted something other than real time metrics) and a description of the metric as they aren’t familiar with VMware.

I had never used PowerCLI to gather vCenter performance metrics so my first step was to see how to interact with vCenter and to see which performance metrics were available.  The method that I’m going to describe actually list all vCenter performance metrics and not just virtual machine metrics.  I ended up not using this in my final script to gather virtual machine performance data, but thought it may be useful to be able to look at spreadsheet with the performance metrics so I could easily sort, filter, etc.

I poked around on LucD’s page for information on how to get started.  I’d recommend that you’d check out the links below if you’re interested in using PowerCLI to gather vCenter performance metrics:

In an upcoming post I’ll describe the script I made to gather virtual machine performance metrics and publish them to an API.  For now, here is the script to generate a CSV file with all vCenter performance metrics.


# define where we will save our performance metrics.
$outputFile = "C:\Users\chris\Desktop\perfdumps\vCenterMetrics.csv"

# define a new Powershell credential and log into vCenter with the credentials
$creds = Get-Credential
$vCenter = Connect-VIServer vc6b.vmware.local -Credential $creds -SaveCredentials

# define our vCenter service instance and performance manager.
# https://www.vmware.com/support/developer/converter-sdk/conv43_apireference/vim.ServiceInstance.html
$serviceInstance = Get-View ServiceInstance -Server $vCenter
$perfMgr = Get-View $serviceInstance.Content.PerfManager -Server $vCenter

# get all available performance counters
$counters = $perfMgr.PerfCounter

# create an array where we will store each of our custom objects that will contain the information that we want.
$metrics = @()

foreach ($counter in $counters) {
# create a custom Powershell object and define attributes such as the performance metric's name, rollup type, stat level, summary, etc
$metric = New-Object System.Object
$metric | Add-Member -type NoteProperty -name GroupKey   -value $counter.GroupInfo.Key
$metric | Add-Member -type NoteProperty -name NameKey    -value $counter.NameInfo.Key
$metric | Add-Member -type NoteProperty -name Rolluptype -value $counter.RollupType
$metric | Add-Member -type NoteProperty -name Level      -value $counter.Level
$metric | Add-Member -type NoteProperty -name FullName   -value "$($counter.GroupInfo.Key).$($counter.NameInfo.Key).$($counter.RollupType)"
$metric | Add-Member -type NoteProperty -name Summary    -value $counter.NameInfo.Summary

# add the custom object to our array
$metrics += $metric
}

# each metric object will look simliar to the following.  We can use a select command to gather which attributes we want and export them to a CSV file.
#   GroupKey   : vsanDomObj
#   NameKey    : writeAvgLatency
#   Rolluptype : average
#   Level      : 4
#   FullName   : vsanDomObj.writeAvgLatency.average
#   Summary    : Average write latency in ms

$metrics | select fullname, level, summary | Export-Csv -NoTypeInformation $outputFile

You can view the results on my vCenter 6.0 appliance here.


Installing the latest version of Docker on CentOS 7 minimal

I’ve been playing with docker lately and usually I want to have the latest version available as it brings bug fixes and enhancements, but I find that docker is released so quickly that the distribution releases lag behind the latest version a little bit.  Since I’ve had to repeat this process twice, I figured I’d document it and since I’m documenting it, I’d create a post.  There is nothing groundbreaking here, but it should get you up and running with the latest version of docker quickly.  The commands could be added to a simple bash script or you could create a Puppet manifest out of them.  See here for more info on installing Docker on CentOS.

Installing Docker

Download the latest version of docker:

curl -o /usr/bin/docker https://get.docker.com/builds/Linux/x86_64/docker-latest

Make the docker binary executable:

chmod +x /usr/bin/docker

We need to get some systemd files from here.

Download docker.service into the systemd directory:

curl -o /etc/systemd/system/docker.service https://raw.githubusercontent.com/docker/docker/master/contrib/init/systemd/docker.service

Download docker.socker into the systemd directory:

curl -o /etc/systemd/system/docker.socket https://raw.githubusercontent.com/docker/docker/master/contrib/init/systemd/docker.socket

Enable the docker service

systemctl enable docker.service

Start docker

systemctl start docker.service

Verify the docker version (1.6.1 at this time):

docker -v

Docker version 1.6.1, build 97cd073

Here are each of the commands:

curl -o /usr/bin/docker https://get.docker.com/builds/Linux/x86_64/docker-latest
chmod +x /usr/bin/docker
curl -o /etc/systemd/system/docker.service https://raw.githubusercontent.com/docker/docker/master/contrib/init/systemd/docker.service
curl -o /etc/systemd/system/docker.socket https://raw.githubusercontent.com/docker/docker/master/contrib/init/systemd/docker.socket
systemctl enable docker.service
systemctl start docker.service

Create a new image and container

Create a simple Dockerfile with the contents of:

FROM ubuntu:14.04
MAINTAINER Chris Greene <chris@vmware.local>
ENV REFRESHED_AT 05_12_2015
RUN apt-get -yqq update
RUN apt-get -yqq install

Build the docker image:

docker build -t chrisgreene/test .

View images:

docker images

REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
chrisgreene/test    latest              4b88ac6b0f60        2 minutes ago       209.1 MB
ubuntu                   14.04               07f8e8c5e660             12 days ago      188.3 MB

Create a container from the image:

docker run -it chrisgreene/test /bin/bash

View some info in the container:

cat /etc/os-release

NAME=”Ubuntu”
VERSION=”14.04.2 LTS, Trusty Tahr
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME=”Ubuntu 14.04.2 LTS”
VERSION_ID=”14.04″
HOME_URL=”http://www.ubuntu.com/&#8221;
SUPPORT_URL=”http://help.ubuntu.com/&#8221;
BUG_REPORT_URL=”http://bugs.launchpad.net/ubuntu/&#8221;

If you’d like a book on docker but are worried about it getting out of date quickly, checkout James Turnbull’s “The Docker Book“.  When docker 1.5 came out I received an email from James on the same day announcing that version 1.5 of his book was out.  The home page still list v1.5 but on the downloads page it is v1.6.