diff options
author | Simon Rettberg | 2021-06-25 16:21:17 +0200 |
---|---|---|
committer | Simon Rettberg | 2021-06-25 16:21:17 +0200 |
commit | 32f0677dbca9e3347b931c1d0105eb37aa57e90d (patch) | |
tree | ddad4562e7ee8439a24e2462d44614692bb71d14 /modules-available/statistics/hooks | |
parent | Update .idea (diff) | |
download | slx-admin-32f0677dbca9e3347b931c1d0105eb37aa57e90d.tar.gz slx-admin-32f0677dbca9e3347b931c1d0105eb37aa57e90d.tar.xz slx-admin-32f0677dbca9e3347b931c1d0105eb37aa57e90d.zip |
[eventlog] Add event filtering and notification system
Diffstat (limited to 'modules-available/statistics/hooks')
-rw-r--r-- | modules-available/statistics/hooks/cron.inc.php | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/modules-available/statistics/hooks/cron.inc.php b/modules-available/statistics/hooks/cron.inc.php index aecc4e3b..7152b1da 100644 --- a/modules-available/statistics/hooks/cron.inc.php +++ b/modules-available/statistics/hooks/cron.inc.php @@ -27,17 +27,11 @@ function state_cleanup() $res = Database::simpleQuery("SELECT machineuuid, clientip, state, logintime, lastseen, live_memfree, live_swapfree, live_tmpfree FROM machine WHERE lastseen < If(state = 'STANDBY', $standby, $on) AND state <> 'OFFLINE'"); foreach ($res as $row) { - Database::exec('INSERT INTO clientlog (dateline, logtypeid, clientip, machineuuid, description, extra) - VALUES (UNIX_TIMESTAMP(), :type, :client, :uuid, :description, :longdesc)', array( - 'type' => 'machine-mismatch-cron', - 'client' => $row['clientip'], - 'description' => 'Client timed out, last known state is ' . $row['state'] - . '. Free RAM: ' . Util::readableFileSize($row['live_memfree'], -1, 2) - . ', free Swap: ' . Util::readableFileSize($row['live_swapfree'], -1, 2) - . ', free ID44: ' . Util::readableFileSize($row['live_tmpfree'], -1, 2), - 'longdesc' => '', - 'uuid' => $row['machineuuid'], - )); + ClientLog::write($row, 'machine-mismatch-cron', + 'Client timed out, last known state is ' . $row['state'] + . '. Free RAM: ' . Util::readableFileSize($row['live_memfree'], -1, 2) + . ', free Swap: ' . Util::readableFileSize($row['live_swapfree'], -1, 2) + . ', free ID44: ' . Util::readableFileSize($row['live_tmpfree'], -1, 2)); if ($row['state'] === 'OCCUPIED') { $length = $row['lastseen'] - $row['logintime']; if ($length > 0 && $length < 86400 * 7) { |