From 914889da6c72ef4e3661db5dea45a0bf98336941 Mon Sep 17 00:00:00 2001 From: Franziska Kunsmann Date: Tue, 29 Dec 2020 10:14:26 +0100 Subject: [PATCH] bundles/vmhost: add option to exclude VM from monitoring --- bundles/vmhost/files/check_vm_status | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bundles/vmhost/files/check_vm_status b/bundles/vmhost/files/check_vm_status index d75d610..82d2227 100644 --- a/bundles/vmhost/files/check_vm_status +++ b/bundles/vmhost/files/check_vm_status @@ -4,7 +4,7 @@ from subprocess import check_output from sys import exit try: - result = check_output(['virsh', '--readonly', 'list', '--all']).decode('utf-8').split('\n') + result = check_output(['virsh', '--readonly', 'list', '--all']).decode('utf-8').splitlines() except Exception as e: # If something fails, this means libvirt is not responding. This is # an error. @@ -22,6 +22,9 @@ for vm in result[2:]: info = vm.split() + if info[1].startswith('EXCLUDE_FROM_MONITORING_'): + continue + if info[2] in {'crashed', 'dying'}: crashed.add('{}: {}'.format(info[1], info[2])) elif info[2] in {'running'}: