Commit a688e38f authored by Gary Wong's avatar Gary Wong

Periodically trim time series data from monitoring database.

parent 02d2b896
...@@ -272,6 +272,31 @@ while (1) { ...@@ -272,6 +272,31 @@ while (1) {
my $ts = time() . "000000"; my $ts = time() . "000000";
my $expire = ( time() - 24 * 60 * 60 ) . "000000"; my $expire = ( time() - 24 * 60 * 60 ) . "000000";
# Trim old timeseries data.
foreach my $table (
"ops_interface_rx_bps",
"ops_interface_rx_dps",
"ops_interface_rx_eps",
"ops_interface_rx_pps",
"ops_interface_tx_bps",
"ops_interface_tx_dps",
"ops_interface_tx_eps",
"ops_interfacevlan_rx_bps",
"ops_interfacevlan_rx_dps",
"ops_interfacevlan_rx_eps",
"ops_interfacevlan_rx_pps",
"ops_interfacevlan_tx_bps",
"ops_interfacevlan_tx_dps",
"ops_interfacevlan_tx_eps",
"ops_interfacevlan_tx_pps",
"ops_node_cpu_util",
"ops_node_disk_part_max_used",
"ops_node_mem_used_kb",
"ops_node_num_vms_allocated",
"ops_node_swap_free" ) {
emdbi::DBQueryWarnN( $db, "DELETE FROM $table WHERE ts < $expire" );
}
# Add the local CM. # Add the local CM.
# FIXME would be nice to add routable_ip_poolsize # FIXME would be nice to add routable_ip_poolsize
emdbi::DBQueryWarnN( $db, "LOCK TABLES ops_aggregate WRITE" ); emdbi::DBQueryWarnN( $db, "LOCK TABLES ops_aggregate WRITE" );
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment