Member

public function monitorSystemUpdate() {
global $conf;
/* the id of the server as int */
$server_id = intval($conf['server_id']);
/** The type of the data */
$type = 'system_update';
/* This monitoring is only available on Debian or Ubuntu */
if (file_exists('/etc/debian_version')) {
/*
* first update the "apt database"
*/
shell_exec('apt-get update');
/*
* Then test the upgrade.
* if there is any output, then there is a needed update
*/
$aptData = shell_exec('apt-get -s -qq dist-upgrade');
if ($aptData == '') {
/* There is nothing to update! */
$state = 'ok';
} else {
/*
* There is something to update! this is in most cases not critical, so we can
* do a system-update once a month or so...
*/
$state = 'info';
}
/*
* Fetch the output
*/
$data['output'] = shell_exec('apt-get -s -q dist-upgrade');
} elseif (file_exists('/etc/gentoo-release')) {
/*
* first update the portage tree
*/