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

@@ -1675,6 +1675,14 @@ For setting the console options to show on context menus. Web will show only inb
Virtual Manager Remote Viewer will only show the Remote Viewer option. Both will show both Web and Remote Viewer.
:end
:vms_usage_help:
Show metrics for CPU both guest and host percentage, memory, disk io and network io.
:end
:vms_usage_timer_help:
Setting in seconds for metrics refresh time.
:end
:vms_acs_override_help:
*PCIe ACS override* allows various hardware components to expose themselves as isolated devices.
Typically it is sufficient to isolate *Downstream* ports.

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);
}
?>