Monitoring, Management & Location Tracking

 View Only
last person joined: one year ago 

Articles relating to existing and legacy HPE Aruba Networking products and solutions including AirWave, Meridian Apps, ALE, Central / HPE Aruba Networking Central, and UXI / HPE Aruba Networking User Experience Insight

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

Jul 02, 2014 06:57 PM

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.

 

Statistics
0 Favorited
1 Views
0 Files
0 Shares
0 Downloads

Related Entries and Links

No Related Resource entered.