From 6dba5833801b1ac4af3e07fa5e3866cb3621f6be Mon Sep 17 00:00:00 2001 From: George Butskivsky Date: Mon, 2 Jun 2025 11:30:38 +0300 Subject: [PATCH] bugfix --- svs-proxmox-watchdog.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/svs-proxmox-watchdog.py b/svs-proxmox-watchdog.py index 36f882c..f007177 100644 --- a/svs-proxmox-watchdog.py +++ b/svs-proxmox-watchdog.py @@ -4,6 +4,8 @@ import subprocess as sp import json import time, re +qmbin = "/usr/sbin/qm" + # Read DB from file def read_json_from_file(filepath): with open(filepath, 'r') as file: @@ -17,7 +19,7 @@ def ping(ip): def vmstat(id): vm_status = "dnd" - status,result = sp.getstatusoutput("qm status 114") + status,result = sp.getstatusoutput(qmbin + " status " + str(id)) match = re.search(r"status: (.+)", result) if match: vm_status = match.group(1) @@ -42,10 +44,10 @@ for vm in vms: else: vm['down'] = down + 1 if vmstat(vm['id']) == 'runnnig' and vm['down'] >= shutdown_timeout: - status,result = sp.getstatusoutput("qm stop " + str(vm['id']) + " --overrule-shutdown 1") + status,result = sp.getstatusoutput(qmbin + " stop " + str(vm['id']) + " --overrule-shutdown 1") else: if vmstat(vm['id']) == 'stopped' and vm['down'] >= shutdown_timeout: - status,result = sp.getstatusoutput("qm start " + str(vm['id'])) + status,result = sp.getstatusoutput(qmbin + " start " + str(vm['id'])) vm['down'] = 0 # Update the status