In the previous parts we discovered Skydive through its WebUI. In this part
we are now going to use the Skydive command line to reproduce what we did previously.
Skydive client, Gremlin requests
In order to have an easy fully functional Skydive multi-node deployment we will use the
Vagrant environment as previously.
Following the previous part you should have the following topology in the WebUI.
Now that we have our lab deployed we can connect to the analyzer node in order to
use the Skydive binary to request the Skydive API.
Skydive uses the Gremlin graph traversal language as its query language.
The following request returns all the eth0 interfaces present in to topology
using the JSON format.
We can obtain the full topology in a dot format with the following request :
Which gives once rendered the following image:
In order to get the state of the eth0 belonging to specific host, we can use this :
This has to be read as “select the node with the name agent1 then select node
with the name eth0”
A more exhaustive documentation of the Skydive Gremlin language is available
here
Capture request
As seen before it is easy to select interfaces of the topology and starting a traffic
capture is as simple as writing a select request.
To start a traffic capture on all the eth0 interface we just have to reuse
our first Gremlin request like this :
In order to check that the capture definition matched two interfaces we can
just list them.
The count field indicates how many traffic capture have been started.
Another way to check is to write a request retrieving the interfaces on which
the capture have been started.
Packet injection
We are going to use the command to generate ICMPv4 packets. Packets will be injected from one eth0 towards the other eth0.
First we need to get the IDs of the interfaces.
Now the packet injection request :
And we can finally get the flows. We will get 2 flows as we started two captures so
one ECHO/REPLY flow per capture.
We can just select a specific field using the ValuesGremlin step.
Flows have a unique UUID per capture but also have a TrackingID which is the same across multiple captures.
The Gremlin step Dedup de-duplicates flow according to the TrackingID.
We can also specify the capture from where we want to get the flow.
If you created a capture with a Name…
…you can use it to select the flows.
It is also possible to start from a flow to get all the captured interfaces
where ICMPv4 flows have been seen.
This post was just an introduction to the Skydive API and query language. The same language
is leveraged by some other features that Skydive brings, like alerting. A more complete
documentation is available here