Skip to content

Commit 220bb93

Browse files
author
vogelor
committed
The Monitor now also shows the distribution and the version
1 parent ef56c9a commit 220bb93

File tree

3 files changed

+1331
-1207
lines changed

3 files changed

+1331
-1207
lines changed

install/lib/install.lib.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@
5656
$FILE = realpath('../install.php');
5757

5858
//** Get distribution identifier
59+
//** IMPORTANT!
60+
// This is the same code as in /server/mods-available/monitor_core_module.inc.php
61+
// So if you change it here, you also have to change it in
62+
// /server/mods-available/monitor_core_module.inc.php!
5963
function get_distname() {
6064

6165
$distname = '';

interface/web/monitor/show_sys_state.php

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/*
3-
Copyright (c) 2007-2008, Till Brehm, projektfarm Gmbh and Oliver Vogel www.muv.com
3+
Copyright (c) 2007-2010, Till Brehm, projektfarm Gmbh and Oliver Vogel www.muv.com
44
All rights reserved.
55
66
Redistribution and use in source and binary forms, with or without modification,
@@ -135,23 +135,31 @@ function _getServerState($serverId, $serverName, $showAll)
135135
* get all monitoring-data from the server als process then
136136
* (count them and set the server-state)
137137
*/
138-
$records = $app->db->queryAllRecords("SELECT DISTINCT type FROM monitor_data WHERE server_id = " . $serverId);
139-
foreach($records as $record){
140-
_processDbState($record['type'], $serverId, &$serverState, &$messages);
138+
$records = $app->db->queryAllRecords("SELECT DISTINCT type, data FROM monitor_data WHERE server_id = " . $serverId);
139+
$osData = null;
140+
foreach($records as $record){
141+
/* get the state from the db-data */
142+
_processDbState($record['type'], $serverId, &$serverState, &$messages);
143+
/* if we have the os-info, get it */
144+
if ($record['type'] == 'os_info') $osData = unserialize($record['data']);
141145
}
142146

143147
$res .= '<div class="systemmonitor-state state-'.$serverState.'">';
144148
$res .= '<div class="systemmonitor-device device-server">';
145149
$res .= '<div class="systemmonitor-content icons32 ico-'.$serverState.'">';
146-
$res .= $app->lng("monitor_serverstate_server_txt") . ': ' . $serverName . '<br />';
147-
$res .= $app->lng("monitor_serverstate_state_txt") . ': ' . $serverState . '<br />';
150+
$res .= $app->lng("monitor_serverstate_server_txt") . ': ' . $serverName;
151+
if ($osData != null){
152+
$res .= ' (' . $osData['name'] . ' ' . $osData['version'] . ')';
153+
}
154+
$res .= '<br />';
155+
$res .= $app->lng("monitor_serverstate_state_txt") . ': ' . $serverState . ' (';
148156
// $res .= sizeof($messages[$app->lng("monitor_serverstate_listok_txt")]) . ' ok | ';
149-
$res .= sizeof($messages[$app->lng("monitor_serverstate_listunknown_txt")]) . ' ' . $app->lng("monitor_serverstate_unknown_txt") . ' | ';
150-
$res .= sizeof($messages[$app->lng("monitor_serverstate_listinfo_txt")]) . ' ' . $app->lng("monitor_serverstate_info_txt") . ' | ';
151-
$res .= sizeof($messages[$app->lng("monitor_serverstate_listwarning_txt")]) . ' ' . $app->lng("monitor_serverstate_warning_txt") . ' | ';
152-
$res .= sizeof($messages[$app->lng("monitor_serverstate_listcritical_txt")]) . ' ' . $app->lng("monitor_serverstate_critical_txt") . ' | ';
153-
$res .= sizeof($messages[$app->lng("monitor_serverstate_listerror_txt")]) . ' ' . $app->lng("monitor_serverstate_error_txt") . '<br />';
154-
$res .= '<br />';
157+
$res .= sizeof($messages[$app->lng("monitor_serverstate_listunknown_txt")]) . ' ' . $app->lng("monitor_serverstate_unknown_txt") . ', ';
158+
$res .= sizeof($messages[$app->lng("monitor_serverstate_listinfo_txt")]) . ' ' . $app->lng("monitor_serverstate_info_txt") . ', ';
159+
$res .= sizeof($messages[$app->lng("monitor_serverstate_listwarning_txt")]) . ' ' . $app->lng("monitor_serverstate_warning_txt") . ', ';
160+
$res .= sizeof($messages[$app->lng("monitor_serverstate_listcritical_txt")]) . ' ' . $app->lng("monitor_serverstate_critical_txt") . ', ';
161+
$res .= sizeof($messages[$app->lng("monitor_serverstate_listerror_txt")]) . ' ' . $app->lng("monitor_serverstate_error_txt") . '';
162+
$res .= ')<br />';
155163

156164
if ($showAll){
157165
/*

0 commit comments

Comments
 (0)