Go back

CLI Parsers: The Basic Unit of Automation

November 8, 2018

CLI parsers are specialized files that essentially tell your system the following:

“for CLI output [X], here’s how to distinguish the important variables [Y] & [Z] from the rest of the information and produce structured responses for the user.”

These are indispensable when it comes to network automation, and as I’ll get into a bit later, the building block of NetBrain’s customizable Qapps.

The Command Line Interface is a powerful, complex, and rather daunting tool that every network engineer needs to learn in order to excel at their job. CLI mastery has been a marker of success for a long time and will continue to be so in the future. However, as the size of the network increases, the CLI’s effectiveness diminishes: Imagine if I asked how you’d verify identical interface configurations on a thousand FastEthernet0/1 interfaces on a thousand devices.

If your answer is ‘open a thousand SSH sessions’, then you may be at this for a while.

The CLI grants us valuable insight into our network devices and allows us granular control over a device. However, just like over-reliance on the GUI can hold me back from being more proficient with the CLI, the CLI itself becomes a choke point when it comes to process automation.

If you need to touch a hundred devices to resolve an issue, you’re going to need to script it. A big problem for engineers is that their required skill sets don’t really enforce learning a scripting language like Python or Javascript. A bigger problem is that the CLI presents the user with a lot of unstructured data, which is historically not that great for programming and creates an additional hurdle that the engineer has to jump through.

When I say unstructured data, let me break it down a little bit:

Imagine that you want to know someone’s name. Unstructured data is the equivalent of asking for their license – you’d still need to read it in order to find what you’re looking for. A parser is something that would read their license, and identify which area contains their name for you, and present it in a visually appealing way

NetBrain recognizes the steep difficulty spike that appears whenever people need to start scripting – it’s scary, confusing, and time-consuming in all the ways learning a new language can be. When we present our Qapps and Runbooks as scriptless automation, we’re essentially applying our CLI parsers in advanced ways. Our CLI parsers

For example, let’s look at a simple built-in Qapp that collects basic interface settings.

As you can see here, the entire Q-app is just an execution of a program called GetIntfIntfSetting

The sequence of this Qapp is as follows:

  1. For each device in the queue
  2. Perform a show interface command
  3. Collect device data into a table
  4. Convert device data table into a global data table
  5. Execute conversion by rows into an excel file.

The CLI Parser comes into effect during steps 3 and 4. It would take quite a while to go into the minutiae of every logical aspect of the parser, so I’ll just walk through the basics in this sample output here:

Here, NetBrain’s built-in CLI parsers enable the system to easily identify variables such as Interface Name [$intf], Status [$status], Inbound Packets [$pkts_input], etc. because we’ve taken the time to examine what this output looks like from this vendor’s CLI and manually identified the information we’d need to examine.

You, as the engineer, need only run the Qapp, and NetBrain will procedurally log into those thousand devices, and tell you what the interface statuses are.

So you might be wondering, what happens when you have to do the same thing but with another vendor? The answer is simple. Here at NetBrain, we’ve already created parsers for the most common commands executed on a device. Whether it’s…








Or really, any of the long list of vendors we support, we have made sure you can identify identical sets of data across each of these platforms.

In the event that you need a more complex parser, we have an entire system for building your own, too!

That is, however, a topic for another day.

Conclusion – Why CLI Parsers?

CLI Parsers deal with the logic of state change. CLI parsers help you properly sequence your data in order to create actionable information as you convert unstructured data into a structured format. As stated earlier, every Qapp in NetBrain is an enhanced expression of a built-in or customized CLI Parser.

The Command Line is not going anywhere. It will always be the most efficient way to access data on a single device and control it with precision and granularity. However, when it comes to large networks, you need to automate the basic tasks so there’s still some part of your day left to do meaningful work.

If you’re interested in CLI parsers, make sure to check out NetBrain University’s free courses on creating your own.


Related Content

Networking Perspectives

NetBrain Amplifies PRTG for Seamless, Faster Troubleshooting

One sometimes overlooked aspect of automating network operations is leveraging data from your IT ecosystem for better network operations. Understanding the power of IT monitoring data, NetBrain integrates seamlessly with…

Read More
Product Updates

NetBrain 10.0: A Milestone for Network Automation

The network is the backbone of the modern enterprise. If the network goes down, the results are costly, and reputations take a hit. We’ve seen examples of the negative impact…

Read More
Product Updates

Make Safer Changes: Automated Change Validation

Ed. note: The following transcript has been drawn from the on-demand recording — no registration needed or form to fill out — of  NetBrain’s Just in Time Automation for IT Operations…

Read More