0

Query data in AirControl2 database

by Jim Bouse 17. April 2016 12:37

In Beta 19 release of AirControl2, Ubiquiti migraded to posgres database for storage.  Much of it is stored in JSON format inside a table row but it is queryable.

To begin you'll need to get to the postgres prompt:

/opt/Ubiquiti/AirControl2/pgsql/bin/psql -U ubnt -d ac2

Then, you can query things out of the nodes table with this:

select nodeid, data->'element'->>'status' as status, data->'element'->>'ip' as ip, data->'element'->>'hostname' as hostname, data->'element'->>'mac' as mac from ac2.nodes where data #>> '{element, status}' = '2' order by data->'element'->>'ip';

Reference:
http://community.ubnt.com/t5/airControl-2-Beta/AC2-Beta-19-Database-Cleanup-Pruning/m-p/1499315/highlight/true#M10692
http://community.ubnt.com/t5/airControl-2-Beta/Export-AC-data/m-p/1533354#U1533354 

Tags:

Powered by BlogEngine.NET 2.5.0.6
Original Design by Laptop Geek, Adapted by onesoft