Monitoring, Management & Location Tracking

Use wget/curl to query HTTPS on AMP v7.3 and above

Starting in AirWave v7.3, the GUI user authentication changed from "basic authentication" to cookie-based authentication.  This complicates retrieving information from the AMP using simple CLI commands such as wget/curl.  This KB documents how to query page information in a two step process.  The first step logs into the AMP using and saves the authentication cookie to a file.  The second step uses this authentication cookie to make an arbitrary HTTPS query.

Credit to Edmund Rhudy for the contents of this KB 

The first command is:

wget -q --keep-session-cookies --save-cookies cookies.txt --post-data 'credential_0=testusername&credential_1=testpassword&destination=/&login=Log In' --no-check-certificatehttps://127.0.0.1/LOGIN -O - > /dev/null

This command logs in to the AirWave server on localhost (all these commands assume you're running them on the AMP itself, adjust as necessary if you're not) and saves the login cookie to disk, then exits.

The next command is:

wget -k -r --no-check-certificate --load-cookies cookies.txt 'https://127.0.0.1/nf/report_detail?id=1845&format=xml'

In this example for retrieving all HTML elements for report ID 1845, the command uses the login cookie that was just generated to reach the report URL.  -r tells wget to retrieve recursively (by default up to 5 levels, which can be adjusted with -l) and get the images and CSS on the page; -k causes wget to rewrite the paths of the links in the downloaded HTML to be relative links that work correctly for local storage.

wget will create a directory called 127.0.0.1 in the current directory and creates subdirectories as necessary underneath there.  The report itself goes into 127.0.0.1/nf/report_detail?id=whatever&format=xml.

For other queries such as API queries, adjust the URL in the wget command.

 

Version history
Revision #:
2 of 2
Last update:
‎07-02-2014 03:58 PM
Updated by:
 
Labels (1)
Contributors
Search Airheads
Showing results for 
Search instead for 
Did you mean: 
Is this a frequent problem?

Request an official Aruba knowledge base article to be written by our experts.