info_i_25x25.png See important information about Ubiquiti Devices and KRACK Vulnerability in this article. We will update this document as more information becomes available.

airControl - How to Clean Database

Overview


This article explains how to clean statistics, events, alerts, tasks, and compact the database using the cleanDB tool. This is an easy way to free space on the airControl server. Note: The cleanDB tool is available since v2.0 Final.

Table of Contents


Step 1 -Back Up the Database

Step 2 - Run the cleanDB in Windowed Environment

Step 3 - Run the cleanDB Tool using command line (CLI)

Related Articles


Step 1 - Back Up the Database


Back to Top

It is always a good idea to back up the database before performing maintenance. This can be done using the database backup tool located in the Control Panel under Database Backup or using the Manual Backup Guide. See below the Backup Using Desktop Client method, and the Backup Using Web Client one.

Backup Using Desktop Client

Database backup tool located in the Control Panel under Database Backup:

Backup Using Web Client

Database backup tools located in the Database Backup page under Settings:


Step 2 - Run the cleanDB in Windowed Environment


Back to Top

For servers running on Microsoft Windows and Linux with windowed environment you can use GUI tool. Start clean_db.bat or clean_db.sh accordingly.


Step 3 - Run the cleanDB Tool using command line (CLI)


Back to Top

3.1 Access airControl Server CLI 

ssh <user>@<airControlServerIP>

3.2 Run the cleanDB Tool

The cleanDB tool must be run as a privileged user. There is the option to delete Alerts, Events, Statistics, and Tasks.

3.2.1 Overview: cleanDB Options

sudo /opt/Ubiquiti/AirControl2/cleanDB ?
-a,--alerts

removes all alerts data

-c,--console runs cleanDB in command line mode
-e,--events <arg>

removes events data that is older than specified days

-h,--help displays this help
-s,--stats <arg>

removes statistics data that is older than specified days

-t,--tasks <arg> removes tasks data that is older than specified days
-v,--vacuum compacts database

Note: In place of <arg> use the number of days of data you would like to retain. In the examples below 60 days worth of data are retained.

3.2.2. Example: Delete Alerts

admin@acserver:~$ sudo /opt/Ubiquiti/AirControl2/cleanDB -alerts 60
airControl Database Cleanup Tool v1.0
Stopping server...Done
Deleting data...
Starting server...Done
Database cleanup finished successfully.
Records removed:
statistics: 0
events: 0
tasks: 0
alerts: 342

3.2.3. Example: Delete Events

admin@acserver:~$ sudo /opt/Ubiquiti/AirControl2/cleanDB -events 60
airControl Database Cleanup Tool v1.0
Stopping server...Done
Deleting data...
Starting server...Done
Database cleanup finished successfully.
Records removed:
statistics: 0
events: 682
tasks: 0
alerts: 0

3.2.4. Example: Delete Statistics

admin@acserver:~$ sudo /opt/Ubiquiti/AirControl2/cleanDB -stats 5
airControl Database Cleanup Tool v1.0
Stopping server...Done
Deleting data...
Starting server...Done
Database cleanup finished successfully.
Records removed:
statistics: 12,153
events: 0
tasks: 0
alerts: 0

3.2.5. Example: Delete Tasks

admin@acserver:~$ sudo /opt/Ubiquiti/AirControl2/cleanDB -tasks 60
airControl Database Cleanup Tool v1.0
Stopping server...Done
Deleting data...
Starting server...Done
Database cleanup finished successfully.
Records removed:
statistics: 0
events: 0
tasks: 59
alerts: 0

3.2.6. Example: Combined Command

This will remove all Alerts, Events, Statistics, and Tasks except for those within the last 60 days.

admin@acserver:~$ sudo /opt/Ubiquiti/AirControl2/cleanDB -a 60 -e 60 -s 60 -t 60
airControl Database Cleanup Tool v1.0
Stopping server...Done
Deleting data...
Starting server...Done
Database cleanup finished successfully.
Records removed:
statistics: 12,153
events: 682
tasks: 59
alerts: 342

3.3 Vacuum Database

After deleting the desired data using the above commands, use the vacuum command to compact the database and reclaim previously used storage.

admin@acserver:~$ sudo /opt/Ubiquiti/AirControl2/cleanDB -v

Related Articles


Back to Top