| | |
| | | $distver = 'Squeeze/Sid'; |
| | | $distid = 'debian60'; |
| | | $distbaseid = 'debian'; |
| | | } elseif (strstr(trim(file_get_contents('/etc/debian_version')), '7.0') || trim(file_get_contents('/etc/debian_version')) == 'wheezy/sid') { |
| | | } elseif (strstr(trim(file_get_contents('/etc/debian_version')), '7.0') || strstr(trim(file_get_contents('/etc/debian_version')), '7.1') || trim(file_get_contents('/etc/debian_version')) == 'wheezy/sid') { |
| | | $distname = 'Debian'; |
| | | $distver = 'Wheezy/Sid'; |
| | | $distid = 'debian70'; |
| | | $distid = 'debian60'; |
| | | $distbaseid = 'debian'; |
| | | } else { |
| | | $distname = 'Debian'; |
| | |
| | | $state = 'ok'; |
| | | |
| | | //* Fetch the data for all users |
| | | $dfData = shell_exec('repquota -au'); |
| | | $dfData = shell_exec('repquota -au 2>/dev/null'); |
| | | |
| | | //* Split into array |
| | | $df = explode("\n", $dfData); |
| | |
| | | } |
| | | |
| | | //** Fetch the data for all users |
| | | $dfData = shell_exec('repquota -ag'); |
| | | $dfData = shell_exec('repquota -ag 2>/dev/null'); |
| | | |
| | | //* split into array |
| | | $df = explode("\n", $dfData); |
| | |
| | | } |
| | | |
| | | public function monitorDiskUsage() { |
| | | global $conf; |
| | | global $app,$conf; |
| | | |
| | | /* the id of the server as int */ |
| | | $server_id = intval($conf['server_id']); |
| | |
| | | $state = 'ok'; |
| | | |
| | | /** Fetch the data of ALL devices into a array (needed for monitoring!) */ |
| | | $dfData = shell_exec('df -hT'); |
| | | //$dfData = shell_exec('df -hT 2>/dev/null'); |
| | | $app->uses('getconf'); |
| | | $web_config = $app->getconf->get_server_config($conf['server_id'], 'web'); |
| | | $dfData = shell_exec('df -hT|grep -v "'.$web_config['website_basedir'].'/" 2>/dev/null'); |
| | | |
| | | // split into array |
| | | $df = explode("\n", $dfData); |
| | |
| | | $data['mysqlserver'] = 0; |
| | | $state = 'error'; // because service is down |
| | | } |
| | | |
| | | if ($this->_checkTcp('localhost', 27017)) { |
| | | $data['mongodbserver'] = 1; |
| | | } else { |
| | | $data['mongodbserver'] = 0; |
| | | $state = 'error'; // because service is down |
| | | } |
| | | } |
| | | |
| | | /* |
| | |
| | | /* |
| | | * Fetch the output |
| | | */ |
| | | $data['output'] = shell_exec('apt-get -s -q dist-upgrade'); |
| | | $data['output'] = $aptData; |
| | | } elseif (file_exists('/etc/gentoo-release')) { |
| | | |
| | | /* |
| | |
| | | return $res; |
| | | } |
| | | |
| | | public function monitorMongoDB() { |
| | | global $conf; |
| | | |
| | | /* the id of the server as int */ |
| | | $server_id = intval($conf['server_id']); |
| | | |
| | | /** The type of the data */ |
| | | $type = 'log_mongodb'; |
| | | |
| | | /* This monitoring is only available if MongoDB is installed */ |
| | | system('which mongod', $retval); // Debian, Ubuntu, Fedora |
| | | if ($retval !== 0) |
| | | system('which mongod', $retval); // CentOS |
| | | if ($retval === 0) { |
| | | /* Get the data of the log */ |
| | | $data = $this->_getLogData($type); |
| | | |
| | | /* |
| | | * At this moment, there is no state (maybe later) |
| | | */ |
| | | $state = 'no_state'; |
| | | } else { |
| | | /* |
| | | * MongoDB is not installed, so there is no data and no state |
| | | * |
| | | * no_state, NOT unknown, because "unknown" is shown as state |
| | | * inside the GUI. no_state is hidden. |
| | | * |
| | | * We have to write NO DATA inside the DB, because the GUI |
| | | * could not know, if there is any dat, or not... |
| | | */ |
| | | $state = 'no_state'; |
| | | $data = ''; |
| | | } |
| | | |
| | | /* |
| | | * Return the Result |
| | | */ |
| | | $res['server_id'] = $server_id; |
| | | $res['type'] = $type; |
| | | $res['data'] = $data; |
| | | $res['state'] = $state; |
| | | return $res; |
| | | } |
| | | |
| | | public function monitorIPTables() { |
| | | global $conf; |
| | | |
| | |
| | | system('which iptables', $retval); // Debian, Ubuntu, Fedora |
| | | if ($retval === 0) { |
| | | /* Get the data of the log */ |
| | | $data['output'] = '<h2>iptables -S (ipv4)</h2>'.shell_exec('iptables -S'); |
| | | $data['output'] = '<h2>iptables -S (ipv4)</h2>'.shell_exec('iptables -S 2>/dev/null'); |
| | | |
| | | /* |
| | | * At this moment, there is no state (maybe later) |
| | |
| | | system('which ip6tables', $retval); // Debian, Ubuntu, Fedora |
| | | if ($retval === 0) { |
| | | /* Get the data of the log */ |
| | | $data['output'] .= '<br><h2>ip6tables -S (ipv6)</h2>'.shell_exec('ip6tables -S'); |
| | | $data['output'] .= '<br><h2>ip6tables -S (ipv6)</h2>'.shell_exec('ip6tables -S 2>/dev/null'); |
| | | |
| | | /* |
| | | * At this moment, there is no state (maybe later) |
| | |
| | | $logfile = '/var/log/fail2ban.log'; |
| | | } |
| | | break; |
| | | case 'log_mongodb': |
| | | $logfile = '/var/log/mongodb/mongodb.log'; |
| | | break; |
| | | case 'log_ispconfig': |
| | | if ($dist == 'debian') { |
| | | $logfile = $conf['ispconfig_log_dir'] . '/ispconfig.log'; |
| | |
| | | |
| | | } |
| | | |
| | | ?> |
| | | ?> |