Commit 220bb93b authored by vogelor's avatar vogelor
Browse files

The Monitor now also shows the distribution and the version

parent ef56c9a1
...@@ -56,6 +56,10 @@ error_reporting(E_ALL|E_STRICT); ...@@ -56,6 +56,10 @@ error_reporting(E_ALL|E_STRICT);
$FILE = realpath('../install.php'); $FILE = realpath('../install.php');
//** Get distribution identifier //** Get distribution identifier
//** IMPORTANT!
// This is the same code as in /server/mods-available/monitor_core_module.inc.php
// So if you change it here, you also have to change it in
// /server/mods-available/monitor_core_module.inc.php!
function get_distname() { function get_distname() {
$distname = ''; $distname = '';
......
<?php <?php
/* /*
Copyright (c) 2007-2008, Till Brehm, projektfarm Gmbh and Oliver Vogel www.muv.com Copyright (c) 2007-2010, Till Brehm, projektfarm Gmbh and Oliver Vogel www.muv.com
All rights reserved. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, Redistribution and use in source and binary forms, with or without modification,
...@@ -135,23 +135,31 @@ function _getServerState($serverId, $serverName, $showAll) ...@@ -135,23 +135,31 @@ function _getServerState($serverId, $serverName, $showAll)
* get all monitoring-data from the server als process then * get all monitoring-data from the server als process then
* (count them and set the server-state) * (count them and set the server-state)
*/ */
$records = $app->db->queryAllRecords("SELECT DISTINCT type FROM monitor_data WHERE server_id = " . $serverId); $records = $app->db->queryAllRecords("SELECT DISTINCT type, data FROM monitor_data WHERE server_id = " . $serverId);
foreach($records as $record){ $osData = null;
_processDbState($record['type'], $serverId, &$serverState, &$messages); foreach($records as $record){
/* get the state from the db-data */
_processDbState($record['type'], $serverId, &$serverState, &$messages);
/* if we have the os-info, get it */
if ($record['type'] == 'os_info') $osData = unserialize($record['data']);
} }
$res .= '<div class="systemmonitor-state state-'.$serverState.'">'; $res .= '<div class="systemmonitor-state state-'.$serverState.'">';
$res .= '<div class="systemmonitor-device device-server">'; $res .= '<div class="systemmonitor-device device-server">';
$res .= '<div class="systemmonitor-content icons32 ico-'.$serverState.'">'; $res .= '<div class="systemmonitor-content icons32 ico-'.$serverState.'">';
$res .= $app->lng("monitor_serverstate_server_txt") . ': ' . $serverName . '<br />'; $res .= $app->lng("monitor_serverstate_server_txt") . ': ' . $serverName;
$res .= $app->lng("monitor_serverstate_state_txt") . ': ' . $serverState . '<br />'; if ($osData != null){
$res .= ' (' . $osData['name'] . ' ' . $osData['version'] . ')';
}
$res .= '<br />';
$res .= $app->lng("monitor_serverstate_state_txt") . ': ' . $serverState . ' (';
// $res .= sizeof($messages[$app->lng("monitor_serverstate_listok_txt")]) . ' ok | '; // $res .= sizeof($messages[$app->lng("monitor_serverstate_listok_txt")]) . ' ok | ';
$res .= sizeof($messages[$app->lng("monitor_serverstate_listunknown_txt")]) . ' ' . $app->lng("monitor_serverstate_unknown_txt") . ' | '; $res .= sizeof($messages[$app->lng("monitor_serverstate_listunknown_txt")]) . ' ' . $app->lng("monitor_serverstate_unknown_txt") . ', ';
$res .= sizeof($messages[$app->lng("monitor_serverstate_listinfo_txt")]) . ' ' . $app->lng("monitor_serverstate_info_txt") . ' | '; $res .= sizeof($messages[$app->lng("monitor_serverstate_listinfo_txt")]) . ' ' . $app->lng("monitor_serverstate_info_txt") . ', ';
$res .= sizeof($messages[$app->lng("monitor_serverstate_listwarning_txt")]) . ' ' . $app->lng("monitor_serverstate_warning_txt") . ' | '; $res .= sizeof($messages[$app->lng("monitor_serverstate_listwarning_txt")]) . ' ' . $app->lng("monitor_serverstate_warning_txt") . ', ';
$res .= sizeof($messages[$app->lng("monitor_serverstate_listcritical_txt")]) . ' ' . $app->lng("monitor_serverstate_critical_txt") . ' | '; $res .= sizeof($messages[$app->lng("monitor_serverstate_listcritical_txt")]) . ' ' . $app->lng("monitor_serverstate_critical_txt") . ', ';
$res .= sizeof($messages[$app->lng("monitor_serverstate_listerror_txt")]) . ' ' . $app->lng("monitor_serverstate_error_txt") . '<br />'; $res .= sizeof($messages[$app->lng("monitor_serverstate_listerror_txt")]) . ' ' . $app->lng("monitor_serverstate_error_txt") . '';
$res .= '<br />'; $res .= ')<br />';
if ($showAll){ if ($showAll){
/* /*
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment