summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2020-07-07 16:39:42 +0200
committerSimon Rettberg2020-07-07 16:39:42 +0200
commit1b7fe0bb7f4f5ad2b2d3bdeb4ade3a682d9cb7ea (patch)
tree16634f3c7f54d7c3cff9367642c94889e11ad7de
parent[statistics] Fix system model list width in summary mode (diff)
downloadslx-admin-1b7fe0bb7f4f5ad2b2d3bdeb4ade3a682d9cb7ea.tar.gz
slx-admin-1b7fe0bb7f4f5ad2b2d3bdeb4ade3a682d9cb7ea.tar.xz
slx-admin-1b7fe0bb7f4f5ad2b2d3bdeb4ade3a682d9cb7ea.zip
[statistics] Keep track of client runmode
-rw-r--r--modules-available/statistics/api.inc.php8
-rw-r--r--modules-available/statistics/install.inc.php10
2 files changed, 18 insertions, 0 deletions
diff --git a/modules-available/statistics/api.inc.php b/modules-available/statistics/api.inc.php
index 2b878680..f7c0ac32 100644
--- a/modules-available/statistics/api.inc.php
+++ b/modules-available/statistics/api.inc.php
@@ -98,6 +98,10 @@ if ($type{0} === '~') {
$new['hostname'] = $hostname;
$moresql .= ' hostname = :hostname,';
}
+ if (($runmode = Request::post('runmode', false, 'string')) !== false) {
+ $new['currentrunmode'] = $runmode;
+ $moresql .= ' currentrunmode = :currentrunmode,';
+ }
$new['oldstate'] = $old['state'];
$new['oldlastseen'] = $old['lastseen'];
$res = Database::exec('UPDATE machine SET '
@@ -203,6 +207,10 @@ if ($type{0} === '~') {
$params['_' . $item] = $liveVal;
}
}
+ if (($runmode = Request::post('runmode', false, 'string')) !== false) {
+ $params['currentrunmode'] = $runmode;
+ $strUpdateBoottime .= ' currentrunmode = :currentrunmode, ';
+ }
// Figure out what's happening - state changes
if ($used === 0 && $old['state'] !== 'IDLE') {
if ($old['state'] === 'OCCUPIED' && $sessionLength === 0) {
diff --git a/modules-available/statistics/install.inc.php b/modules-available/statistics/install.inc.php
index fed9b318..e8788224 100644
--- a/modules-available/statistics/install.inc.php
+++ b/modules-available/statistics/install.inc.php
@@ -287,5 +287,15 @@ if (!tableHasColumn('machine', 'live_cpuload')) {
$res[] = UPDATE_DONE;
}
+// 2020-06-29: Track current runmode (as reported by client)
+if (!tableHasColumn('machine', 'currentrunmode')) {
+ $ret = Database::exec("ALTER TABLE `machine`
+ ADD COLUMN `currentrunmode` varchar(30) NOT NULL DEFAULT '' AFTER `hostname`");
+ if ($ret === false) {
+ finalResponse(UPDATE_FAILED, 'Adding live_cpuload column to machine table failed: ' . Database::lastError());
+ }
+ $res[] = UPDATE_DONE;
+}
+
// Create response
responseFromArray($res);