Skip to content

Commit 9cd0f6e

Browse files
author
vogelor
committed
some improvement of the monitor output
1 parent 36d3079 commit 9cd0f6e

File tree

4 files changed

+85
-30
lines changed

4 files changed

+85
-30
lines changed

interface/web/monitor/show_sys_state.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,17 +55,38 @@
5555
{
5656
$output = _getServerState($_SESSION['monitor']['server_id'], $_SESSION['monitor']['server_name'], true);
5757
$title = "Server State";
58+
$stateType = 'server';
5859
}
5960
else
6061
{
6162
$output = _getSysState();
6263
$title = "System State";
64+
$stateType = 'system';
6365
}
6466

6567
$app->tpl->setVar("state_data",$output);
68+
$app->tpl->setVar("state_type",$stateType);
6669
$app->tpl->setVar("title",$title);
6770
$app->tpl->setVar("description",$description);
6871

72+
/*
73+
Creating the array with the refresh intervals
74+
Attention: the core-moule ist triggered every 5 minutes,
75+
so reload every 2 minutes is impossible!
76+
*/
77+
$refresh = (isset($_GET["refresh"]))?intval($_GET["refresh"]):0;
78+
79+
$refresh_values = array('0' => '- '.$app->lng("No Refresh").' -','5' => '5 '.$app->lng("minutes"),'10' => '10 '.$app->lng("minutes"),'15' => '15 '.$app->lng("minutes"),'30' => '30 '.$app->lng("minutes"),'60' => '60 '.$app->lng("minutes"));
80+
$tmp = '';
81+
foreach($refresh_values as $key => $val) {
82+
if($key == $refresh) {
83+
$tmp .= "<option value='$key' SELECTED>$val</option>";
84+
} else {
85+
$tmp .= "<option value='$key'>$val</option>";
86+
}
87+
}
88+
$app->tpl->setVar("refresh",$tmp);
89+
6990
/*
7091
* doing the output
7192
*/

interface/web/monitor/templates/show_sys_state.htm

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ <h2><tmpl_var name="title"></h2>
22

33
<div class="panel">
44

5-
<!--div class="pnl_toolsarea">
5+
<div class="pnl_toolsarea">
66
<fieldset><legend>Tools</legend>
77
<div class="buttons">
8-
<select name="refreshinterval" id="refreshinterval" onChange="loadContentRefresh('monitor/show_log.php?log={tmpl_var name="log_id"}')">{tmpl_var name="refresh"}</select>
8+
<select name="refreshinterval" id="refreshinterval" onChange="loadContentRefresh('monitor/show_sys_state.php?state={tmpl_var name="state_type"}')">{tmpl_var name="refresh"}</select>
99
</div>
1010
</fieldset>
11-
</div-->
11+
</div>
1212

1313
<div class="pnl_formarea">
1414
<fieldset><!-- legend>Sys-State</legend -->

interface/web/monitor/tools.inc.php

Lines changed: 49 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ function showServerLoad(){
3939
Format the data
4040
*/
4141
$html =
42-
'<table id="system_load">
42+
'<div class="systemmonitor-state systemmonitor-state-' . $record['state'] . '">
43+
<div class="systemmonitor-state-' . $record['state'] . '-icon">
44+
<table>
4345
<tr>
4446
<td>' . $app->lng("Server online since").':</td>
4547
<td>' . $data['up_days'] . ' days, ' . $data['up_hours'] . ':' . $data['up_minutes'] . ' hours</center></td>
@@ -60,7 +62,9 @@ function showServerLoad(){
6062
<td>'.$app->lng("System load 15 minutes").':</td>
6163
<td>' . $data['load_15'] . '</td>
6264
</tr>
63-
</table>';
65+
</table>
66+
</div>
67+
</div>';
6468
} else {
6569
$html = '<p>'.$app->lng("no_data_serverload_txt").'</p>';
6670
}
@@ -80,7 +84,18 @@ function showDiskUsage () {
8084
/*
8185
Format the data
8286
*/
83-
$html = '<table id="system_disk">';
87+
$html =
88+
'<div class="systemmonitor-state systemmonitor-state-' . $record['state'] . '">
89+
<div class="systemmonitor-state-' . $record['state'] . '-icon">
90+
<table>
91+
<tr>
92+
<td>Filesystem</td>
93+
<td>1K-blocks</td>
94+
<td>Used</td>
95+
<td>Available</td>
96+
<td>Use%</td>
97+
<td>Mounted on</td>
98+
</tr>';
8499
foreach($data as $line) {
85100
$html .= '<tr>';
86101
foreach ($line as $item) {
@@ -89,6 +104,7 @@ function showDiskUsage () {
89104
$html .= '</tr>';
90105
}
91106
$html .= '</table>';
107+
$html .= '</div></div>';
92108
} else {
93109
$html = '<p>'.$app->lng("no_data_diskusage_txt").'</p>';
94110
}
@@ -111,7 +127,10 @@ function showMemUsage ()
111127
/*
112128
Format the data
113129
*/
114-
$html = '<table id="system_memusage">';
130+
$html =
131+
'<div class="systemmonitor-state systemmonitor-state-' . $record['state'] . '">
132+
<div class="systemmonitor-state-' . $record['state'] . '-icon">
133+
<table>';
115134

116135
foreach($data as $key => $value){
117136
if ($key != '') {
@@ -122,6 +141,8 @@ function showMemUsage ()
122141
}
123142
}
124143
$html .= '</table>';
144+
$html .= '</div></div>';
145+
125146
} else {
126147
$html = '<p>'.$app->lng("no_data_memusage_txt").'</p>';
127148
}
@@ -142,7 +163,10 @@ function showCpuInfo ()
142163
/*
143164
Format the data
144165
*/
145-
$html = '<table id="system_cpu">';
166+
$html =
167+
'<div class="systemmonitor-state systemmonitor-state-' . $record['state'] . '">
168+
<div class="systemmonitor-state-' . $record['state'] . '-icon">
169+
<table>';
146170
foreach($data as $key => $value){
147171
if ($key != '') {
148172
$html .= '<tr>
@@ -152,6 +176,7 @@ function showCpuInfo ()
152176
}
153177
}
154178
$html .= '</table>';
179+
$html .= '</div></div>';
155180
} else {
156181
$html = '<p>'.$app->lng("no_data_cpuinfo_txt").'</p>';
157182
}
@@ -172,7 +197,10 @@ function showServices ()
172197
/*
173198
Format the data
174199
*/
175-
$html = '<table id="system_services">';
200+
$html =
201+
'<div class="systemmonitor-state systemmonitor-state-' . $record['state'] . '">
202+
<div class="systemmonitor-state-' . $record['state'] . '-icon">
203+
<table>';
176204

177205
if($data['webserver'] != -1) {
178206
if($data['webserver'] == 1) {
@@ -260,7 +288,7 @@ function showServices ()
260288
}
261289

262290

263-
$html .= '</table></div>';
291+
$html .= '</table></div></div>';
264292
} else {
265293
$html = '<p>'.$app->lng("no_data_services_txt").'</p>';
266294
}
@@ -277,17 +305,21 @@ function showSystemUpdate()
277305
$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");
278306

279307
if(isset($record['data'])) {
308+
$html =
309+
'<div class="systemmonitor-state systemmonitor-state-' . $record['state'] . '">
310+
<div class="systemmonitor-state-' . $record['state'] . '-icon">';
280311
/*
281312
* First, we have to detect, if there is any monitoring-data.
282313
* If not (because the destribution is not supported) show this.
283314
*/
284315
if ($record['state'] == 'no_state'){
285-
$html = '<p>' . "Your distribution is not supported for this monitoring" . '</p>';
316+
$html .= "Your distribution is not supported for this monitoring";
286317
}
287318
else {
288319
$data = unserialize($record['data']);
289-
$html = nl2br($data['output']);
320+
$html .= nl2br($data['output']);
290321
}
322+
$html .= '</div></div>';
291323
} else {
292324
$html = '<p>' . "No Update-Data available" . '</p>';
293325
}
@@ -303,17 +335,23 @@ function showRaidState()
303335
$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");
304336

305337
if(isset($record['data'])) {
338+
$html =
339+
'<div class="systemmonitor-state systemmonitor-state-' . $record['state'] . '">
340+
<div class="systemmonitor-state-' . $record['state'] . '-icon">';
341+
306342
/*
307343
* First, we have to detect, if there is any monitoring-data.
308344
* If not (because the destribution is not supported) show this.
309345
*/
310346
if ($record['state'] == 'no_state'){
311-
$html = '<p>' . "mdadm ist not installed or your Server has no supported RAID" . '</p>';
347+
$html .= '<p>' . "mdadm ist not installed or your Server has no supported RAID" . '</p>';
312348
}
313349
else {
314350
$data = unserialize($record['data']);
315-
$html = nl2br($data['output']);
351+
$html .= nl2br($data['output']);
316352
}
353+
$html .= '</div></div>';
354+
317355
} else {
318356
$html = '<p>' . "No RAID-Data available" . '</p>';
319357
}

interface/web/themes/default/css/screen/content_ispc.css

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,10 @@
111111
font-family: Consolas, "Lucida Console", "Courier New", monospace;
112112
font-size: 0.9em;
113113
}
114+
.systemmonitor-state-no_state {
115+
border: 1px solid #30302e;
116+
background-color: #cecfc5;
117+
}
114118
.systemmonitor-state-unknown {
115119
border: 1px solid #30302e;
116120
background-color: #cecfc5;
@@ -143,6 +147,11 @@
143147
background-image:url("../../icons/x64/server.png");
144148
background-repeat: no-repeat;
145149
}
150+
.systemmonitor-state-no_state-icon {
151+
padding:2px 10px 2px 80px;
152+
/*ackground-image:url("../../icons/x32/state_unknown.png"); */
153+
background-repeat: no-repeat;
154+
}
146155
.systemmonitor-state-unknown-icon {
147156
padding:2px 10px 2px 80px;
148157
background-image:url("../../icons/x32/state_unknown.png");
@@ -175,24 +184,11 @@
175184
}
176185

177186
.systemmonitor table {
178-
border: 1px solid #d3d3d3;
179-
width: 80%;
187+
border: none;
180188
margin-top: 10px;
181189
}
182-
.systemmonitor table * td {
183-
padding: 1px;
184-
font-weight: normal;
185-
font-family: Consolas, "Lucida Console", "Courier New", monospace;
186-
font-size: 0.9em;
187-
}
188-
189-
.systemmonitor #system_load {
190-
width: 40%;
191-
}
192-
.systemmonitor #system_services {
193-
width: 40%;
194-
}
195-
.online {
190+
191+
.online {
196192
background-color: #c6d880;
197193
padding:0px 5px;
198194
}

0 commit comments

Comments
 (0)