diff --git a/server/lib/classes/cron.d/100-monitor_kernel_version.inc.php b/server/lib/classes/cron.d/100-monitor_kernel_version.inc.php new file mode 100644 index 0000000000000000000000000000000000000000..6ead20bdd8064b2bad4db4434c42ff7f7c28e5f3 --- /dev/null +++ b/server/lib/classes/cron.d/100-monitor_kernel_version.inc.php @@ -0,0 +1,107 @@ +load('monitor_tools'); + $this->_tools = new monitor_tools(); + /* end global section for monitor cronjobs */ + + /* the id of the server as int */ + $server_id = intval($conf['server_id']); + + /** The type of the data */ + + $type = 'kernel_info'; + + /* + Fetch the data into a array + */ + $kernel = shell_exec("uname -mrs"); + + $data['name'] = ''; + $data['version'] = $kernel; + + /* the OS has no state. It is, what it is */ + $state = 'no_state'; + + $res = array(); + $res['server_id'] = $server_id; + $res['type'] = $type; + $res['data'] = $data; + $res['state'] = $state; + + /* + * Insert the data into the database + */ + $sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' . + 'VALUES (?, ?, UNIX_TIMESTAMP(), ?, ?)'; + $app->dbmaster->query($sql, $res['server_id'], $res['type'], serialize($res['data']), $res['state']); + + /* The new data is written, now we can delete the old one */ + $this->_tools->delOldRecords($res['type'], $res['server_id']); + + parent::onRunJob(); + } + + /* this function is optional if it contains no custom code */ + public function onAfterRun() { + global $app; + + parent::onAfterRun(); + } + +} + +?>