pandorafms/pandora_console/mobile/operation/servers/view_servers.php

70 lines
2.3 KiB
PHP
Raw Normal View History

<?php
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2010 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation for version 2.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
require_once('../include/functions_servers.php');
class ViewServers {
private $system;
public function __construct() {
global $system;
$this->system = $system;
}
public function show() {
$servers = get_server_info ();
if ($servers === false) $servers = array();
$table = null;
$table->width = '100%';
$table->align = array();
$table->align[1] = 'center';
$table->align[4] = 'center';
$table->head = array();
$table->head[0] = __('Server');
$table->head[1] = '<span title="' . __('Type') . '" alt="' . __('Type') . '">' . __('T') . '</span>';
$table->head[2] = '<span title="' . __('Started') . '" alt="' . __('Started') . '">' . __('S') . '</span>';
$table->head[3] = '<span title="' . __('Updated') . '" alt="' . __('Updated') . '">' . __('U') . '</span>';
$table->head[4] = '<span title="' . __('Status') . '" alt="' . __('Status') . '">' . __('S') . '</span>';
$table->data = array(); //$this->system->debug($servers);
foreach ($servers as $server) {
$data = array();
if ($server['status'] == 0) {
2010-09-17 Miguel de Dios <miguel.dedios@artica.es> * include/fgraph.php: added function "grafico_modulo_sparse_mobile" for to paint a mobile graph. * include/functions_db.php: erased deprecate function "dame_grupo_icono". * include/functions_module.php: moved the functions "format_delete", "format_time", "format_data", "format_verbatim", "format_timestamp", "format_delete", "format_delete_string", "format_delete_log4x" from the file "operation/agentes/datos_agente.php" for to use in other source code places. * operation/agentes/datos_agente.php: extracted the functions "format_delete", "format_time", "format_data", "format_verbatim", "format_timestamp", "format_delete", "format_delete_string", "format_delete_log4x" to "include/functions_module.php" for to use in other source code. * operation/agentes/tactical.php: cleaned source code style. * operation/agentes/group_view.php: cleaned source code style. * mobile/operation/agents/view_agents.php: added class "viewGraph" to show graph and data of any module. * mobile/operation/agents/tactical.php: added first version of page to show tactical mobile page. * mobile/operation/agents/view_alerts.php: added first version of page to show alerts mobile page. * mobile/operation/agents/group_view.php: added first version of page to show group view mobile page. * mobile/operation/servers/view_servers.php: added first version of page to show servers mobile page. * mobile/include/style/main.css: added many new styles. * mobile/include/functions_web.php: added links into menu for new pages. * mobile/include/system.class.php: fixed scope of method "getConfig". * mobile/index.php: added hooks for new pages. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3250 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2010-09-17 12:56:17 +02:00
$server_status = print_status_image(STATUS_SERVER_DOWN, '', true);
}
else {
2010-09-17 Miguel de Dios <miguel.dedios@artica.es> * include/fgraph.php: added function "grafico_modulo_sparse_mobile" for to paint a mobile graph. * include/functions_db.php: erased deprecate function "dame_grupo_icono". * include/functions_module.php: moved the functions "format_delete", "format_time", "format_data", "format_verbatim", "format_timestamp", "format_delete", "format_delete_string", "format_delete_log4x" from the file "operation/agentes/datos_agente.php" for to use in other source code places. * operation/agentes/datos_agente.php: extracted the functions "format_delete", "format_time", "format_data", "format_verbatim", "format_timestamp", "format_delete", "format_delete_string", "format_delete_log4x" to "include/functions_module.php" for to use in other source code. * operation/agentes/tactical.php: cleaned source code style. * operation/agentes/group_view.php: cleaned source code style. * mobile/operation/agents/view_agents.php: added class "viewGraph" to show graph and data of any module. * mobile/operation/agents/tactical.php: added first version of page to show tactical mobile page. * mobile/operation/agents/view_alerts.php: added first version of page to show alerts mobile page. * mobile/operation/agents/group_view.php: added first version of page to show group view mobile page. * mobile/operation/servers/view_servers.php: added first version of page to show servers mobile page. * mobile/include/style/main.css: added many new styles. * mobile/include/functions_web.php: added links into menu for new pages. * mobile/include/system.class.php: fixed scope of method "getConfig". * mobile/index.php: added hooks for new pages. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3250 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2010-09-17 12:56:17 +02:00
$server_status = print_status_image(STATUS_SERVER_OK, '', true);
}
$data[] = strip_tags($server["name"]);
$data[] = str_replace('images/', '../images/', $server['img']);
$data[] = human_time_comparation ($server["laststart"], 'tiny');
$data[] = human_time_comparation ($server["keepalive"], 'tiny');
$data[] = str_replace('.png', '_ball.png', str_replace('images/status_sets',
'../images/status_sets', $server_status));
// $this->system->debug($server["name"]);
$table->data[] = $data;
}
print_table($table);
}
}
?>