How to Use the NetBeez API to Retrieve Ping Results

The NetBeez API

NetBeez gathers performance data from multiple points in your networks, by deploying network monitoring sensors or agents (known as Beez), which conduct continuous end-to-end tests against multiple targets in your network using a multitude of tools (ping, DNS, http, traceroute, speed test, iperf etc). The data is available to be viewed on the web-based dashboard, but sometimes your specific needs may require some extra data analysis to understand exactly the performance of your network from the end-user’s point of view.

One use-case could be that you want to view some data in a way that the dashboard doesn’t readily provide at the moment. Then this information can be used to generate reports that could help you make decisions on future expansions, or report the status of your network to upper management.

In this article we will go through the steps of setting up the necessary variables, to make REST API requests to a Beezkeeper instance.

More documentation about the NetBeez API can be found here: https://api.netbeez.net (and for the legacy API which will eventually be fully replaced by the one just mentioned: https://demo.netbeezcloud.net/swagger/)

How to get started with the NetBeez API

Before you can start using the NetBeez API to get network performance data, you’ll need to perform two actions:

  1. Setup your NetBeez Beezkeeper details
  2. Setup the headers

Let’s review each one of these steps in more detail.

Setup your NetBeez Beezkeeper details

First, you need to identify your server’s FQDN and generate an API key to use in these examples.

If the URL you use to access NetBeez looks like this https://demo.netbeecloud.net then demo.netbeecloud.net is the fqdn.

 

Set Up the Headers 

We define the content-type format as JSON and provide the API key that you generated in the previous step as part of the headers.

Note that when the legacy API headers are used it means that we are using the legacy API which is subject to be replaced soon by the new JSON API (documentation here: https://api.netbeez.net)

How to Retrieve Ping Test Results

In this example, we will be searching for an agent by name, then selecting the ping tests that are currently running, and then retrieving the raw measurement results for those tests from the past 60 minutes.

Retrieve the agent

First, we set ‘retrieve the agent’ by search by name using this API endpoint: https://api.netbeez.net/#f3d48709-5344-45b7-af9b-7b92feddd4ec.

Retrieve ping tests

Then we iterate through the tests and select the ping tests.

Retrieve the results

Then we retrieve the results for the past 60 minutes.

…and here is a printout of the results:

Out[12]:

retrieve ping API

Conclusion

You have the knowledge of a simple example on how to get started with getting data from NetBeez, doing some transformations, and finally visualizing them. It was pretty easy, right? Before getting into writing this example I have never used Python, but with the help of Jupyter Notebooks (https://jupyter.org/), I was able to easily write code and immediately see the results at each step of the way.

All this code is available as a Jupyter Notebook on our github.com account here: https://github.com/netbeez/nb-api-examples and for a live instance of the notebook, you can click on the binder link (http://mybinder.org/v2/gh/netbeez/nb-api-examples/master?filepath=index.ipynb).