One of my biggest customers had some requirements from their operations team. They wanted to monitor the status of their Access Points and Wireless Users for their various networks and across various locations. They wanted to use this information to build their own KPIs and correlate this information with data that they are collecting from other systems. They have already standardised on Splunk to offer the unified dashboard and they wanted to ingest the data from the Aruba wireless controllers in Splunk.
Previously, I helped my client before to collect this information by using the legacy SNMP approach. However, and to meet the operations requirements, the customer had used very aggressive polling interval which I didn’t like as it put extra load on the controllers. Luckily, the customer has finally moved from AOS 6 to AOS 8 so I proposed another approach. Let’s say “Goodbye to SNMP” and “Welcome to ArubaOS 8 APIs” to meet these requirements!
ArubaOS 8 offers a REST API that can be accessed on https://CONTROLLER_IP:4343/api. This API offers multiple configuration capabilities. However, the part that I like the most is the show commands capability. By running the any show command, the output will be returned in a structured JSON format which can be easily parsed.
To meet the customer requirements, they needed to collect the output of two show commands. As such, I wrote a python script that logins to the MM, executes these commands and saves the output in a CSV file with proper time stamps. As such, Splunk will be able to parse these files to build the needed dashboard.
show global-user-table list show ap database long
Below is a sample of the code that I have used and a sample of its output. The output will be printed to the screen ( if debugging is enabled) and saved in CSV files. Every time the code is executed, different files will be written with the proper time format.
Below is a sample of the CSV files that will be generated.
The demo code that I have written is defined in two files.
MAIN.PY (This is the main file. It logins to the MM, Executes Command 1 and saves the output, Executes Command 2 and saves the output, then logouts). It uses AOS_API_CALLER.py to do these steps. AOS_API_CALLER.py defines a class which defines the 3 needed functions to communicate with AOS8 APIs. This code is based on the code https://github.com/do9xe/aruba_api_caller
The below figures further clarify the code that I have used.
Step 1: Logging In to the MM. Make sure to replace lines 10-12 with the proper values for your setup.
Step 2: Executing the show global-user-table list command
Step 3: Executing the show ap database long command
Step 4: Logging out
AOS_API_CALLER.py is the class that defines the 3 methods that we need for this requirement (Login, Logout, and cli_command which executes the provided command).
If you want to access the code, you can download it from here. Please note that this code is just provided as a proof of concept and it is not optimised or hardened.