Merge branch '2043-fallos-en-la-visualizacion-de-snapshots' into 'develop'
2043 fallos en la visualizacion de snapshots See merge request artica/pandorafms!1656
This commit is contained in:
commit
7390905f07
|
@ -1684,8 +1684,6 @@ class Tree {
|
|||
// Info to be able to open the snapshot image new page
|
||||
$module['snapshot'] = ui_get_snapshot_link(array(
|
||||
'id_module' => $module['id'],
|
||||
'last_data' => $module['datos'],
|
||||
'timestamp' => $module['timestamp'],
|
||||
'interval' => $module['current_interval'],
|
||||
'module_name' => $module['name']
|
||||
), true);
|
||||
|
|
|
@ -1739,6 +1739,7 @@ function agents_get_status($id_agent = 0, $noACLs = false) {
|
|||
// Get all non disabled modules of the agent
|
||||
$all_modules = db_get_all_rows_filter('tagente_modulo',
|
||||
$filter_modules, 'id_agente_modulo');
|
||||
if ($all_modules === false) $all_modules = array();
|
||||
|
||||
$result_modules = array();
|
||||
// Skip non init modules
|
||||
|
|
|
@ -537,10 +537,9 @@ function modules_create_agent_module ($id_agent, $name, $values = false, $disabl
|
|||
// Sync modules start in unknown status
|
||||
$status = AGENT_MODULE_STATUS_NO_DATA;
|
||||
}
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
$result = db_process_sql_insert ('tagente_estado',
|
||||
array ('id_agente_modulo' => $id_agent_module,
|
||||
|
||||
$result = db_process_sql_insert ('tagente_estado', array (
|
||||
'id_agente_modulo' => $id_agent_module,
|
||||
'datos' => 0,
|
||||
'timestamp' => '01-01-1970 00:00:00',
|
||||
'estado' => $status,
|
||||
|
@ -551,36 +550,6 @@ function modules_create_agent_module ($id_agent, $name, $values = false, $disabl
|
|||
'last_status' => $status,
|
||||
'last_known_status' => $status
|
||||
));
|
||||
break;
|
||||
case "postgresql":
|
||||
$result = db_process_sql_insert ('tagente_estado',
|
||||
array ('id_agente_modulo' => $id_agent_module,
|
||||
'datos' => 0,
|
||||
'timestamp' => null,
|
||||
'estado' => $status,
|
||||
'known_status' => $status,
|
||||
'id_agente' => (int) $id_agent,
|
||||
'utimestamp' => 0,
|
||||
'status_changes' => 0,
|
||||
'last_status' => $status,
|
||||
'last_known_status' => $status
|
||||
));
|
||||
break;
|
||||
case "oracle":
|
||||
$result = db_process_sql_insert ('tagente_estado',
|
||||
array ('id_agente_modulo' => $id_agent_module,
|
||||
'datos' => 0,
|
||||
'timestamp' => '#to_date(\'1970-01-01 00:00:00\', \'YYYY-MM-DD HH24:MI:SS\')',
|
||||
'estado' => $status,
|
||||
'known_status' => $status,
|
||||
'id_agente' => (int) $id_agent,
|
||||
'utimestamp' => 0,
|
||||
'status_changes' => 0,
|
||||
'last_status' => $status,
|
||||
'last_known_status' => $status
|
||||
));
|
||||
break;
|
||||
}
|
||||
|
||||
if ($result === false) {
|
||||
db_process_sql_delete ('tagente_modulo',
|
||||
|
@ -758,34 +727,7 @@ function modules_format_delete_log4x($id)
|
|||
* @return array An array with module information
|
||||
*/
|
||||
function modules_get_agentmodule ($id_agentmodule) {
|
||||
global $config;
|
||||
|
||||
switch ($config['dbtype']) {
|
||||
case "mysql":
|
||||
case "postgresql":
|
||||
return db_get_row ('tagente_modulo', 'id_agente_modulo', (int) $id_agentmodule);
|
||||
break;
|
||||
case "oracle":
|
||||
$fields = db_get_all_rows_filter('USER_TAB_COLUMNS',
|
||||
'TABLE_NAME = \'TAGENTE_MODULO\' AND COLUMN_NAME <> \'MAX_CRITICAL\' AND COLUMN_NAME <> \'MIN_CRITICAL\' AND COLUMN_NAME <> \'POST_PROCESS\' AND COLUMN_NAME <> \'MAX_WARNING\' AND COLUMN_NAME <> \'MIN_WARNING\'', 'COLUMN_NAME');
|
||||
foreach ($fields as $field) {
|
||||
$fields_[] = $field['column_name'];
|
||||
}
|
||||
$fields = implode(',', $fields_);
|
||||
|
||||
$result = db_process_sql("
|
||||
SELECT TO_NUMBER(MAX_CRITICAL) as max_critical,
|
||||
TO_NUMBER(MIN_CRITICAL) as min_critical,
|
||||
TO_NUMBER(MAX_WARNING) as max_warning,
|
||||
TO_NUMBER(MIN_WARNING) as min_warning,
|
||||
TO_NUMBER(POST_PROCESS) as post_process,
|
||||
" . $fields . "
|
||||
FROM tagente_modulo
|
||||
WHERE id_agente_modulo = " . $id_agentmodule);
|
||||
|
||||
return $result[0];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
function modules_get_table_data($id_agent_module) {
|
||||
|
@ -1999,8 +1941,6 @@ function modules_get_status($id_agent_module, $db_status, $data, &$status, &$tit
|
|||
// Get unknown agents by using the status code in modules
|
||||
|
||||
function modules_agents_unknown ($module_name) {
|
||||
|
||||
//TODO REVIEW ORACLE AND POSTGRES
|
||||
return db_get_sql ("SELECT COUNT( DISTINCT tagente.id_agente)
|
||||
FROM tagente_estado, tagente, tagente_modulo
|
||||
WHERE tagente.disabled = 0
|
||||
|
@ -2022,8 +1962,6 @@ function modules_agents_ok ($module_name) {
|
|||
//This query grouped all modules by agents and select the MAX value for status which has the value 0
|
||||
//If MAX(estado) is 0 it means all modules has status 0 => OK
|
||||
//Then we count the agents of the group selected to know how many agents are in OK status
|
||||
|
||||
//TODO REVIEW ORACLE AND POSTGRES
|
||||
return db_get_sql ("SELECT COUNT(max_estado)
|
||||
FROM (
|
||||
SELECT MAX(tagente_estado.estado) as max_estado
|
||||
|
@ -2047,8 +1985,6 @@ function modules_agents_critical ($module_name) {
|
|||
//If estado = 1 it means at leas 1 module is in critical status so the agent is critical
|
||||
//Then we count the agents of the group selected to know how many agents are in critical status
|
||||
|
||||
//TODO REVIEW ORACLE AND POSTGRES
|
||||
|
||||
return db_get_sql ("SELECT COUNT( DISTINCT tagente_estado.id_agente)
|
||||
FROM tagente_estado, tagente, tagente_modulo
|
||||
WHERE tagente.disabled = 0 AND tagente_estado.utimestamp != 0
|
||||
|
@ -2070,8 +2006,6 @@ function modules_agents_warning ($module_name) {
|
|||
//If MIN(estado) is 2 it means at least one module is warning and there is no critical modules
|
||||
//Then we count the agents of the group selected to know how many agents are in warning status
|
||||
|
||||
//TODO REVIEW ORACLE AND POSTGRES
|
||||
|
||||
return db_get_sql ("SELECT COUNT(min_estado)
|
||||
FROM (SELECT MAX(tagente_estado.estado) as min_estado
|
||||
FROM tagente_estado, tagente, tagente_modulo
|
||||
|
|
|
@ -268,32 +268,16 @@ function treeview_printModuleTable($id_module, $server_data = false, $no_head =
|
|||
$last_data_str .= html_print_image('images/clock2.png', true, array('title' => $last_data["timestamp"], 'width' => '18px'));
|
||||
|
||||
$is_snapshot = is_snapshot_data ( $last_data["datos"] );
|
||||
if (($config['command_snapshot']) && ($is_snapshot)) {
|
||||
$is_large_image = is_text_to_black_string ($last_data["datos"]);
|
||||
if (($config['command_snapshot']) && ($is_snapshot || $is_large_image)) {
|
||||
$link = ui_get_snapshot_link( array(
|
||||
'id_module' => $module['id_agente_modulo'],
|
||||
'last_data' => $last_data['datos'],
|
||||
'timestamp' => $last_data['timestamp'],
|
||||
'interval' => $module['current_interval'],
|
||||
'module_name' => $module['module_name']
|
||||
'module_name' => $module['module_name'],
|
||||
'id_node' => empty($server_id) ? 0 : $server_id
|
||||
));
|
||||
|
||||
if(!is_image_data($last_data["datos"])){
|
||||
$salida = '<a href="javascript:' . $link . '">' .
|
||||
html_print_image('images/default_list.png', true,
|
||||
array('border' => '0',
|
||||
'alt' => '',
|
||||
'title' => __('Snapshot view'))) . '</a> ';
|
||||
$salida = ui_get_snapshot_image($link, $is_snapshot) . ' ';
|
||||
}
|
||||
else {
|
||||
$salida = '<a href="javascript:' . $link . '">' .
|
||||
html_print_image('images/photo.png', true,
|
||||
array('border' => '0',
|
||||
'alt' => '',
|
||||
'title' => __('Snapshot view'))) . '</a> ';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$last_data_str .= $salida;
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -3791,36 +3791,27 @@ function ui_print_module_string_value($value, $id_agente_module,
|
|||
$value = io_safe_input($value);
|
||||
}
|
||||
|
||||
|
||||
$is_snapshot = is_snapshot_data ($module["datos"]);
|
||||
$is_large_image = is_text_to_black_string ($module["datos"]);
|
||||
if (($config['command_snapshot']) && ($is_snapshot || $is_large_image)) {
|
||||
|
||||
|
||||
$row[7] = ui_get_snapshot_image($link, $is_snapshot) . ' ';
|
||||
}
|
||||
|
||||
$is_snapshot = is_snapshot_data($value);
|
||||
$is_large_image = is_text_to_black_string ($value);
|
||||
|
||||
if (($config['command_snapshot']) && ($is_snapshot || $is_large_image)) {
|
||||
$handle = "snapshot" . "_" . $id_agente_module;
|
||||
$url = 'include/procesos.php?agente=' . $id_agente_module;
|
||||
$win_handle = dechex(crc32($handle));
|
||||
|
||||
$link = "winopeng_var('operation/agentes/snapshot_view.php?" .
|
||||
"id=" . $id_agente_module .
|
||||
"&refr=" . $current_interval .
|
||||
"&label=" . rawurlencode(urlencode(io_safe_output($module_name))) . "','" . $win_handle . "', 700,480)";
|
||||
if ($is_snapshot) {
|
||||
$salida = '<a href="javascript:' . $link . '">' .
|
||||
html_print_image("images/photo.png", true,
|
||||
array("border" => '0',
|
||||
"alt" => "",
|
||||
"title" => __("Snapshot view"))) . '</a> ';
|
||||
}
|
||||
else {
|
||||
$salida = '<a href="javascript:' . $link . '">' .
|
||||
html_print_image("images/default_list.png", true,
|
||||
array("border" => '0',
|
||||
"alt" => "",
|
||||
"title" => __("Snapshot view"))) . '</a> ';
|
||||
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
$link = ui_get_snapshot_link( array(
|
||||
'id_module' => $id_agente_module,
|
||||
'last_data' => $value,
|
||||
'interval' => $current_interval,
|
||||
'module_name' => $module_name,
|
||||
'timestamp' => db_get_value('timestamp', 'tagente_estado', 'id_agente_modulo', $id_agente_module)
|
||||
));
|
||||
$salida = ui_get_snapshot_image($link, $is_snapshot) . ' ';
|
||||
} else {
|
||||
$sub_string = substr(io_safe_output($value), 0, 12);
|
||||
if ($value == $sub_string) {
|
||||
if ($value == 0 && !$sub_string) {
|
||||
|
@ -3921,8 +3912,8 @@ function ui_get_snapshot_link($params, $only_params = false) {
|
|||
'id_module' => 0, //id_agente_modulo
|
||||
'module_name' => '',
|
||||
'interval' => 300,
|
||||
'last_data' => '',
|
||||
'timestamp' => '0'
|
||||
'timestamp' => 0,
|
||||
'id_node' => 0
|
||||
);
|
||||
|
||||
// Merge default params with passed params
|
||||
|
@ -3933,10 +3924,10 @@ function ui_get_snapshot_link($params, $only_params = false) {
|
|||
|
||||
$url = "$page?" .
|
||||
"id=" . $params['id_module'] .
|
||||
"&refr=" . $parms['interval'] .
|
||||
"×tamp=" . $params['timestamp'] .
|
||||
"&last_data=" . rawurlencode(urlencode(io_safe_output($params['last_data']))) .
|
||||
"&label=" . rawurlencode(urlencode(io_safe_output($params['module_name'])));
|
||||
"&label=" . rawurlencode(urlencode(io_safe_output($params['module_name']))).
|
||||
"&id_node=" . $params['id_node'];
|
||||
if ($params['timestamp'] != 0) $url .= "×tamp=" . $parms['timestamp'];
|
||||
if ($params['timestamp'] != 0) $url .= "&refr=" . $parms['interval'];
|
||||
|
||||
// Second parameter of js winopeng_var
|
||||
$win_handle = dechex(crc32('snapshot_' . $params['id_module']));
|
||||
|
@ -3950,6 +3941,28 @@ function ui_get_snapshot_link($params, $only_params = false) {
|
|||
return "winopeng_var('" . implode("', '", $link_parts) . "')";
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the snapshot image with the link to open a snapshot into a new page
|
||||
*
|
||||
* @param string Built link
|
||||
* @param bool Picture image or list image
|
||||
*
|
||||
* @return string HTML anchor link with image
|
||||
*/
|
||||
function ui_get_snapshot_image ($link, $is_image) {
|
||||
$image_name = $is_image ? 'photo.png' : 'default_list.png';
|
||||
|
||||
$link = '<a href="javascript:' . $link . '">' .
|
||||
html_print_image("images/$image_name", true,
|
||||
array('border' => '0',
|
||||
'alt' => '',
|
||||
'title' => __('Snapshot view'))
|
||||
) .
|
||||
'</a>';
|
||||
|
||||
return $link;
|
||||
}
|
||||
|
||||
function ui_get_using_system_timezone_warning ($tag = "h3", $return = true) {
|
||||
global $config;
|
||||
|
||||
|
|
|
@ -655,10 +655,9 @@ class Ui {
|
|||
echo " <link rel='stylesheet' href='include/style/main.css' />\n";
|
||||
|
||||
echo " <link rel='stylesheet' href='include/style/jquery.mobile-1.3.1.css' />\n";
|
||||
//echo " <link rel='stylesheet' href='http://code.jquery.com/mobile/1.3.0/jquery.mobile-1.3.0.css' />\n";
|
||||
echo " <script src='include/javascript/jquery.js'></script>\n";
|
||||
echo " <script src='include/javascript/jquery.mobile-1.3.1.js'></script>\n";
|
||||
//echo " <script src='http://code.jquery.com/mobile/1.3.0/jquery.mobile-1.3.0.js'></script>\n";
|
||||
echo " <script src='../include/javascript/pandora.js'></script>\n";
|
||||
|
||||
echo " </head>\n";
|
||||
echo " <body>\n";
|
||||
|
|
|
@ -270,6 +270,7 @@ class Modules {
|
|||
}
|
||||
|
||||
private function getListModules($page = 0, $ajax = false) {
|
||||
global $config;
|
||||
$system = System::getInstance();
|
||||
$user = User::getInstance();
|
||||
|
||||
|
@ -591,33 +592,16 @@ class Modules {
|
|||
}
|
||||
}
|
||||
|
||||
$is_snapshot = is_snapshot_data ($module["datos"]);
|
||||
$is_large_image = is_text_to_black_string ($module["datos"]);
|
||||
if (($config['command_snapshot']) && ($is_snapshot || $is_large_image)) {
|
||||
$link = ui_get_snapshot_link( array(
|
||||
'id_module' => $module['id_agente_modulo'],
|
||||
'module_name' => $module['module_name']
|
||||
));
|
||||
|
||||
$is_snapshot = is_snapshot_data($module["datos"]);
|
||||
|
||||
$handle = "snapshot" . "_" . $module["id_agente_modulo"];
|
||||
$url = 'include/procesos.php?agente=' . $module["id_agente_modulo"];
|
||||
|
||||
$link = "window.open('../operation/agentes/snapshot_view.php?" .
|
||||
"id=" . $module["id_agente_modulo"] .
|
||||
"&refr=" . $module["module_interval"]."','".$handle."','width=700, height=480')";
|
||||
|
||||
if ($is_snapshot) {
|
||||
if (is_image_data($module["datos"])) {
|
||||
$row[7] = $row[__('Data')] = '<a href="javascript:' . $link . '">' .
|
||||
html_print_image("images/photo.png", true,
|
||||
array("border" => '0',
|
||||
"alt" => "",
|
||||
"title" => __("Snapshot view"))) . '</a> ';
|
||||
}
|
||||
else {
|
||||
$row[7] = $row[__('Data')] = '<a href="javascript:' . $link . '">' .
|
||||
html_print_image("images/default_list.png", true,
|
||||
array("border" => '0',
|
||||
"alt" => "",
|
||||
"title" => __("Snapshot view"))) . '</a> ';
|
||||
}
|
||||
}
|
||||
else {
|
||||
$row[7] = ui_get_snapshot_image($link, $is_snapshot) . ' ';
|
||||
} else {
|
||||
$row[7] = $row[__('Data')] = '<span style="white-space: nowrap;">' .
|
||||
'<span style="display: none;" class="show_collapside">' .
|
||||
$row[__('Status')] . ' </span>' .
|
||||
|
@ -627,17 +611,6 @@ class Modules {
|
|||
$this->id_agent . '">' . $output . '</a>' . '</span>';
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
|
||||
'<span style="white-space: nowrap;">' .
|
||||
'<span style="display: none;" class="show_collapside">' .
|
||||
$row[__('Status')] . ' </span>' .
|
||||
'<a data-ajax="false" class="ui-link" ' .
|
||||
'href="index.php?page=module_graph&id=' .
|
||||
$module['id_agente_modulo'] . '&id_agent=' .
|
||||
$this->id_agent . '">' . $output . '</a>' . '</span>';*/
|
||||
|
||||
if (!$ajax) {
|
||||
unset($row[0]);
|
||||
if ($this->columns['agent']) {
|
||||
|
@ -817,20 +790,6 @@ class Modules {
|
|||
|
||||
$string = '(' . implode(' - ', $filters_to_serialize) . ')';
|
||||
|
||||
|
||||
|
||||
//~ $status = $this->list_status[$this->status];
|
||||
//~
|
||||
//~ $group = groups_get_name($this->group, true);
|
||||
//~
|
||||
//~ $module_group = db_get_value('name',
|
||||
//~ 'tmodule_group', 'id_mg', $this->module_group);
|
||||
//~ $module_group = io_safe_output($module_group);
|
||||
//~
|
||||
//~ $string = sprintf(
|
||||
//~ __("(Status: %s - Group: %s - Module group: %s - Free Search: %s)"),
|
||||
//~ $status, $group, $module_group, $this->free_search);
|
||||
|
||||
return $string;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -108,21 +108,18 @@ if (is_ajax ()) {
|
|||
$value = $module_value;
|
||||
}
|
||||
else{
|
||||
// If carriage returns present... then is a "Snapshot" data (full command output)
|
||||
$is_snapshot = is_snapshot_data ( $module_value );
|
||||
|
||||
$module = modules_get_agentmodule($id_module);
|
||||
|
||||
if (($config['command_snapshot']) && ($is_snapshot)){
|
||||
$handle = "snapshot"."_".$module["id_agente_modulo"];
|
||||
$url = 'include/procesos.php?agente='.$module["id_agente_modulo"];
|
||||
$win_handle = dechex(crc32($handle));
|
||||
|
||||
$link ="winopeng_var('operation/agentes/snapshot_view.php?id=".$module["id_agente_modulo"]."&refr=".$module["current_interval"]."&label=".$module["nombre"]."','".$win_handle."', 700,480)";
|
||||
|
||||
$value = '<a href="javascript:'.$link.'">' . html_print_image("images/default_list.png", true, array("border" => '0', "alt" => "", "title" => __("Snapshot view"))) . '</a> ';
|
||||
}
|
||||
else {
|
||||
$is_snapshot = is_snapshot_data ($module_value);
|
||||
$is_large_image = is_text_to_black_string ($module_value);
|
||||
if (($config['command_snapshot']) && ($is_snapshot || $is_large_image)) {
|
||||
$link = ui_get_snapshot_link( array(
|
||||
'id_module' => $module["id_agente_modulo"],
|
||||
'interval' => $module["current_interval"],
|
||||
'module_name' => $module["nombre"]
|
||||
));
|
||||
$value = ui_get_snapshot_image($link, $is_snapshot) . ' ';
|
||||
} else {
|
||||
$value = ui_print_module_string_value(
|
||||
$module_value, $module["id_agente_modulo"],
|
||||
$module["current_interval"], $module["module_name"]);
|
||||
|
|
|
@ -28,6 +28,7 @@ require_once ($config['homedir'] . '/include/functions_graph.php');
|
|||
require_once ($config['homedir'] . '/include/functions_modules.php');
|
||||
require_once ($config['homedir'] . '/include/functions_agents.php');
|
||||
require_once ($config['homedir'] . '/include/functions_tags.php');
|
||||
enterprise_include_once('include/functions_agents.php');
|
||||
|
||||
check_login ();
|
||||
|
||||
|
@ -38,25 +39,40 @@ if (file_exists ('../../include/languages/'.$user_language.'.mo')) {
|
|||
}
|
||||
|
||||
$id = get_parameter('id');
|
||||
$label = get_parameter ("label");
|
||||
$last_data = get_parameter("last_data", '');
|
||||
$last_timestamp = get_parameter("timestamp", '');
|
||||
// FIXME: Support to old call snapshow_view calls. Remove it when all are migrated
|
||||
if (empty($last_data)) {
|
||||
$row = db_get_row_sql("SELECT *
|
||||
FROM tagente_estado
|
||||
WHERE id_agente_modulo = $id");
|
||||
$last_data = io_safe_output($row["datos"]);
|
||||
$last_timestamp = $row["timestamp"];
|
||||
$id_node = get_parameter("id_node", 0);
|
||||
|
||||
// Get the data
|
||||
if ($id_node > 0) {
|
||||
$connection = metaconsole_get_connection_by_id($id_node);
|
||||
if (metaconsole_load_external_db($connection) != NOERR) {
|
||||
ui_print_error_message(__('Cannot connect with node to display the module data.'));
|
||||
exit;
|
||||
}
|
||||
}
|
||||
$row_module = modules_get_agentmodule($id);
|
||||
$row_state = db_get_row('tagente_estado', 'id_agente_modulo', $id);
|
||||
|
||||
if ($id_node > 0) {
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
|
||||
// TODO - Put ACL here
|
||||
// Build the info
|
||||
$label = get_parameter ("label", io_safe_output($row_module['module_name']));
|
||||
$last_timestamp = get_parameter("timestamp", $row_state['timestamp']);
|
||||
$last_data = io_safe_output($row_state["datos"]);
|
||||
$refresh = (int) get_parameter ("refr", $row_state['current_interval']);
|
||||
|
||||
// ACL check
|
||||
$all_groups = agents_get_all_groups_agent ($row_state['id_agente']);
|
||||
if (!check_acl_one_of_groups($config['id_user'], $all_groups, "AR")) {
|
||||
require ($config['homedir'] . "/general/noaccess.php");
|
||||
exit;
|
||||
}
|
||||
?>
|
||||
<html>
|
||||
<head>
|
||||
<?php
|
||||
// Parsing the refresh before sending any header
|
||||
$refresh = (int) get_parameter ("refr", -1);
|
||||
if ($refresh > 0) {
|
||||
$query = ui_get_url_refresh (false);
|
||||
echo '<meta http-equiv="refresh" content="'.$refresh.'; URL='.$query.'" />';
|
||||
|
@ -68,14 +84,8 @@ if (empty($last_data)) {
|
|||
</head>
|
||||
<body style='background:#000; color: #ccc;'>
|
||||
<?php
|
||||
$row = db_get_row_sql("SELECT *
|
||||
FROM tagente_estado
|
||||
WHERE id_agente_modulo = $id");
|
||||
|
||||
echo "<h2 style='text-align:center;' id='title_snapshot_view'>";
|
||||
echo __("Current data at");
|
||||
echo " ";
|
||||
echo $last_timestamp;
|
||||
echo __("Current data at %s", $last_timestamp);
|
||||
echo "</h2>";
|
||||
if (is_image_data($last_data)) {
|
||||
echo '<center><img src="' . $last_data . '" alt="image" style="width:100%"/></center>';
|
||||
|
|
|
@ -732,9 +732,7 @@ switch ($sortField) {
|
|||
break;
|
||||
}
|
||||
|
||||
switch ($config['dbtype']) {
|
||||
case 'mysql':
|
||||
$sql = 'SELECT
|
||||
$sql = 'SELECT
|
||||
(SELECT GROUP_CONCAT(ttag.name SEPARATOR \',\')
|
||||
FROM ttag
|
||||
WHERE ttag.id_tag IN (
|
||||
|
@ -778,100 +776,6 @@ switch ($config['dbtype']) {
|
|||
GROUP BY tagente_modulo.id_agente_modulo
|
||||
ORDER BY ' . $order['field'] . " " . $order['order'] . '
|
||||
LIMIT '.$offset.",".$limit_sql;
|
||||
break;
|
||||
case 'postgresql':
|
||||
if (strstr($config['dbversion'], "8.4") !== false) {
|
||||
$string_agg = 'array_to_string(array_agg(ttag.name), \',\')';
|
||||
}
|
||||
else {
|
||||
$string_agg = 'STRING_AGG(ttag.name, \',\')';
|
||||
}
|
||||
|
||||
$sql = 'SELECT
|
||||
(SELECT ' . $string_agg . '
|
||||
FROM ttag
|
||||
WHERE ttag.id_tag IN (
|
||||
SELECT ttag_module.id_tag
|
||||
FROM ttag_module
|
||||
WHERE ttag_module.id_agente_modulo = tagente_modulo.id_agente_modulo))
|
||||
AS tags,
|
||||
tagente_modulo.id_agente_modulo,
|
||||
tagente_modulo.id_modulo,
|
||||
tagente.intervalo AS agent_interval,
|
||||
tagente.alias AS agent_alias,
|
||||
tagente.nombre AS agent_name,
|
||||
tagente_modulo.nombre AS module_name,
|
||||
tagente_modulo.history_data,
|
||||
tagente_modulo.flag AS flag,
|
||||
tagente.id_grupo AS id_group,
|
||||
tagente.id_agente AS id_agent,
|
||||
tagente_modulo.id_tipo_modulo AS module_type,
|
||||
tagente_modulo.module_interval,
|
||||
tagente_estado.datos,
|
||||
tagente_estado.estado,
|
||||
tagente_modulo.min_warning,
|
||||
tagente_modulo.max_warning,
|
||||
tagente_modulo.str_warning,
|
||||
tagente_modulo.min_critical,
|
||||
tagente_modulo.unit,
|
||||
tagente_modulo.max_critical,
|
||||
tagente_modulo.str_critical,
|
||||
tagente_modulo.extended_info,
|
||||
tagente_modulo.critical_inverse,
|
||||
tagente_modulo.warning_inverse,
|
||||
tagente_modulo.critical_instructions,
|
||||
tagente_modulo.warning_instructions,
|
||||
tagente_modulo.unknown_instructions,
|
||||
tagente_estado.utimestamp AS utimestamp' .
|
||||
$sql_from .
|
||||
$sql_conditions_all .
|
||||
' LIMIT ' . $limit_sql . ' OFFSET ' . $offset;
|
||||
break;
|
||||
case 'oracle':
|
||||
$set = array();
|
||||
$set['limit'] = $limit_sql;
|
||||
$set['offset'] = $offset;
|
||||
$sql = 'SELECT
|
||||
(SELECT LISTAGG(ttag.name, \',\') WITHIN GROUP (ORDER BY ttag.name)
|
||||
FROM ttag
|
||||
WHERE ttag.id_tag IN (
|
||||
SELECT ttag_module.id_tag
|
||||
FROM ttag_module
|
||||
WHERE ttag_module.id_agente_modulo = tagente_modulo.id_agente_modulo))
|
||||
AS tags,
|
||||
tagente_modulo.id_agente_modulo,
|
||||
tagente_modulo.id_modulo,
|
||||
tagente.intervalo AS agent_interval,
|
||||
tagente.alias AS agent_alias,
|
||||
tagente.nombre AS agent_name,
|
||||
tagente_modulo.nombre AS module_name,
|
||||
tagente_modulo.history_data,
|
||||
tagente_modulo.flag AS flag,
|
||||
tagente.id_grupo AS id_group,
|
||||
tagente.id_agente AS id_agent,
|
||||
tagente_modulo.id_tipo_modulo AS module_type,
|
||||
tagente_modulo.module_interval,
|
||||
tagente_estado.datos,
|
||||
tagente_estado.estado,
|
||||
tagente_modulo.min_warning,
|
||||
tagente_modulo.max_warning,
|
||||
tagente_modulo.str_warning,
|
||||
tagente_modulo.unit,
|
||||
tagente_modulo.min_critical,
|
||||
tagente_modulo.max_critical,
|
||||
tagente_modulo.str_critical,
|
||||
tagente_modulo.extended_info,
|
||||
tagente_modulo.critical_inverse,
|
||||
tagente_modulo.warning_inverse,
|
||||
tagente_modulo.critical_instructions,
|
||||
tagente_modulo.warning_instructions,
|
||||
tagente_modulo.unknown_instructions,
|
||||
tagente_estado.utimestamp AS utimestamp' .
|
||||
$sql_from .
|
||||
$sql_conditions_all;
|
||||
$sql = oracle_recode_query ($sql, $set);
|
||||
break;
|
||||
}
|
||||
|
||||
if (! defined ('METACONSOLE')) {
|
||||
$result = db_get_all_rows_sql ($sql);
|
||||
|
@ -1400,29 +1304,12 @@ if (!empty($result)) {
|
|||
if (($config['command_snapshot']) && ($is_snapshot || $is_large_image)) {
|
||||
$link = ui_get_snapshot_link( array(
|
||||
'id_module' => $row['id_agente_modulo'],
|
||||
'last_data' => $row['datos'],
|
||||
'timestamp' => $row['timestamp'],
|
||||
'interval' => $row['current_interval'],
|
||||
'module_name' => $row['module_name']
|
||||
'module_name' => $row['module_name'],
|
||||
'id_node' => $row['server_id']
|
||||
));
|
||||
|
||||
if($is_large_image){
|
||||
$salida = '<a href="javascript:' . $link . '">' .
|
||||
html_print_image('images/default_list.png', true,
|
||||
array('border' => '0',
|
||||
'alt' => '',
|
||||
'title' => __('Snapshot view'))) . '</a> ';
|
||||
}
|
||||
else {
|
||||
$salida = '<a href="javascript:' . $link . '">' .
|
||||
html_print_image('images/photo.png', true,
|
||||
array('border' => '0',
|
||||
'alt' => '',
|
||||
'title' => __('Snapshot view'))) . '</a> ';
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
$salida = ui_get_snapshot_image($link, $is_snapshot) . ' ';
|
||||
} else {
|
||||
$sub_string = substr(io_safe_output($row['datos']), 0, 12);
|
||||
if ($module_value == $sub_string) {
|
||||
if ($module_value == 0 && !$sub_string) {
|
||||
|
|
Loading…
Reference in New Issue