menu
No REST for the Weary « US English

No REST for the Weary

SHARE ON:

Application Aware Network Performance Monitoring (aaNPM) solutions sit on your network and monitor the traffic. They store information about what hosts are talking to what other hosts over what ports, protocols, and applications sending how much traffic. A wide variety of metrics are available for this information depending on the source of the information being collected and coalesced.

In the case of SteelCentral NetProfiler the information available can include everything from client and server hosts, ports, protocol, bytes, and packets to the server and client delay, network round trip time, the application (on a Layer 7 level as opposed to simply based off the ports and protocol), and reset and retransmit details. Depending on the type of report being run there can be upwards of 120 different columns available for a report or dashboard widget. Having all this information available within NetProfiler is great and makes the appliance an incredibly powerful tool. Reports can be run based on a huge variety of different criteria, the information presented in a myriad of ways, and the results used to show all sorts of different things. Even with all that there are still times when you might want more.

To facilitate this NetProfiler has implemented a robust and detailed RESTful API. The RESTful API allows users to access the underlying tools and data stored on the NetProfiler and use that information in ways not supported by the existing user interface.

While the NetProfiler dashboard and it's related widgets allow you to present the information in many different ways one thing you can not do is display the information on a corporate Intranet. Maybe you want to have a graph on the main page of your company site showing status of critical infrastructure links and components. Or perhaps you want each user to be able to see how much bandwidth they are individually consuming.

Instead of showing information to end users you may want you want to dynamically update certain settings on the NetProfiler as other things on your network change. Update host groups to match adjustments made to your corporate network without having to go in to the NetProfiler UI. Change the DSCP configurations as you make changes to routing and QoS on your network. With the RESful API the possibilities are almost endless.

With the NetProfiler RESTful API implementation you can do all that and more. Getting data out of the NetProfiler via the RESTful API is as simple as issuing a single command. This command can tell the NetProfiler to do everything from run a report and send the resulting data in CSV format to updating configuration settings.

Let's say we want to run a traffic report in NetProfiler. First we need to tell NetProfiler all the details we want in the report such as time frame, traffic expression, centricity, data resolution, etc. For this example this is done via a report.json file. This file contains the details of the report to be run coded to the JSON standard however you can also use XML:

{
    "criteria": {
        "time_frame": {
            "start": 1445000446,
            "end": 1445003800
        },
        "query": {
            "realm": "traffic_summary",
            "group_by": "hop",
                                             "traffic_expression": "",
            "sort_column": 33,
                                                "centricity": "hos",
            "columns": [
                                                        9,
                                                        10,
                                                        13,
                                                        14
            ]
        }
    },
    "template_id": 184
}

Once the report.json file is properly configured you need to pass that file to the NetProfiler along with the proper REST calls to tell the NetProfiler to execute the query:

REPORT_ID=`curl -v --insecure -H "Content-Type: application/json" -X POST --data "@report.json" \
-u {user}:{password} https://{IP}/api/profiler/1.6/reporting/reports 2> /dev/null \
| awk '{print $3}' | awk -F\" '{print $2}' | tr -d '\n'`

Once we have the report ID and the report has completed we can get the query ID via REST:

QUERY_ID=`curl -v --insecure -H "Accept: text/xml X-Requested-With: XMLHttpRequest" -X GET \
-u {user}:{password} https://{IP}/api/profiler/1.6/reporting/reports/$REPORT_ID/queries \
2> /dev/null |grep actual_log | awk '{print $8}' | awk -F\" '{print $2}' | tr -d '\n'

And with the query ID now determined we can request the output in a variety of different formats (including PDF and CSV):

curl -v --insecure -H "Accept: text/csv X-Requested-With: XMLHttpRequest" -X GET \
-u {user}:{password} https://$3/api/profiler/1.6/reporting/reports/$REPORT_ID/view.csv \
2> /dev/null

Looking at these three commands a little more closely we see that they are all Linux commands and take advantage of many of the built in Linux tools and utilities.  The first command issues a REST call via the curl command. The resulting data is parsed using awk and tr to output just the report id. The second command also issues a REST call via the curl command and again uses awk and tr while adding grep to the list to get the query id. The final command uses just curl to tell the NetProfiler to return the data from the report in CSV format.

Here we can see that that with three relatively simple commands it is possible to leverage the advanced reporting of NetProfiler to retrieve information stored in the device in a variety of ways. With this information so easy to retrieve in easily manipulatable formats the ability to use the information stored in NetProfiler in ways never before thought possible becomes trivial.

Further Reading:

  • The NetProfiler RESTful API documentation is included on every NetProfiler and is accessible under the Help menu.
  • Riverbed also provides a Python interface to the REST API called SteelScript
  • A discussion on the Riverbed Splash community site detailing how to run a NetProfiler traffic report via REST.
top.name