Closed neddyuk closed 3 years ago
The first and simplest option is to just leave the data untouched. All the visualizations on the UI are time based (defaults to 6 hours). As time passes by, the UI will start looking at the recent data and the older data will cease to display.
However, if you wish to keep the database clean, here are the options to clear the data within the database. Login to the UTM VM and open the Influx CLI (the time series database powering UTM).
# influx -precision rfc3339
By default, UTM uses telegraf database. Change the database via:
> use telegraf
Using database telegraf
You can delete the complete telegraf database. This is fine in a lab environment but not recommended in general. If you still wish to take this route, following is the command.
> drop database telegraf
>
This will delete the data within the telegraf database permanently. Be cautious!
The recommended approach is to delete data from individual measurements (table in InfluxDB). As of UTM v0.4, it created the following 6 measurements:
You can use show measurements command to see the available measurements.
> show measurements
name: measurements
name
----
BackplanePortStats
FIEnvStats
FIServerPortStats
FIUplinkPortStats
Servers
VnicStats
cpu
disk
diskio
kernel
mem
net
processes
swap
system
>
Use the delete command as shown below.
> delete from FIEnvStats where time < now() - 90d
This will delete data older than 90 days. You can use 5d, 6h, 10m, etc.
The other option is to use absolute dates, as shown below:
> delete from FIEnvStats where time < '2020-01-01'
You would have to execute the above command for all the 6 measurements. For example:
> delete from FIEnvStats where time < now() - 1d
> delete from BackplanePortStats where time < now() - 1d
> delete from FIServerPortStats where time < now() - 1d
> delete from FIUplinkPortStats where time < now() - 1d
> delete from Servers where time < now() - 1d
> delete from VnicStats where time < now() - 1d
Please be careful in using the < and >. Changing the symbol will delete all the recent data while keeping the older data. It may not matter in a lab environment but you can imagine the impact in production. Also, InfluxDB does not return anything when a command is successful. If you clean the data while UTM is running, it is possible that the measurements are created within a few seconds again as new data is written. Do not get confused if you notice this.
Finally, exist from Influx CLI via
> exit
#
There are many more options for data management in general, all described in detail in the InfluxDB documentation: https://docs.influxdata.com/influxdb/v1.8/. Hope this helps.
Note: By following these steps, you own the full responsibility of your data. I do not guarantee the accuracy of these steps. InfluxDB supports data backup and restore, if you wish to use the functionality.
Is there is an easy way to delete a couple of locations and UCS domains I added by mistake from the DB?
This worked perfectly as you described above, I used:
delete from FIEnvStats where time < now() - 7d delete from BackplanePortStats where time < now() - 7d delete from FIServerPortStats where time < now() - 7d delete from FIUplinkPortStats where time < now() - 7d delete from Servers where time < now() - 7d delete from VnicStats where time < now() - 7d
how do you flush all the old data out of the system?