Add options to settings to disable/enable + refresh rate

This commit is contained in:
SimonFair
2024-02-12 22:04:37 +00:00
parent 034b41726e
commit 9f3047d2ff
4 changed files with 27 additions and 2 deletions

View File

@@ -183,6 +183,19 @@ _(Console Options)_:
:vms_console_help:
_(Show VM Usage)_:
: <select id="vmusage" name="USAGE">
<?=mk_option($domain_cfg['USAGE'], 'N', _('Disabled'))?>
<?=mk_option($domain_cfg['USAGE'], 'Y', _('Enabled'))?>
</select>
:vms_usage_help:
_(VM Usage refresh timer(seconds))_:
: <input type="number" id="vm_usage_timer" name="USAGETIMER" value="<?=htmlspecialchars($domain_cfg['USAGETIMER'] ?? 3) ?>" class="narrow">
:vms_usage_timer_help:
_(PCIe ACS override)_:
: <select id="pcie_acs_override"<?=$safemode?' disabled':''?>>
<?= mk_option($pcie_acs_override, '', _('Disabled'))?>

View File

@@ -1,7 +1,7 @@
Menu="VMs:0"
Title="VM Usage Statisics"
Cond="exec(\"grep -o '^SERVICE=.enable' /boot/config/domain.cfg 2>/dev/null\")"
Nchan="vm_usage:stop"
Cond="exec(\"grep -o '^USAGE=.Y' /boot/config/domain.cfg 2>/dev/null\") && is_file('/var/run/libvirt/libvirtd.pid')"
---
<?PHP
/* Copyright 2005-2024, Lime Technology

View File

@@ -52,6 +52,10 @@ function update_translation($locale) {
}
}
$domain_cfgfile = "/boot/config/domain.cfg";
$domain_cfg = parse_ini_file($domain_cfgfile);
if (!isset($domain_cfg['USAGETIMER'])) $timer = 3 ; else $timer = $domain_cfg['USAGETIMER'];
while (true) {
extract(parse_plugin_cfg('dynamix',true));
@@ -88,6 +92,6 @@ while (true) {
$time0 = $time1;
}
sleep(3);
sleep($timer);
}
?>