Integrating vRealize Orchestrator with … IFTT !

This blog post explains in detail an example I worked out for the vRealize Orchestrator mini-workshop I have been teaching in the Benelux Summer School. If you did not attend and need an introduction to Orchestrator, have a look at my Orchestrator resources mindmap. I especially recommend the free video course to get you started ! If you do not immediately have an environment to try this out, I recommend you use the Hands-on Labs. HOL-SDC-1421, for example, has a complete Orchestrator environment. Click the Start menu, VMware to find the Orchestrator client.

Intro.

IFTTT (“If-This-Then-That”) is a simple but very effective programming system for everyone on the web. For free ! You get “channels” to interact with a service, like Instagram or Philips Hue lights, there are tons of possible channels. With a “Do recipe” you can quickly create your own interaction. An “If recipe” runs in the background and automates stuff for you. I have for example a recipe I use all the time: when I see an interesting tweet I want to save (I use Evernote religously) I just favorite it. An If recipe then automatically stores it in Evernote. With content sorted in certain fields.favorite_tweet_recipe

Admins are always looking to have easy alerting in case of problems on smart phones, pagers,… How cool would it be to interface anything that lives in vRealize Orchestrator (vRO) with IFTTT ? You can send alerts to Android or iOS native notifications, or change your Hue lights to red if you have a performance problem, or… whatever you can come up with.

IFTTT  now comes with a channel to basically interface anything that has a REST API interface: Maker channel. It can receive messages on a trigger or send web requests. And did I mention all of this is free ?

Connect_Maker_to_hundreds_of_apps_-_IFTTT

Building it.

So I thought it would be cool for the workshop to build a workflow that sends notifications to my iPhone from vRO. You can enhance this to send any notification, like SNMP alerts using the SNMP module. What we need to do is:

  1. Build an IF recipe in IFTTT that always listens to vRO sending a POST request to the Maker channel API interface.
  2. Register IFTTT as a RESTHost in our Orchestrator inventory.
  3. Register the POST action in Orchestrator as a RESTOperation.
  4. Use the “Invoke REST operation” workflow in your own workflow.

There are of course several ways to do this. You could write everything in one scriptable action in javascript. I think however that leveraging the inventory in Orchestrator is key to easy management of your resources and readability of your workflows. You can see if a REST Host or vCenter server is online in your environment separately from your workflows. That is a big advantage. Also if you use these resources in your workflows, as inputs for example, it gives you a bullet-proof way to select only viable resources, like a vRA IaaS server.

IF Recipe.

You need to activate the Maker channel in IFTTT to get a personal key and do REST calls.

Connect_Maker_to_hundreds_of_apps_-_IFTTT

I am sending events called “vCO” to recognize things coming from vCO, so you need to create a recipe that triggers on those messages and passes them along. I send them to iOS notifications.

vCO_recipe

Register IFTTT as RESTHost.

As said I registered the Maker channel IFTTT host in Orchestrator as a REST host. There is a workflow to do this called “Add a REST host” in Library/HTTP-REST/configuration. The REST library is installed by default in vRealize Orchestrator, so you just provide the right parameters. In my case I need a proxy to get out on the internet.

vCO_-_resthost_IFTTT

Register POST action.

In the same way we added a REST host to vCO, we add a REST operation to that host with the name VCOevent, using the workflow “Add a REST operation”. You recognize the URL template as the url string I have to send to IFTTT with  my personal key, “vCO” trigger and one parameter. You can of course use other events and more parameters and change the text.

vCOevent_IFTTT

vCO Workflow for IFTTT.

My worflow now consists of one embedded workflow “Invoke REST operation”. You can download it here, import it in your Orchestrator and adapt it for your own use. The REST operation/host has a default value in attributes as defined previously. I only have to pass a parameter. In Orchestrator an extremely handy tool is visual binding, which helps you see how parameters link from one module to the next.

IFTTT_Rest_operation

Usage.

Now if you run the workflow a message will magically appear on my iPhone ! Note that the Orchestrator client is great for debugging: each time you run a workflow a token is created with logs. You can check that the workflow ran and that the status code for the REST operation is 200 if successful.

vCAC_6_2_UK_demo_-_EMEA_Sandbox

And of course on your iphone you get a notification:

IFTTT-iphone screen

Cool hum ? Can you imagine some useful interactions ? Sending vRealize Operations smart alerts to your iPhone ? vCenter errors ? Let me know in the comments if you adapted this for your use. Enjoy !