From 71accc61eb6474935434e2973e360a63dec8112e Mon Sep 17 00:00:00 2001 From: tbrehm <t.brehm@ispconfig.org> Date: Thu, 05 Sep 2013 09:51:06 -0400 Subject: [PATCH] - Added DB size report in monitor. Thanks to Florian for the patch! --- interface/lib/classes/tools_monitor.inc.php | 38 ++++++++++++++++++++++++++++++++++++++ 1 files changed, 38 insertions(+), 0 deletions(-) diff --git a/interface/lib/classes/tools_monitor.inc.php b/interface/lib/classes/tools_monitor.inc.php index 42defa0..cb389c8 100644 --- a/interface/lib/classes/tools_monitor.inc.php +++ b/interface/lib/classes/tools_monitor.inc.php @@ -118,6 +118,44 @@ return $html; } + function showDatabaseSize () { + global $app; + /* fetch the Data from the DB */ + $record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'database_size' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc"); + if(isset($record['data'])) { + $data = unserialize($record['data']); + /* + Format the data + */ + $html = + '<div class="systemmonitor-state state-'.$record['state'].'"> + <div class="systemmonitor-content icons32 ico-'.$record['state'].'"> + <table> + <thead> + <tr> + <td>'.$app->lng("monitor_database_name_txt").'</td> + <td>'.$app->lng("monitor_database_size_txt").'</td> + <td>'.$app->lng("monitor_database_client_txt").'</td> + </tr>'; + foreach($data as $line) { + $html .= '<tr>'; + if ($line['size'] > 0) $line['size'] = $app->functions->formatBytes($line['size']); + $t=$app->db->queryOneRecord("SELECT username FROM client WHERE sys_groupid = ".$line['client_id']); + $line['client_id']=$t['username']; + unset($t); + foreach ($line as $item) { + $html .= '<td>' . $item . '</td>'; + } + $html .= '</tr></tmpl loop>'; + } + $html .= '</tbody></table>'; + $html .= '</div></div>'; + } else { + $html = '<p>'.$app->lng("no_data_database_size_txt").'</p>'; + } + return $html; + } + function showMemUsage () { global $app; -- Gitblit v1.9.1