Using Aruba Meridian APIs to Get Beacons with Low Power

Aruba’s Meridian solution is a cloud-based software-as-a-service solution that is part of Aruba’s location-based services portfolio. In brief, this solution helps offer a better experience for the visitors or users including indoor turn-by-turn directions, proximity-based notifications and asset tracking.

Last week, I was approached by one of our customers here in U.A.E. who is using our platform. They have a large deployment of more than 5000 beacons deployed. The beacons that they are using are a combination of the beacons built-in in our APs and standalone battery-based beacons, used to provide a greater accuracy. Our Meridian web platform offers a way to monitor the beacons from the web interface, but they needed a simpler programmatic way to monitor all battery based beacons whose battery levels are getting low.

Being familiar with Meridian REST APIs capabilities, I promised the customer that I will share with him a sample python script to meet his requirement. To avoid reinventing the wheel, I searched on Airheads and I found a sample code that get the battery level for battery-based beacons at https://community.arubanetworks.com/t5/Location-Services/Using-the-Meridian-API-Checking-Beacon-Battery-Levels/td-p/520886

I checked the python script available at the above link and understood its logic. I used it as a reference to build my sample code in a more structured manner. The main logic of the script is now documented in the main function shown below. For my customer, I set the limit to 30 on line 130.

Screenshot 2019-11-09 at 20.34.51

You need to specify the location id and authtoken in lines 7 and 8 to use it with your Meridian account. In brief, the script now fetches beacons based on pagesize variable defined in line 14. So in my example below and since I only had few beacons in my test account, I set the pagesize to 2 so it got information about 2 beacons at a time. For my customer, I set it to 200 instead.

Screenshot 2019-11-10 at 00.09.22

The script finally prints all battery based beacons whose battery level is less or equal to the limit variable defined in line 130. The script prints all results to screen as shown below.

Screenshot 2019-11-09 at 20.25.49

It also saves the result in beacons-list.csv file.

Screenshot 2019-11-09 at 20.41.08

The above requirement is an example of why Network Engineers must learn how to use Python to help them work efficiently. I am sure that my code can be better tuned and optimized. As always, have a positive mindset and keep on experimenting and learning. Learning Python should be part of  every network engineer’s plan. You can download the code from this link https://community.arubanetworks.com/aruba/attachments/aruba/Mobile-Engagement/736/1/get_beacons_below_limit%20shared.py.zip

Leave a Reply