Skip to main content
All CollectionsIntegrations
Data Push Destination Example Downloading UXI Data from S3 with Amazon CLI / SDK
Data Push Destination Example Downloading UXI Data from S3 with Amazon CLI / SDK
Updated over 2 years ago

Once your UXI sensor test result or issue data is in S3, you can use the Amazon CLI or SDK/API to download the data for your own custom scripts.

Once setup, it's easy to get your UXI data from your S3 bucket.

For test result data, objects will be created every 5 minutes or every 25 000 records, whichever is first. The objects will be created in S3 with a prefix that indicates the UTC time the data was written to S3 in the following format:

<your bucket name>/Aruba-UXI/test_results.s3.<your dashboard uid>/year=<yyyy>/month=<mm>/day=<dd>/hour=h>

For issue data, objects will be created every 1 minute or every 25 000 records, whichever is first. The objects will be created in S3 with a prefix that indicates the UTC time the data was written to S3 in the following format:

<your bucket name>/Aruba-UXI/issues.s3.<your dashboard uid>/year=<yyyy>/month=<mm>/da

Amazon CLI

You can refer to the official Amazon documentation for getting started with the CLI for the platform of your choice and documentation for all the various commands.

Here is an example to download all test result objects matching a prefix to your Desktop.

$ aws s3 cp s3://<your bucket name>/Aruba-UXI/test_results.s3.<your dashboard uid>/year=2022/month=06/day=06/hour=19/ ~/Desktop/ --recursive

Amazon SDK

Amazon has a powerful SDK. Please refer to the official guides and documentation to get the SDK setup and started.

Once setup, you can use the SDK to get the test results or issues from your S3 buckets for your own analysis. Below is an example to get the latest objects over the last hour.

import boto3
import os
from datetime import datetime

my_bucket_name = '<your bucket name>'
my_prefix = 'Aruba-UXI/test_results.s3.<your dashboard uid>/'

year = str(datetime.utcnow().year)
month = str('%02d' % datetime.utcnow().month)
day = str('%02d' % datetime.utcnow().day)
hour = str('%02d' % datetime.utcnow().hour)

my_full_prefix = my_prefix+'year='+year+'/month='+month+'/day='+day+'/hour='+hour

s3=boto3.resource('s3')
my_bucket = s3.Bucket(my_bucket_name)

for obj in my_bucket.objects.filter(Prefix = my_full_prefix):
if not os.path.exists(os.path.dirname(obj.key)):
os.makedirs(os.path.dirname(obj.key))
print ('Creating diretcory ...')
print (' '+os.path.dirname(obj.key))
my_bucket.download_file(obj.key, obj.key)
print ('saving file...')
print (' '+obj.key)

Did this answer your question?