Many of us here at Dynatrace are geeks who love playing with technology. We’re also big fans of movies. So, with all the recent attention paid to AI and intelligent messaging-based personal assistants in movies, we decided it was time for us to do some AI innovation of our own using the versatile messaging-integration options provided by Dynatrace.
Using AI to make DevOps tasks simpler
A key driver in designing Dynatrace was to build a tool that provides sophisticated, intelligent monitoring insights into what’s going on in your applications. The Dynatrace Artificial intelligence engine continuously monitors every aspect of your application to learn your application’s typical performance patterns, such as error rate and response times. Dynatrace uses a large amount of computational power to automatically keep track of all aspects of your application. Dynatrace keeps an eye on every host, every service (down to the code level), and even the experience of your customers using your app. Dynatrace continuously monitors your environment for issues that require intervention from human operators. So, Dynatrace artificial intelligence manages a multitude of highly sophisticated tasks that would be error-prone and prohibitively time-consuming to perform manually using a traditional monitoring system.
Normally, the Dynatrace AI communicates with you via push notifications that are sent to your smartphone and the Dynatrace web UI. This enables us to show you more than just a bunch of charts with metrics. For example, each detected problem includes a Visual resolution path rendering of the end-to-end service requests operating in your environment during the time that the problem was detected. Dynatrace also provides a Problem Evolution player that enables you to replay the sequence of events that led up to the problem!
Inspired by Ironman’s J.A.R.V.I.S., we thought about how to connect the Dynatrace artificial intelligence layer with modern collaboration platforms to augment the experience of DevOps engineers who are tasked with resolving performance problems. Our goal is to provide a platform where both we and our customers can experiment and build their own AI-interaction kits.
Building an API to our AI layer
Since there are so many different technologies available for facilitating team communications (many use Slack and HipChat), Dynatrace artificial intelligence can now be accessed via a convenient API. So, now instead of opening the Dynatrace web user interface to see how your system is doing, you can communicate directly with Dynatrace using your team’s preferred messaging system.
Your first Dynatrace AI bot (Slack example)
The remainder of this post shows you how to build your own Slack chat bot using the Node.js botkit framework to directly communicate with the Dynatrace AI using our public Dynatrace Problems API.
To begin customizing your own Dynatrace Slack bot you need to create your own Slack bot identifier.
Choose a friendly name and description for your bot as you will interact with it regularly. Once you’ve created your Slack bot, copy the bot’s generated API token to your Node.js bot environment.
To speed up your own Dynatrace bot customization we provide an open source reference implementation of a Dynatrace Slack bot that is built on top of the Node.js botkit framework. You can clone it directly from our GitHub repository from the command line:
git clone https://github.com/ruxit/chatbot-kit
Next, go to your chatbot-kit folder and install all required dependencies using the following terminal command:
sudo npm install
Connecting your Slack bot to Dynatrace
Generate a Dynatrace API key to dialog with your Dynatrace environment:
Run the Dynatrace Slack bot by executing:
Make your bot do something useful!
Once your Dynatrace Slack bot is up and running, invite it to one of your team channels where it can provide detailed information about the current state of your applications, services, and infrastructure. Using the Dynatrace API you can enhance your Dynatrace bot to provide exactly the answers your teams need.
To use our Dynatrace Problems API to query the state of your environment, call our
/problem/status endpoint, as shown in the following example:
https://<YOUR RUXIT ENV>.live.ruxit.com/api/v1/problem/status?Api-Token=<YOUR RUXIT API TOKEN>
The call returns an overview of your environment status.
You can quickly get the details of all open problems by calling the
/problem/feed endpoint, as shown here:
https://<YOUR RUXIT ENV>.live.ruxit.com/api/v1/problem/feed?status=OPEN&Api-Token=<YOUR RUXIT API TOKEN>
A call to the feed REST interface returns the following example result:
Once you’re using the Dynatrace Problems API to fetch all incident information at an API level, and you’ve built a customized and friendly Slack bot, you may end up having a Slack dialog similar to the following.