vRealize Operations

Webhook-Shims Now Available on Docker Hub

Would you like to extend your Log Insight and vRealize Operations alerts to open tickets in ServiceNow or automatically attempt remediation?  What about notifications or ChatOps?  These and more are possible with Webhook-Shims, an open source solution to empower VMware Intelligent Operations with practically unlimited functionality.

Until now, installing Webhook-Shims required some knowledge or willingness to learn to use Python virtual environments and installing some additional Python modules via PIP.  Not that this was really difficult, but if you just wanted to get Webhook-Shims up and running, it could be frustrating for a VI admin with no experience with Python.

Containers to the Rescue

To make it easier to download, run and experiment with Webhook-Shims, we have build a Docker image based on VMware’s own Photon OS.  This image will allow you to quickly deploy and run Webhook-Shims in seconds.  Follow along and I will walk you through the process – it will take longer to read this blog post than it will to run your first Webhook-Shims container!

First, you’ll need an OS running Docker.  Good news here, because VMware’s Photon is purpose built for running containers and it’s free!  Download your choice of container options (I’m using the hardware version 10 image) and drop the image into your vSphere environment or VMware Workstation.  Other options are available, including Windows 10 versions of Docker but I recommend sticking to a Linux host for this because that’s all I have tested this solution with.

Make sure the Docker service is running – in Photon OS use

systemctl enable docker

systemctl start docker

You’re ready to go!

Download and Run the Container Image

Running the Webhook-Shims container is simple.  Just use the command below

docker run -it -p 5001:5001 vmware/webhook-shims

The image will now download and takes only a minute or less depending on your connection speed.  Of course, this is the basic command to start Webhook-Shims but good enough to test things out initially.  This puts the container into interactive mode, maps the host port 5001 to the container port 5001 (the default for Webhook-Shims) and starts the container.  Once running, you can simply open a browser connection to the Docker host (i.e. your Python OS VM) on port 5001 to verify.

webhookshimsbrowser

Notice that since you started the container in interactive mode, you can watch the log file from the Photon terminal where you started it.  Note the incoming connection from my test.

2017-03-29 08_39_12-photon-custom-hw10-1.0-13c08b6 - VMware Workstation

Configuration, Tips and Tricks

Of course, you will need to configure one or more of the shims for use.  Things like hostnames and user credentials need to be set.  You can’t do this during the interactive session with the solution running, so you will need to exit and restart the container to access the shell.

Ctrl-C will stop the Webhook-Shims server and return you to the host system.  From there, you simply need to run

docker ps -a

This will provide the name and ID of the container you started and then exited.  It’s in a stopped state currently.  To restart, note the container name or ID and use the following command

docker start <your container name or ID>

docker exec -it <your container name or ID> /bin/bash

This will start the container, set it to the bash shell and then allow you to connect.

2017-03-29 09_12_49-photon-custom-hw10-1.0-13c08b6 - VMware Workstation

From here, you can edit the shims as required.  When you are done, simply issue the command

exit

Or alternatively, you can just run the Webhook-Shims from this shell

~/webhook-shims/runserver.py

If you do not want to be in interactive mode with your container, but still want it to run, use Ctrl-P, Ctrl-Q to disconnect from the container and let it run in the background.  To re-attach to the container, just use

docker attach <your container name or ID>

Now, if you do not like the assigned container name, you can rename the container to something easier to remember, like “w10s” for Webhook-Shims

docker rename <your container name or ID> w10s

final

Webhook-Shims Container

I hope this helps make it easier to work with Webhook-Shims by reducing the installation steps and removing some of the expertise required just to test it out.  You may still want to look into the Python code behind the shims, and I recommend that you do so to validate what is happening and how you can make tweaks and create other shims for your own use – or even contribute to the open source project!

Finally, if you would like the Dockerfile for the image to build your own, you can find it below.