Clear mysql database

Afternoon
select last_poll from vm_monitoring; Contains 547359 rows in set (3,198 sec)
Can you tell me how to properly clear this table, I mean vm_monitoring? There are 800 machines on the server, they are clogging the data, which causes the error QEMU Guest Agent monitoring disabled.
image

1 Like

Hi, thanks a lot for the report. The multiple vm_qemu_ping entries per VM is a bug. Most of the clogging occurs due to this bug, making each monitoring entry database row being bigger than it should.

To fix it

  • update the file /var/lib/one/remotes/im/lib/kvm.rb according to the following diff
iff --git a/src/im_mad/remotes/lib/kvm.rb b/src/im_mad/remotes/lib/kvm.rb
index 919369ffad..4831d7b587 100644
--- a/src/im_mad/remotes/lib/kvm.rb
+++ b/src/im_mad/remotes/lib/kvm.rb
@@ -51,7 +51,7 @@ module KVM
     QEMU_GA = {
         :enabled => false,
         :commands => {
-            :vm_qemu_ping => "one-$vm_id \'{\"execute\":\"guest-ping\"}\'"
+            :vm_qemu_ping => "one-$vm_id \'{\"execute\":\"guest-ping\"}\' --timeout 5"
         }
     }

@@ -84,6 +84,10 @@ module KVM

         ga_conf_path = "#{__dir__}/../../etc/im/kvm-probes.d/guestagent.conf"
         QEMU_GA.merge!(YAML.load_file(ga_conf_path))
+
+        QEMU_GA[:commands].each_key do |ga_info|
+            Domain::MONITOR_KEYS << ga_info
+        end
     rescue StandardError
     end

@@ -258,14 +262,6 @@ class Domain < BaseDomain
         ''
     end

-    def to_monitor
-        KVM::QEMU_GA[:commands].each_key do |ga_info|
-            MONITOR_KEYS << ga_info
-        end
-
-        super
-    end
-
     private

     # --------------------------------------------------------------------------
  • then issue a onehost sync command to update the monitoring on the hypervisor nodes

After this, you should start getting single vm_qemu_ping monitoring entries.

Now to clear the broken past monitoring entries you can

Now all of the previous monitoring entries for each vm in the vm_monitoring table should be deleted. You can set the expiration time to whatever you desire if the default value is too big.

2 Likes