db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'server_load' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc"); if(isset($record['data'])) { $data = unserialize($record['data']); /* Format the data */ if (strlen($data['up_minutes']) == "1") $data['up_minutes'] = "0".$data['up_minutes']; $html = '
' . '
' . $app->lng("Server online since").': ' . $data['up_days'] . ' days, ' . $data['up_hours'] . ':' . $data['up_minutes'] . ' hours
' . $app->lng("Users online").': ' . $data['user_online'] . '
' . $app->lng("System load 1 minute") . ': ' . $data['load_1'] . '
' . $app->lng("System load 5 minutes") . ': ' . $data['load_5'] . '
'.$app->lng("System load 15 minutes").': ' . $data['load_15'] . '
'; } else { $html = '

'.$app->lng("no_data_serverload_txt").'

'; } return $html; } function showDiskUsage () { global $app; /* fetch the Data from the DB */ $record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'disk_usage' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc"); if(isset($record['data'])) { $data = unserialize($record['data']); /* Format the data */ $html = '
'; foreach($data as $line) { $html .= ''; foreach ($line as $item) { $html .= ''; } $html .= ''; } $html .= '
'.$app->lng("monitor_diskusage_filesystem_txt").' '.$app->lng("monitor_diskusage_type_txt").' '.$app->lng("monitor_diskusage_size_txt").' '.$app->lng("monitor_diskusage_used_txt").' '.$app->lng("monitor_diskusage_available_txt").' '.$app->lng("monitor_diskusage_usage_txt").' '.$app->lng("monitor_diskusage_mounted_txt").'
' . $item . '
'; $html .= '
'; } else { $html = '

'.$app->lng("no_data_diskusage_txt").'

'; } return $html; } function showMemUsage () { global $app; /* fetch the Data from the DB */ $record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'mem_usage' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc"); if(isset($record['data'])) { $data = unserialize($record['data']); /* Format the data */ $html = '
'; foreach($data as $key => $value) { if ($key != '') { $html .= ''; } } $html .= '
' . $key . ': ' . $value . '
'; $html .= '
'; } else { $html = '

'.$app->lng("no_data_memusage_txt").'

'; } return $html; } function showCpuInfo () { global $app; /* fetch the Data from the DB */ $record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'cpu_info' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc"); if(isset($record['data'])) { $data = unserialize($record['data']); /* Format the data */ $html = '
'; foreach($data as $key => $value) { if ($key != '') { $html .= ''; } } $html .= '
' . $key . ': ' . $value . '
'; $html .= '
'; } else { $html = '

'.$app->lng("no_data_cpuinfo_txt").'

'; } return $html; } function showServices () { global $app; /* fetch the Data from the DB */ $record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'services' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc"); if(isset($record['data'])) { $data = unserialize($record['data']); /* Format the data */ $html = '
'; if($data['webserver'] != -1) { if($data['webserver'] == 1) { $status = ''.$app->lng("monitor_services_online_txt").''; } else { $status = ''.$app->lng("monitor_services_offline_txt").''; } $html .= ''; } if($data['ftpserver'] != -1) { if($data['ftpserver'] == 1) { $status = ''.$app->lng("monitor_services_online_txt").''; } else { $status = ''.$app->lng("monitor_services_offline_txt").''; } $html .= ''; } if($data['smtpserver'] != -1) { if($data['smtpserver'] == 1) { $status = ''.$app->lng("monitor_services_online_txt").''; } else { $status = ''.$app->lng("monitor_services_offline_txt").''; } $html .= ''; } if($data['pop3server'] != -1) { if($data['pop3server'] == 1) { $status = ''.$app->lng("monitor_services_online_txt").''; } else { $status = ''.$app->lng("monitor_services_offline_txt").''; } $html .= ''; } if($data['imapserver'] != -1) { if($data['imapserver'] == 1) { $status = ''.$app->lng("monitor_services_online_txt").''; } else { $status = ''.$app->lng("monitor_services_offline_txt").''; } $html .= ''; } if($data['bindserver'] != -1) { if($data['bindserver'] == 1) { $status = ''.$app->lng("monitor_services_online_txt").''; } else { $status = ''.$app->lng("monitor_services_offline_txt").''; } $html .= ''; } if($data['mysqlserver'] != -1) { if($data['mysqlserver'] == 1) { $status = ''.$app->lng("monitor_services_online_txt").''; } else { $status = ''.$app->lng("monitor_services_offline_txt").''; } $html .= ''; } $html .= '
'.$app->lng("monitor_services_web_txt").' '.$status.'
'.$app->lng("monitor_services_ftp_txt").' '.$status.'
'.$app->lng("monitor_services_smtp_txt").' '.$status.'
'.$app->lng("monitor_services_pop_txt").' '.$status.'
'.$app->lng("monitor_services_imap_txt").' '.$status.'
'.$app->lng("monitor_services_mydns_txt").' '.$status.'
'.$app->lng("monitor_services_mysql_txt").' '.$status.'
'; } else { $html = '

'.$app->lng("no_data_services_txt").'

'; } return $html; } function showSystemUpdate() { global $app; /* fetch the Data from the DB */ $record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'system_update' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc"); if(isset($record['data'])) { $html = '
'; /* * First, we have to detect, if there is any monitoring-data. * If not (because the destribution is not supported) show this. */ if ($record['state'] == 'no_state') { $html .= '

'.$app->lng("monitor_updates_nosupport_txt").'

'; } else { $data = unserialize($record['data']); $html .= nl2br(html_entity_decode($data['output'])); } $html .= '
'; } else { $html = '

'.$app->lng("no_data_updates_txt").'

'; } return $html; } function showOpenVzBeancounter() { global $app; /* fetch the Data from the DB */ $record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'openvz_beancounter' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc"); if(isset($record['data'])) { $html = '
'; /* * First, we have to detect, if there is any monitoring-data. * If not (because the server is not a VE) show this. */ $data = unserialize($record['data']); if ((!isset($data)) || ($data == '')) { $html .= '

'.$app->lng("monitor_beancounter_nosupport_txt").'

'; } else { $html .= '
' . nl2br($data) . '
'; } $html .= '
'; } else { $html = '

'.$app->lng("no_data_updates_txt").'

'; } return $html; } function showRaidState() { global $app; /* fetch the Data from the DB */ $record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'raid_state' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc"); if(isset($record['data'])) { $html = '
'; /* * First, we have to detect, if there is any monitoring-data. * If not (because the RAID-Controler is not supported yet) show this. */ if ($record['state'] == 'no_state') { $html .= '

'.$app->lng("monitor_nosupportedraid1_txt").'

'; } else { $data = unserialize($record['data']); $html .= nl2br($data['output']); } $html .= '
'; } else { $html = '

'.$app->lng("no_data_raid_txt").'

'; } return $html; } function showRKHunter() { global $app; /* fetch the Data from the DB */ $record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'rkhunter' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc"); if(isset($record['data'])) { $html = '
'; /* * First, we have to detect, if there is any monitoring-data. * If not (because rkhunter is not installed) show this. */ $data = unserialize($record['data']); if ($data['output'] == '') { $html .= '

'.$app->lng("monitor_norkhunter_txt").'

'; } else { $html .= nl2br($data['output']); } $html .= '
'; } else { $html = '

'.$app->lng("no_data_rkhunter_txt").'

'; } return $html; } function showFail2ban() { global $app; /* fetch the Data from the DB */ $record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'log_fail2ban' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc"); if(isset($record['data'])) { $html = '
'; /* * First, we have to detect, if there is any monitoring-data. * If not (because fail2ban is not installed) show this. */ $data = unserialize($record['data']); if ($data == '') { $html .= '

'. 'fail2ban is not installed at this server.
' . 'See more (for debian) here...'. '

'; } else { $html .= nl2br($data); } $html .= '
'; } else { $html = '

There is no data available at the moment.

'; } return $html; } function showIPTables() { global $app; $record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'iptables_rules' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc"); if(isset($record['data'])) { $html = '
'; $data = unserialize($record['data']); if ($data == '') { $html .= '

Problem, there are no rules listed for the server

'; } else { $html .= nl2br($data['output']); } $html .= '
'; } else { $html = '

There is no data available at the moment.

'; } return $html; } function showMailq() { global $app; /* fetch the Data from the DB */ $record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'mailq' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc"); if(isset($record['data'])) { $data = unserialize($record['data']); $html = nl2br($data['output']); } else { $html = '

'.$app->lng("no_data_mailq_txt").'

'; } return $html; } function getDataTime($type) { global $app; /* fetch the Data from the DB */ $record = $app->db->queryOneRecord("SELECT created FROM monitor_data WHERE type = '" . $type . "' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc"); /* TODO: datetimeformat should be set somewhat other way */ $dateTimeFormat = $app->lng("monitor_settings_datetimeformat_txt"); if(isset($record['created'])) { // $res = date('Y-m-d H:i', $record['created']); $res = date($dateTimeFormat, $record['created']); } else { $res = '????-??-?? ??:??'; } return $res; } } ?>