OpenFaaS event connector for VMware vCenter
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


vcenter-connector is an OpenFaaS event connector built to consume events from vCenter from VMware

With this project your functions can subscribe to events generated by the changes in your vCenter installation - for instance a VM being created, turned on or deleted. This allows you to extend vCenter's functionality by writing functions to execute each time an event is fired. An example may be tagging a VM with the date it was last turned on or applying a tag showing which user made a change to an object.


This project uses the OpenFaaS Connector SDK.

The code is under active development and only suitable for early adopters. More examples and instructions for use in Kubernetes are being worked on.


How it works:

Functions can subscribe to events in vCenter through the "topic" annotations applied through your stack.yml file.

I.e. in the following example we will subscribe to the event "vm.powered.on" by adding an annotation to our function of "vm.powered.on"

Get started with the example

  • Run the vCenter Simulator
# Note: the following steps assume a correctly configured GO environment (using GOPATH)
go get -u -d
cd $GOPATH/src/
go build -o vcsim main.go
./vcsim -tls=false
  • Run the connector
go run main.go -vcenter-url="http://user:pass@" -insecure

Deploy an echo function that subscribes to the event of "vm.powered.on"


git clone
cd echo-fn
faas-cli template store pull golang-http
faas-cli deploy

The stack.yml contains an annotation of topic=vm.powered.on, to change this edit the file and run faas-cli deploy. To edit the code in the handler change the code and image field then run faas-cli up

  • Generate some events:
# Note: the following steps assume you have already downloaded the govmomi sources as described above in the vcsim section
cd $GOPATH/src/
go build -o govc main.go

# turn all VMs off
GOVC_INSECURE=true GOVC_URL=http://user:pass@ ./govc vm.power -off '*'

# turn all VMs back on to trigger the event
GOVC_INSECURE=true GOVC_URL=http://user:pass@ ./govc vm.power -on '*'
  • Check the logs of the echo-fn function
# on Kubernetes

kubectl logs -n openfaas-fn deploy/echo-fn

# or on Swarm

docker service logs echo-fn




Thanks to VMware's Doug MacEachern for the awesome govmomi project providing Golang bindings for vCenter and the vcsim simulator tool.

Thanks to Karol Stępniewski for showing me a demo of events being consumed in OpenFaaS via vCenter over a year ago at KubeCon in Austin. Parts of his "event-driver" originally developed in the Dispatch project have been adapted for this OpenFaaS event-connector including a method to convert camel case event names into names separated by a dot. I wanted to include this for compatibility between the two systems.