Network Observability with SuzieQ: Part Three
Unlock network insights effortlessly with SuzieQ's powerful data interaction tools.
In part 2 of this multipart series on network observability with SuzieQ, we looked at how to setup SuzieQ using docker compose. In this part, we will look at how to interact with the data collected by SuzieQ using the command line interface (CLI) and its REST API.
If you have not read Part One and Part Two yet, I recommend you read it first before proceeding with this part.
SuzieQ CLI
SuzieQ provides a command line interface to interact with the data it has collected. Like any Linux CLI, SuzieQ CLI providers command completion when options are available and also provides help for each command. All commands follow a common structure <table_name> <verb> <filters>
. This will make more sense when we start looking at some examples.
Let us start by running the SuzieQ CLI. If you have been following along with the previous parts, you should have the SuzieQ docker container running and you can connect to the SuzieQ CLI by running the docker attach suzieq_cli
command. Once you are connected, you will see a prompt like this suzieq>
. This is the SuzieQ CLI prompt.
From here you can get help by running the help
command. This will show you all the commands available in the SuzieQ CLI. You can also get help for a specific command by running help <command>
. For example, to get help for the bgp
command, you can run help bgp
.
Tables
SuzieQ stores the data collected in tables. You can get a list of all the tables by running the table show
command. This will show you all the tables available in SuzieQ.
You can get data from a specific table by running the <table_name> show
command. For example, to get data from the bgp
table, you can run bgp show
.
Querying Data
Now that you have a basic understanding of the SuzieQ CLI, let's look at how to query the data collected by SuzieQ. SuzieQ provides a powerful query language that allows you to filter and aggregate data.Again the best way to understand the query language is to use it.
Let's start by running a simple query to get the data from the bgp
table. Say for instance you want to get information about the BGP sessions that are in the NotEstd
state. You can run the following query:
suzieq> bgp show state=NotEstd
namespace hostname vrf peer peerHostname state afi safi asn peerAsn pfxRx pfxTx numChanges estdTime
0 ilab lab-rce-600 VRF-EXTERNAL 172.16.69.19 NotEstd vpnv4 unicast 64604 64603 0 0 0 1970-01-01 10:00:00+10:00
1 ilab lab-rce-600 VRF-EXTERNAL 172.16.69.35 NotEstd vpnv4 unicast 64604 64603 0 0 0 1970-01-01 10:00:00+10:00
2 ilab lab-rce-600 VRF-EXTERNAL 172.16.127.140 NotEstd vpnv4 unicast 64604 10148 0 0 0 1970-01-01 10:00:00+10:00
3 ilab lab-rce-600 VRF-EXTERNAL 172.16.127.142 NotEstd vpnv4 unicast 64604 10148 0 0 0 1970-01-01 10:00:00+10:00
4 ilab lab-rce-600 VRF-EXTERNAL 172.16.127.144 NotEstd vpnv4 unicast 64604 10148 0 0 0 1970-01-01 10:00:00+10:00
5 ilab lab-rce-600 VRF-EXTERNAL 192.101.254.117 NotEstd vpnv4 unicast 64604 64604 0 0 0 1970-01-01 10:00:00+10:00
6 ilab lab-rce-600 VRF-PROTECTED 172.16.127.152 NotEstd vpnv4 unicast 64604 64603 0 0 0 1970-01-01 10:00:00+10:00
7 ilab lab-rce-600 VRF-PROTECTED 172.16.127.172 NotEstd vpnv4 unicast 64604 64603 0 0 0 1970-01-01 10:00:00+10:00
8 ilab lab-rce-600 VRF-PROTECTED 172.16.127.178 NotEstd vpnv4 unicast 64604 64603 0 0 0 1970-01-01 10:00:00+10:00
9 ilab lab-rce-600 VRF-PROTECTED 172.16.127.180 NotEstd vpnv4 unicast 64604 64603 0 0 0 1970-01-01 10:00:00+10:00
10 ilab lab-rce-600 VRF-PROTECTED 192.101.254.119 NotEstd vpnv4 unicast 64604 64604 0 0 0 1970-01-01 10:00:00+10:00
You can also query data over a time range, and you can do that by using natural query spec
which is a way to specify a time range in a human-readable format. For example, to get the BGP data from a particular host over the last day, you can run the following query:
Assertions
SuzieQ also performs assertions for some of the data it collects. More on the assertions can be found in the SuzieQ documentation. SuzieQ runs a number of checks for the service and providing a pass
or fail
. It adds a column assertReason
to the output of the query to show the reason for the assertion result. Lets look at an example of the interface
table:
SuzieQ REST API
SuzieQ also provides a REST API that allows you to interact with the data collected by SuzieQ programmatically. The REST API provides endpoints to query the data, run assertions, and more similar to the CLI.The REST API documentation can be accessed by visiting the /api/docs
endpoint of the SuzieQ REST Container. For example, if you are running SuzieQ using docker-compose, you can access the REST API documentation by visiting http://localhost:8000/api/docs
. It lands you on a swagger UI page where you can see all the endpoints available in the SuzieQ REST API.
You can try out the endpoints directly from the Swagger UI by using the API key set in the configuration file. It also provides the curl command to try out the endpoints. Below is a screenshots of the Swagger UI.
Wrapping Up
Wrapping up this part, we looked at how to interact with SuzieQ using the command line interface (CLI) and its REST API. We saw how to query the data collected by SuzieQ using the CLI and how to run assertions. We also looked at how to access the REST API documentation and try out the endpoints using the swagger UI.
With this we have just scratched the surface of what SuzieQ can do, the possibilities of what information you can get from the data collected by SuzieQ are endless. You would have to try it for yourself to see the full potential of SuzieQ and how it can help you in your day-to-day work.