Fotolia

Tip

How to use ChatOps to automate network tasks

Integrating team collaboration chat systems with network automation results in the ability to automate tedious workflows, enabling faster problem resolution and streamlined operations.

ChatOps is the use of a software command execution engine to interact with users via a team chat collaboration system like Slack, Microsoft Teams, Webex Teams and Mattermost. The software engine is known as a chat robot, or chatbot. Collaboration users issue commands to the chatbot, which, in turn, performs a set of actions and returns the results to the chat system's channel or room. It streamlines the workflow in which automation collects and presents data from one or more systems without requiring user action.

Network teams can use ChatOps to automate network tasks and workflows for more streamlined operations. As an example, let's use a chatbot with Slack to automate a common network workflow that reports a device's location based on its IP address, with the /net-find ip 10.1.1.1 command.

Interactive commands in Slack begin with the / (slash) character, /net-find in this example. The chatbot is sent the remainder of the command -- ip 10.1.1.1 -- which it uses to find the connection information for that address. If the lookup is successful, the connection information is added to the Slack channel.

More complex workflows can be automated. One common use case triggers a bot when significant network events are detected, such as the failure of a key network component. The bot creates a new channel, adds key network staff and then posts diagnostic information about the failure. The history of the event is collected in one place, making it easy for the network staff to track its history and current status. The network staff would then issue other chatbot commands to collect additional information and add it to the channel.

ChatOps screenshot /net-find ip 10.1.1.1 function, Tim Schreyack at NetworkToCode
Screenshot of a ChatOps function on Slack: /net-find ip 10.1.1.1. Courtesy of Tim Schreyack at NetworkToCode.com

Integrating ChatOps with network automation

Teams should use ChatOps to automate common workflows, particularly those around network automation and network troubleshooting. I recommend starting with a few simple, read-only tasks to get experience and expand as teams learn.

Teams should use ChatOps to automate common workflows, particularly those around network automation and network troubleshooting.

Collecting troubleshooting information is an ideal task, especially for time-consuming workflows. For example, teams can automate querying a configuration management database about the devices on the ends of a failed network link. They can then use network automation to collect interface information, potentially pinpointing the root cause. These steps would be completed and posted in the case channel by the time the teams learn about the problem.

Teams can then use their knowledge to expand to other workflows, such as the allocation of a new server IP address or the creation of a new virtual LAN.

What to know for ChatOps automation

Scripting language skills. To use ChatOps for automation, you'll need to have some scripting language skills, probably Python or JavaScript with JSON. The team collaboration products publish guides for creating simple chatbots (see References below).

APIs. Integrating your chatbot with network automation tools will require experience with the API of each tool. No current standards exist for APIs. All REST APIs will follow a similar model but with variations in function names, the parameters to be supplied and the returned data.

Security. Don't overlook building security into your ChatOps system. Each network automation tool will have its own API security tokens, or keys, and it's tempting to put those tokens in the scripts. However, it is too easy for the script to be accidentally posted to a public code repository where bad actors can discover the tokens, thus opening your network to unauthorized access.

Commands. If you're starting ChatOps from scratch, it is easier to start with fixed commands because they are unambiguous, so you don't have to guess about what is requested. Common network operations workflows are easily automated using fixed syntax commands like those in the /net-find example above.

Bot framework. A bot framework may help you manage a chatbot conversation. A variety of framework choices are available, some of which will work with a range of chat systems. Research chatbot frameworks to evaluate the options. These frameworks may use a middleware pipeline to handle a sequence of interactions with a person. Pipelines are more complex to construct and are typically used in customer-facing chatbots that incorporate natural language understanding with machine learning. This complexity is rarely needed with network automation.

Get started with ChatOps

Getting started with ChatOps is not particularly difficult. It can actually be less effort than adopting some of the network automation systems. To help, I've collected several references to make your journey easier.

References to get started with ChatOps automation

Slack has published a short video of tips for resolving incidents faster. It's more about effective use of team collaboration tools than about chatbots.

In this Fintech Open Source Foundation video, Mattermost's CTO describes ChatOps, its advantages and how to get started.

Collaboration tool vendors have documented how to add chatbot commands. The methods differ slightly from product to product, as seen below:

Like network automation, adopting ChatOps is a journey that requires a culture change. Instead of troubleshooting conference calls, the staff will engage through a collaboration system. The record of the session provides a history that can inform how future events are handled. Teams should expect to progress through phases of increasing complexity, in a crawl, walk, run progression. Good luck on the journey.

Dig Deeper on Network management and monitoring

Unified Communications
Mobile Computing
Data Center
ITChannel
Close