Skip to content

Commit 4077a64

Browse files
author
vogelor
committed
The monitor now also supports the new db-replication mechanism
1 parent 0c4be73 commit 4077a64

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

interface/web/monitor/show_log.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@
101101

102102

103103
/* fetch the Data from the DB */
104-
$record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = '" . $app->db->quote($logId) . "' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc");
104+
$record = $app->dbmaster->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = '" . $app->dbmaster->quote($logId) . "' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc");
105105

106106
if(isset($record['data'])) {
107107
$data = unserialize($record['data']);

interface/web/monitor/show_sys_state.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ function _getSysState(){
102102
*/
103103
$html = '';
104104

105-
$servers = $app->db->queryAllRecords("SELECT server_id, server_name FROM server order by server_name");
105+
$servers = $app->dbmaster->queryAllRecords("SELECT server_id, server_name FROM server order by server_name");
106106
foreach ($servers as $server)
107107
{
108108
$html .= _getServerState($server['server_id'], $server['server_name'], false);
@@ -134,7 +134,7 @@ function _getServerState($serverId, $serverName, $showAll)
134134
* get all monitoring-data from the server als process then
135135
* (count them and set the server-state)
136136
*/
137-
$records = $app->db->queryAllRecords("SELECT DISTINCT type FROM monitor_data WHERE server_id = " . $serverId);
137+
$records = $app->dbmaster->queryAllRecords("SELECT DISTINCT type FROM monitor_data WHERE server_id = " . $serverId);
138138
foreach($records as $record){
139139
_processDbState($record['type'], $serverId, &$serverState, &$messages);
140140
}
@@ -210,7 +210,7 @@ function _processDbState($type, $serverId, &$serverState, &$messages)
210210
* state
211211
*/
212212
// get the State from the DB
213-
$record = $app->db->queryOneRecord("SELECT state FROM monitor_data WHERE type = '" . $type . "' and server_id = " . $serverId . " order by created desc");
213+
$record = $app->dbmaster->queryOneRecord("SELECT state FROM monitor_data WHERE type = '" . $type . "' and server_id = " . $serverId . " order by created desc");
214214
// change the new state to the highest state
215215
$serverState = _setState($serverState, $record['state']);
216216
// count the states

interface/web/monitor/tools.inc.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ function showServerLoad(){
3030
global $app;
3131

3232
/* fetch the Data from the DB */
33-
$record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'server_load' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc");
33+
$record = $app->dbmaster->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'server_load' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc");
3434

3535
if(isset($record['data'])) {
3636
$data = unserialize($record['data']);
@@ -76,7 +76,7 @@ function showDiskUsage () {
7676
global $app;
7777

7878
/* fetch the Data from the DB */
79-
$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");
79+
$record = $app->dbmaster->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'disk_usage' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc");
8080

8181
if(isset($record['data'])) {
8282
$data = unserialize($record['data']);
@@ -119,7 +119,7 @@ function showMemUsage ()
119119
global $app;
120120

121121
/* fetch the Data from the DB */
122-
$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");
122+
$record = $app->dbmaster->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'mem_usage' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc");
123123

124124
if(isset($record['data'])) {
125125
$data = unserialize($record['data']);
@@ -155,7 +155,7 @@ function showCpuInfo ()
155155
global $app;
156156

157157
/* fetch the Data from the DB */
158-
$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");
158+
$record = $app->dbmaster->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'cpu_info' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc");
159159

160160
if(isset($record['data'])) {
161161
$data = unserialize($record['data']);
@@ -189,7 +189,7 @@ function showServices ()
189189
global $app;
190190

191191
/* fetch the Data from the DB */
192-
$record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'services' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc");
192+
$record = $app->dbmaster->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'services' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc");
193193

194194
if(isset($record['data'])) {
195195
$data = unserialize($record['data']);
@@ -302,7 +302,7 @@ function showSystemUpdate()
302302
global $app;
303303

304304
/* fetch the Data from the DB */
305-
$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");
305+
$record = $app->dbmaster->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'system_update' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc");
306306

307307
if(isset($record['data'])) {
308308
$html =
@@ -332,7 +332,7 @@ function showRaidState()
332332
global $app;
333333

334334
/* fetch the Data from the DB */
335-
$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");
335+
$record = $app->dbmaster->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'raid_state' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc");
336336

337337
if(isset($record['data'])) {
338338
$html =
@@ -364,7 +364,7 @@ function showRKHunter()
364364
global $app;
365365

366366
/* fetch the Data from the DB */
367-
$record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'rkhunter' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc");
367+
$record = $app->dbmaster->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'rkhunter' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc");
368368

369369
if(isset($record['data'])) {
370370
$html =
@@ -396,7 +396,7 @@ function showMailq()
396396
global $app;
397397

398398
/* fetch the Data from the DB */
399-
$record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'mailq' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc");
399+
$record = $app->dbmaster->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'mailq' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc");
400400

401401
if(isset($record['data'])) {
402402
$data = unserialize($record['data']);
@@ -412,7 +412,7 @@ function getDataTime($type) {
412412
global $app;
413413

414414
/* fetch the Data from the DB */
415-
$record = $app->db->queryOneRecord("SELECT created FROM monitor_data WHERE type = '" . $type . "' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc");
415+
$record = $app->dbmaster->queryOneRecord("SELECT created FROM monitor_data WHERE type = '" . $type . "' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc");
416416

417417
if(isset($record['created'])) {
418418
$res = date('Y-m-d H:i', $record['created']);

0 commit comments

Comments
 (0)