mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-31 01:35:36 +02:00
2013-02-18 Miguel de Dios <miguel.dedios@artica.es>
* operation/search_modules.php, operation/agentes/ver_agente.php, operation/agentes/status_monitor.php, operation/agentes/estado_ultimopaquete.php, operation/agentes/estado_monitores.php, operation/agentes/datos_agente.php, include/functions_io.php: fixed to show string web data from Goliat modules. Fixes: #3600804 git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7670 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
c2050ebe53
commit
d0e0df41c6
@ -1,3 +1,14 @@
|
||||
2013-02-18 Miguel de Dios <miguel.dedios@artica.es>
|
||||
|
||||
* operation/search_modules.php, operation/agentes/ver_agente.php,
|
||||
operation/agentes/status_monitor.php,
|
||||
operation/agentes/estado_ultimopaquete.php,
|
||||
operation/agentes/estado_monitores.php,
|
||||
operation/agentes/datos_agente.php, include/functions_io.php: fixed
|
||||
to show string web data from Goliat modules.
|
||||
|
||||
Fixes: #3600804
|
||||
|
||||
2013-02-18 Miguel de Dios <miguel.dedios@artica.es>
|
||||
|
||||
* include/functions_graph.php: added a parameter for to set the
|
||||
|
@ -104,7 +104,8 @@ function io_safe_input($value) {
|
||||
|
||||
//Replace some characteres for html entities
|
||||
for ($i=0; $i<33; $i++) {
|
||||
$valueHtmlEncode = str_ireplace(chr($i),io_ascii_to_html($i), $valueHtmlEncode);
|
||||
$valueHtmlEncode = str_ireplace(chr($i),
|
||||
io_ascii_to_html($i), $valueHtmlEncode);
|
||||
}
|
||||
|
||||
return $valueHtmlEncode;
|
||||
@ -289,6 +290,7 @@ function io_safe_output_html($value, $utf8 = true)
|
||||
function io_salida_limpia ($string) {
|
||||
$quote_style = ENT_QUOTES;
|
||||
static $trans;
|
||||
|
||||
if (! isset ($trans)) {
|
||||
$trans = get_html_translation_table (HTML_ENTITIES, $quote_style);
|
||||
foreach ($trans as $key => $value)
|
||||
@ -296,6 +298,7 @@ function io_salida_limpia ($string) {
|
||||
// dont translate the '&' in case it is part of &xxx;
|
||||
$trans[chr(38)] = '&';
|
||||
}
|
||||
|
||||
// after the initial translation, _do_ map standalone "&" into "&"
|
||||
return preg_replace ("/&(?![A-Za-z]{0,4}\w{2,3};|#[0-9]{2,3};)/","&",
|
||||
strtr ($string, $trans));
|
||||
|
@ -35,7 +35,8 @@ if ($connection == 'history' && $config['history_db_enabled'] == 1) {
|
||||
$config['history_db_connection'] = db_connect($config['history_db_host'], $config['history_db_name'], $config['history_db_user'], $config['history_db_pass'], $config['history_db_port'], false);
|
||||
}
|
||||
$connection_handler = $config['history_db_connection'];
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$connection_handler = $config['dbconnection'];
|
||||
}
|
||||
|
||||
@ -229,15 +230,26 @@ foreach($columns as $col => $attr) {
|
||||
$index++;
|
||||
}
|
||||
|
||||
$id_type_web_content_string = db_get_value('id_tipo', 'ttipo_modulo',
|
||||
'nombre', 'web_content_string');
|
||||
|
||||
foreach ($result as $row) {
|
||||
$data = array ();
|
||||
|
||||
$is_web_content_string = (bool)db_get_value_filter('id_agente_modulo',
|
||||
'tagente_modulo',
|
||||
array('id_agente_modulo' => $row['id_agente_modulo'],
|
||||
'id_tipo_modulo' => $id_type_web_content_string));
|
||||
|
||||
foreach($columns as $col => $attr) {
|
||||
if ($attr[1] != "modules_format_data")
|
||||
if ($attr[1] != "modules_format_data") {
|
||||
$data[] = $attr[1] ($row[$attr[0]]);
|
||||
|
||||
// Its a single-data, multiline data (data snapshot) ?
|
||||
|
||||
}
|
||||
elseif (($config['command_snapshot']) && (preg_match ("/[\n]+/i", $row[$attr[0]]))) {
|
||||
// Its a single-data, multiline data (data snapshot) ?
|
||||
|
||||
|
||||
// Detect string data with \n and convert to <br>'s
|
||||
$datos = preg_replace ('/\n/i','<br>',$row[$attr[0]]);
|
||||
@ -252,6 +264,12 @@ foreach ($result as $row) {
|
||||
$data[$attr[1]] = $datos;
|
||||
|
||||
}
|
||||
elseif ($is_web_content_string) {
|
||||
//Fixed the goliat sends the strings from web
|
||||
//without HTML entities
|
||||
|
||||
$data[$attr[1]] = io_safe_input($row[$attr[0]]);
|
||||
}
|
||||
else {
|
||||
// Just a string of alphanumerical data... just do print
|
||||
|
||||
|
@ -295,6 +295,11 @@ $table->align = array("left","left","center","left","left","center");
|
||||
|
||||
$last_modulegroup = 0;
|
||||
$rowIndex = 0;
|
||||
|
||||
|
||||
$id_type_web_content_string = db_get_value('id_tipo', 'ttipo_modulo',
|
||||
'nombre', 'web_content_string');
|
||||
|
||||
foreach ($modules as $module) {
|
||||
//The code add the row of 1 cell with title of group for to be more organice the list.
|
||||
|
||||
@ -310,6 +315,12 @@ foreach ($modules as $module) {
|
||||
}
|
||||
//End of title of group
|
||||
|
||||
//Fixed the goliat sends the strings from web
|
||||
//without HTML entities
|
||||
if ($module['id_tipo_modulo'] == $id_type_web_content_string) {
|
||||
$module['datos'] = io_safe_input($module['datos']);
|
||||
}
|
||||
|
||||
$data = array ();
|
||||
if (($module["id_modulo"] != 1) && ($module["id_tipo_modulo"] != 100)) {
|
||||
if ($module["flag"] == 0) {
|
||||
@ -438,8 +449,15 @@ foreach ($modules as $module) {
|
||||
$salida .= " " . '<i>'. io_safe_output($module["unit"]) . '</i>';
|
||||
}
|
||||
}
|
||||
else {
|
||||
//Fixed the goliat sends the strings from web
|
||||
//without HTML entities
|
||||
if ($module['id_tipo_modulo'] == $id_type_web_content_string) {
|
||||
$module_value = $module["datos"];
|
||||
}
|
||||
else {
|
||||
$module_value = io_safe_output($module["datos"]);
|
||||
}
|
||||
|
||||
// There are carriage returns here ?
|
||||
// If carriage returns present... then is a "Snapshot" data (full command output)
|
||||
@ -453,17 +471,34 @@ foreach ($modules as $module) {
|
||||
|
||||
$salida = '<a href="javascript:'.$link.'">' . html_print_image("images/default_list.png", true, array("border" => '0', "alt" => "", "title" => __("Snapshot view"))) . '</a> ';
|
||||
}
|
||||
else {
|
||||
//Fixed the goliat sends the strings from web
|
||||
//without HTML entities
|
||||
if ($module['id_tipo_modulo'] == $id_type_web_content_string) {
|
||||
$sub_string = substr($module["datos"], 0, 12);
|
||||
}
|
||||
else {
|
||||
$sub_string = substr(io_safe_output($module["datos"]),0, 12);
|
||||
}
|
||||
|
||||
|
||||
if ($module_value == $sub_string) {
|
||||
$salida = $module_value;
|
||||
}
|
||||
else {
|
||||
$salida = "<span id='value_module_" . $module["id_agente_modulo"] . "'
|
||||
title='".$module_value."' style='white-space: nowrap;'>" .
|
||||
'<span id="value_module_text_' . $module["id_agente_modulo"] . '">' . $sub_string . '</span> ' .
|
||||
"<a href='javascript: toggle_full_value(" . $module["id_agente_modulo"] . ")'>" . html_print_image("images/rosette.png", true) . "" . "</span>";
|
||||
$salida = "<span " .
|
||||
"id='hidden_value_module_" . $module["id_agente_modulo"] . "'
|
||||
style='display: none;'>" .
|
||||
$module_value .
|
||||
"</span>" .
|
||||
"<span " .
|
||||
"id='value_module_" . $module["id_agente_modulo"] . "'
|
||||
title='" . $module_value . "' " .
|
||||
"style='white-space: nowrap;'>" .
|
||||
'<span id="value_module_text_' . $module["id_agente_modulo"] . '">' .
|
||||
$sub_string . '</span> ' .
|
||||
"<a href='javascript: toggle_full_value(" . $module["id_agente_modulo"] . ")'>" .
|
||||
html_print_image("images/rosette.png", true) . "</a>" . "</span>";
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -503,11 +538,12 @@ foreach ($modules as $module) {
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
function toggle_full_value(id) {
|
||||
value_title = $("#value_module_" + id).attr('title');
|
||||
text = $("#hidden_value_module_" + id).html();
|
||||
old_text = $("#value_module_text_" + id).html();
|
||||
|
||||
$("#value_module_" + id).attr('title', $("#value_module_text_" + id).html());
|
||||
$("#hidden_value_module_" + id).html(old_text);
|
||||
|
||||
$("#value_module_text_" + id).html(value_title);
|
||||
$("#value_module_text_" + id).html(text);
|
||||
}
|
||||
</script>
|
||||
<?php
|
||||
|
@ -235,7 +235,9 @@ switch ($config["dbtype"]) {
|
||||
|
||||
$order[] = array('field' => 'tagente_modulo.nombre', 'order' => 'ASC');
|
||||
|
||||
$sql = sprintf("SELECT %s FROM tagente_modulo, tagente_estado WHERE %s %s %s %s %s",
|
||||
$sql = sprintf("SELECT %s
|
||||
FROM tagente_modulo, tagente_estado
|
||||
WHERE %s %s %s %s %s",
|
||||
$params, $basic_where, $where, $where_tags, $order_sql, $limit_sql);
|
||||
|
||||
$modules = db_get_all_rows_sql($sql);
|
||||
@ -246,19 +248,25 @@ switch ($config["dbtype"]) {
|
||||
$set = array();
|
||||
$set['limit'] = $limit;
|
||||
$set['offset'] = $offset;
|
||||
$sql = sprintf("SELECT %s FROM tagente_modulo, tagente_estado WHERE %s %s %s %s",
|
||||
$sql = sprintf("SELECT %s
|
||||
FROM tagente_modulo, tagente_estado
|
||||
WHERE %s %s %s %s",
|
||||
$params, $basic_where, $where, $where_tags, $order_sql);
|
||||
|
||||
$modules = oracle_recode_query ($sql, $set, 'AND', false);
|
||||
break;
|
||||
}
|
||||
|
||||
$sql_total_modules = sprintf("SELECT count(*) FROM tagente_modulo, tagente_estado WHERE %s %s %s", $basic_where, $where, $where_tags);
|
||||
$sql_total_modules = sprintf("SELECT count(*)
|
||||
FROM tagente_modulo, tagente_estado
|
||||
WHERE %s %s %s", $basic_where, $where, $where_tags);
|
||||
|
||||
$total_modules = db_get_value_sql($sql_total_modules);
|
||||
$total_modules = isset ($total_modules) ? $total_modules : 0;
|
||||
|
||||
if ($modules === false) {
|
||||
echo "<div class='nf'>".__('This agent doesn\'t have any module')."</div>";
|
||||
echo "<div class='nf'>" .
|
||||
__('This agent doesn\'t have any module') . "</div>";
|
||||
return;
|
||||
}
|
||||
|
||||
@ -298,7 +306,18 @@ echo "</th>";
|
||||
$texto=''; $last_modulegroup = 0;
|
||||
$color = 1;
|
||||
$write = check_acl ($config['id_user'], $agent['id_grupo'], "AW");
|
||||
|
||||
$id_type_web_content_string = db_get_value('id_tipo', 'ttipo_modulo',
|
||||
'nombre', 'web_content_string');
|
||||
|
||||
foreach ($modules as $module) {
|
||||
|
||||
//Fixed the goliat sends the strings from web
|
||||
//without HTML entities
|
||||
if ($module['id_tipo_modulo'] == $id_type_web_content_string) {
|
||||
$module['datos'] = io_safe_input($module['datos']);
|
||||
}
|
||||
|
||||
// Calculate table line color
|
||||
if ($color == 1) {
|
||||
$tdcolor = "datos";
|
||||
@ -470,7 +489,14 @@ foreach ($modules as $module) {
|
||||
|
||||
echo "<td class='".$tdcolor."f9' colspan='" . $colspan . "' title='".io_safe_output($module["datos"])."'>";
|
||||
|
||||
//Fixed the goliat sends the strings from web
|
||||
//without HTML entities
|
||||
if ($module['id_tipo_modulo'] == $id_type_web_content_string) {
|
||||
$module_value = $module["datos"];
|
||||
}
|
||||
else {
|
||||
$module_value = io_safe_output($module["datos"]);
|
||||
}
|
||||
|
||||
// There are carriage returns here ?
|
||||
// If carriage returns present... then is a "Snapshot" data (full command output)
|
||||
@ -484,17 +510,33 @@ foreach ($modules as $module) {
|
||||
|
||||
$out = '<a href="javascript:'.$link.'">' . html_print_image("images/default_list.png", true, array("border" => '0', "alt" => "", "title" => __("Snapshot view"))) . '</a> ';
|
||||
}
|
||||
else {
|
||||
//Fixed the goliat sends the strings from web
|
||||
//without HTML entities
|
||||
if ($module['id_tipo_modulo'] == $id_type_web_content_string) {
|
||||
$sub_string = substr($module["datos"], 0, 12);
|
||||
}
|
||||
else {
|
||||
$sub_string = substr(io_safe_output($module["datos"]),0, 12);
|
||||
}
|
||||
|
||||
if ($module_value == $sub_string) {
|
||||
$out = $module_value;
|
||||
}
|
||||
else {
|
||||
$out = "<span id='value_module_" . $module["id_agente_modulo"] . "'
|
||||
title='".$module_value."' style='white-space: nowrap;'>" .
|
||||
'<span id="value_module_text_' . $module["id_agente_modulo"] . '">' . $sub_string . '</span> ' .
|
||||
"<a href='javascript: toggle_full_value(" . $module["id_agente_modulo"] . ")'>" . html_print_image("images/rosette.png", true) . "" . "</span>";
|
||||
$out = "<span " .
|
||||
"id='hidden_value_module_" . $module["id_agente_modulo"] . "'
|
||||
style='display: none;'>" .
|
||||
$module_value .
|
||||
"</span>" .
|
||||
"<span " .
|
||||
"id='value_module_" . $module["id_agente_modulo"] . "'
|
||||
title='" . $module_value . "' " .
|
||||
"style='white-space: nowrap;'>" .
|
||||
'<span id="value_module_text_' . $module["id_agente_modulo"] . '">' .
|
||||
$sub_string . '</span> ' .
|
||||
"<a href='javascript: toggle_full_value(" . $module["id_agente_modulo"] . ")'>" .
|
||||
html_print_image("images/rosette.png", true) . "</a>" . "</span>";
|
||||
}
|
||||
}
|
||||
|
||||
@ -555,10 +597,11 @@ echo '</table>';
|
||||
|
||||
<script type="text/javascript">
|
||||
function toggle_full_value(id) {
|
||||
value_title = $("#value_module_" + id).attr('title');
|
||||
text = $("#hidden_value_module_" + id).html();
|
||||
old_text = $("#value_module_text_" + id).html();
|
||||
|
||||
$("#value_module_" + id).attr('title', $("#value_module_text_" + id).html());
|
||||
$("#hidden_value_module_" + id).html(old_text);
|
||||
|
||||
$("#value_module_text_" + id).html(value_title);
|
||||
$("#value_module_text_" + id).html(text);
|
||||
}
|
||||
</script>
|
||||
|
@ -39,7 +39,8 @@ $isFunctionPolicies = enterprise_include_once ('include/functions_policies.php')
|
||||
if (! defined ('METACONSOLE')) {
|
||||
//Header
|
||||
ui_print_page_header ("Monitor detail", "images/brick.png", false);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
|
||||
ui_meta_print_header(__("Monitor view"));
|
||||
}
|
||||
@ -210,7 +211,8 @@ switch ($config["dbtype"]) {
|
||||
//The check of is_admin
|
||||
$flag_is_admin = (bool)db_get_value('is_admin', 'tusuario', 'id_user', $config['id_user']);
|
||||
|
||||
$sql = ' SELECT distinct(tagente_modulo.nombre) '. $sql_from . $sql_conditions_acl;
|
||||
$sql = ' SELECT distinct(tagente_modulo.nombre)
|
||||
'. $sql_from . $sql_conditions_acl;
|
||||
break;
|
||||
case "oracle":
|
||||
$profiles = db_get_all_rows_sql('SELECT id_grupo
|
||||
@ -233,7 +235,8 @@ switch ($config["dbtype"]) {
|
||||
$flag_is_admin = (bool)db_get_value('is_admin', 'tusuario',
|
||||
'id_user', $config['id_user']);
|
||||
|
||||
$sql = ' SELECT DISTINCT dbms_lob.substr(nombre,4000,1) AS nombre'. $sql_from . $sql_conditions_acl;
|
||||
$sql = ' SELECT DISTINCT dbms_lob.substr(nombre,4000,1) AS nombre' .
|
||||
$sql_from . $sql_conditions_acl;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -266,13 +269,15 @@ if (defined('METACONSOLE')) {
|
||||
// Get all info for filters of all nodes
|
||||
$modules_temp = db_get_all_rows_sql($sql);
|
||||
|
||||
$tags_temp = db_get_all_rows_sql('SELECT name, name
|
||||
$tags_temp = db_get_all_rows_sql('
|
||||
SELECT name, name
|
||||
FROM ttag
|
||||
WHERE id_tag IN (SELECT ttag_module.id_tag
|
||||
FROM ttag_module)');
|
||||
|
||||
$rows_temp = db_get_all_rows_sql("SELECT distinct name
|
||||
FROM tmodule_group ORDER BY name");
|
||||
FROM tmodule_group
|
||||
ORDER BY name");
|
||||
$rows_temp = io_safe_output($rows_temp);
|
||||
|
||||
if (!empty($rows_temp)) {
|
||||
@ -820,7 +825,21 @@ $table->align[10] = "right";
|
||||
$rowPair = true;
|
||||
$iterator = 0;
|
||||
|
||||
$id_type_web_content_string = db_get_value('id_tipo', 'ttipo_modulo',
|
||||
'nombre', 'web_content_string');
|
||||
|
||||
foreach ($result as $row) {
|
||||
$is_web_content_string = (bool)db_get_value_filter('id_agente_modulo',
|
||||
'tagente_modulo',
|
||||
array('id_agente_modulo' => $row['id_agente_modulo'],
|
||||
'id_tipo_modulo' => $id_type_web_content_string));
|
||||
|
||||
//Fixed the goliat sends the strings from web
|
||||
//without HTML entities
|
||||
if ($is_web_content_string) {
|
||||
$row['datos'] = io_safe_input($row['datos']);
|
||||
}
|
||||
|
||||
if ($rowPair)
|
||||
$table->rowclass[$iterator] = 'rowPair';
|
||||
else
|
||||
@ -893,28 +912,39 @@ foreach ($result as $row) {
|
||||
|
||||
if ($row['utimestamp'] == 0 && (($row['module_type'] < 21 ||
|
||||
$row['module_type'] > 23) && $row['module_type'] != 100)) {
|
||||
$data[6] = ui_print_status_image(STATUS_MODULE_NO_DATA, __('NOT INIT'), true);
|
||||
$data[6] = ui_print_status_image(STATUS_MODULE_NO_DATA,
|
||||
__('NOT INIT'), true);
|
||||
}
|
||||
elseif ($row["estado"] == 0) {
|
||||
$data[6] = ui_print_status_image(STATUS_MODULE_OK, __('NORMAL').": ".$row["datos"], true);
|
||||
$data[6] = ui_print_status_image(STATUS_MODULE_OK,
|
||||
__('NORMAL') . ": " . $row["datos"], true);
|
||||
}
|
||||
elseif ($row["estado"] == 1) {
|
||||
$data[6] = ui_print_status_image(STATUS_MODULE_CRITICAL, __('CRITICAL').": ".$row["datos"], true);
|
||||
$data[6] = ui_print_status_image(STATUS_MODULE_CRITICAL,
|
||||
__('CRITICAL') . ": " . $row["datos"], true);
|
||||
}
|
||||
elseif ($row["estado"] == 2) {
|
||||
$data[6] = ui_print_status_image(STATUS_MODULE_WARNING, __('WARNING').": ".$row["datos"], true);
|
||||
$data[6] = ui_print_status_image(STATUS_MODULE_WARNING,
|
||||
__('WARNING') . ": " . $row["datos"], true);
|
||||
}
|
||||
else {
|
||||
$last_status = modules_get_agentmodule_last_status($row['id_agente_modulo']);
|
||||
$last_status = modules_get_agentmodule_last_status(
|
||||
$row['id_agente_modulo']);
|
||||
switch($last_status) {
|
||||
case 0:
|
||||
$data[6] = ui_print_status_image(STATUS_MODULE_UNKNOWN, __('UNKNOWN')." - ".__('Last status')." ".__('NORMAL').": ".$row["datos"], true);
|
||||
$data[6] = ui_print_status_image(STATUS_MODULE_UNKNOWN,
|
||||
__('UNKNOWN') . " - " . __('Last status') . " " .
|
||||
__('NORMAL') . ": " . $row["datos"], true);
|
||||
break;
|
||||
case 1:
|
||||
$data[6] = ui_print_status_image(STATUS_MODULE_UNKNOWN, __('UNKNOWN')." - ".__('Last status')." ".__('CRITICAL').": ".$row["datos"], true);
|
||||
$data[6] = ui_print_status_image(STATUS_MODULE_UNKNOWN,
|
||||
__('UNKNOWN') . " - " . __('Last status') ." " .
|
||||
__('CRITICAL') . ": " . $row["datos"], true);
|
||||
break;
|
||||
case 2:
|
||||
$data[6] = ui_print_status_image(STATUS_MODULE_UNKNOWN, __('UNKNOWN')." - ".__('Last status')." ".__('WARNING').": ".$row["datos"], true);
|
||||
$data[6] = ui_print_status_image(STATUS_MODULE_UNKNOWN,
|
||||
__('UNKNOWN') . " - " . __('Last status') . " " .
|
||||
__('WARNING') . ": " . $row["datos"], true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -954,23 +984,48 @@ foreach ($result as $row) {
|
||||
$salida = ui_print_truncate_text($salida, 'agent_small', true, true, false, '[…]', 'font-size:7.5pt;');
|
||||
}
|
||||
}
|
||||
else {
|
||||
//Fixed the goliat sends the strings from web
|
||||
//without HTML entities
|
||||
if ($is_web_content_string) {
|
||||
$module_value = $row["datos"];
|
||||
}
|
||||
else {
|
||||
$module_value = io_safe_output($row["datos"]);
|
||||
}
|
||||
|
||||
$sub_string = substr(io_safe_output($row["datos"]), 0, 12);
|
||||
if ($module_value == $sub_string) {
|
||||
$salida = $module_value;
|
||||
}
|
||||
else {
|
||||
if (strlen($module_value) > 35)
|
||||
$mod_val = substr($module_value, 0, 35) . '...';
|
||||
else
|
||||
$mod_val = $module_value;
|
||||
//Fixed the goliat sends the strings from web
|
||||
//without HTML entities
|
||||
if ($is_web_content_string) {
|
||||
$sub_string = substr($row["datos"], 0, 12);
|
||||
}
|
||||
else {
|
||||
$sub_string = substr(io_safe_output($row["datos"]),0, 12);
|
||||
}
|
||||
|
||||
$salida = html_print_input_hidden("value_replace_module_" . $row["id_agente_modulo"], $mod_val, true)
|
||||
. "<span id='value_module_" . $row["id_agente_modulo"] . "'
|
||||
title='". $module_value ."' style='white-space: nowrap;'>" .
|
||||
'<span id="value_module_text_' . $row["id_agente_modulo"] . '">' . $sub_string . '</span> ' .
|
||||
"<a href='javascript: toggle_full_value(" . $row["id_agente_modulo"] . ")'>" . html_print_image("images/rosette.png", true) . "" . "</span>";
|
||||
if ($module_value == $sub_string) {
|
||||
$salida = $module_value;
|
||||
}
|
||||
else {
|
||||
$salida = "<span " .
|
||||
"id='hidden_value_module_" . $row["id_agente_modulo"] . "'
|
||||
style='display: none;'>" .
|
||||
$module_value .
|
||||
"</span>" .
|
||||
"<span " .
|
||||
"id='value_module_" . $row["id_agente_modulo"] . "'
|
||||
title='" . $module_value . "' " .
|
||||
"style='white-space: nowrap;'>" .
|
||||
'<span id="value_module_text_' . $row["id_agente_modulo"] . '">' .
|
||||
$sub_string . '</span> ' .
|
||||
"<a href='javascript: toggle_full_value(" . $row["id_agente_modulo"] . ")'>" .
|
||||
html_print_image("images/rosette.png", true) . "</a>" . "</span>";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1000,10 +1055,11 @@ else {
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
function toggle_full_value(id) {
|
||||
value_title = $("#hidden-value_replace_module_" + id).val();
|
||||
text = $("#hidden_value_module_" + id).html();
|
||||
old_text = $("#value_module_text_" + id).html();
|
||||
|
||||
$("#hidden-value_replace_module_" + id).val($("#value_module_text_" + id).html());
|
||||
$("#hidden_value_module_" + id).html(old_text);
|
||||
|
||||
$("#value_module_text_" + id).html(value_title);
|
||||
$("#value_module_text_" + id).html(text);
|
||||
}
|
||||
</script>
|
@ -196,7 +196,16 @@ else {
|
||||
|
||||
$table->data = array ();
|
||||
|
||||
$id_type_web_content_string = db_get_value('id_tipo', 'ttipo_modulo',
|
||||
'nombre', 'web_content_string');
|
||||
|
||||
foreach ($modules as $module) {
|
||||
//Fixed the goliat sends the strings from web
|
||||
//without HTML entities
|
||||
if ($module['id_tipo_modulo'] == $id_type_web_content_string) {
|
||||
$module['datos'] = io_safe_input($module['datos']);
|
||||
}
|
||||
|
||||
$agentCell = '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=' . $module['id_agente'] . '">' .
|
||||
$module['agent_name'] . '</a>';
|
||||
|
||||
@ -209,28 +218,44 @@ else {
|
||||
($module['id_tipo_modulo'] < 21 || $module['id_tipo_modulo'] > 23) &&
|
||||
$module['id_tipo_modulo'] != 100)
|
||||
) {
|
||||
$statusCell = ui_print_status_image(STATUS_MODULE_NO_DATA, __('NOT INIT'), true);
|
||||
$statusCell = ui_print_status_image(STATUS_MODULE_NO_DATA,
|
||||
__('NOT INIT'), true);
|
||||
}
|
||||
elseif ($module["estado"] == 0) {
|
||||
$statusCell = ui_print_status_image(STATUS_MODULE_OK, __('NORMAL').": ".$module["datos"], true);
|
||||
$statusCell = ui_print_status_image(STATUS_MODULE_OK,
|
||||
__('NORMAL') . ": " . $module["datos"], true);
|
||||
}
|
||||
elseif ($module["estado"] == 1) {
|
||||
$statusCell = ui_print_status_image(STATUS_MODULE_CRITICAL, __('CRITICAL').": ".$module["datos"], true);
|
||||
$statusCell = ui_print_status_image(STATUS_MODULE_CRITICAL,
|
||||
__('CRITICAL') . ": " . $module["datos"], true);
|
||||
}
|
||||
elseif ($module["estado"] == 2) {
|
||||
$statusCell = ui_print_status_image(STATUS_MODULE_WARNING, __('WARNING').": ".$module["datos"], true);
|
||||
$statusCell = ui_print_status_image(STATUS_MODULE_WARNING,
|
||||
__('WARNING') . ": " . $module["datos"], true);
|
||||
}
|
||||
else {
|
||||
$last_status = modules_get_agentmodule_last_status($module['id_agente_modulo']);
|
||||
switch($last_status) {
|
||||
case 0:
|
||||
$statusCell = ui_print_status_image(STATUS_MODULE_OK, __('UNKNOWN')." - ".__('Last status')." ".__('NORMAL').": ".$module["datos"], true);
|
||||
$statusCell = ui_print_status_image(
|
||||
STATUS_MODULE_OK,
|
||||
__('UNKNOWN') . " - " . __('Last status') .
|
||||
" " . __('NORMAL') .": " . $module["datos"],
|
||||
true);
|
||||
break;
|
||||
case 1:
|
||||
$statusCell = ui_print_status_image(STATUS_MODULE_CRITICAL, __('UNKNOWN')." - ".__('Last status')." ".__('CRITICAL').": ".$module["datos"], true);
|
||||
$statusCell = ui_print_status_image(
|
||||
STATUS_MODULE_CRITICAL,
|
||||
__('UNKNOWN') . " - " . __('Last status') .
|
||||
" " . __('CRITICAL') . ": " . $module["datos"],
|
||||
true);
|
||||
break;
|
||||
case 2:
|
||||
$statusCell = ui_print_status_image(STATUS_MODULE_WARNING, __('UNKNOWN')." - ".__('Last status')." ".__('WARNING').": ".$module["datos"], true);
|
||||
$statusCell = ui_print_status_image(
|
||||
STATUS_MODULE_WARNING,
|
||||
__('UNKNOWN') . " - " . __('Last status') .
|
||||
" " . __('WARNING') . ": " . $module["datos"],
|
||||
true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -251,10 +276,61 @@ else {
|
||||
$graphCell .= " <a href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=".$module["id_agente"]."&tab=data_view&period=86400&id=".$module["id_agente_modulo"]."'>" . html_print_image('images/binary.png', true, array("border" => "0", "alt" => "")) . "</a>";
|
||||
}
|
||||
|
||||
if (is_numeric($module["datos"]))
|
||||
if (is_numeric($module["datos"])) {
|
||||
$dataCell = format_numeric($module["datos"]);
|
||||
else
|
||||
$dataCell = "<span title='" . $module['datos'] . "' style='white-space: nowrap;'>".substr(io_safe_output($module["datos"]),0,12)."</span>";
|
||||
}
|
||||
else {
|
||||
//Fixed the goliat sends the strings from web
|
||||
//without HTML entities
|
||||
if ($module['id_tipo_modulo'] == $id_type_web_content_string) {
|
||||
$module_value = $module["datos"];
|
||||
}
|
||||
else {
|
||||
$module_value = io_safe_output($module["datos"]);
|
||||
}
|
||||
|
||||
// There are carriage returns here ?
|
||||
// If carriage returns present... then is a "Snapshot" data (full command output)
|
||||
if (($config['command_snapshot']) && (preg_match ("/[\n]+/i", io_safe_output($module["datos"])))) {
|
||||
|
||||
$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)";
|
||||
|
||||
$dataCell = '<a href="javascript:'.$link.'">' . html_print_image("images/default_list.png", true, array("border" => '0', "alt" => "", "title" => __("Snapshot view"))) . '</a> ';
|
||||
}
|
||||
else {
|
||||
//Fixed the goliat sends the strings from web
|
||||
//without HTML entities
|
||||
if ($module['id_tipo_modulo'] == $id_type_web_content_string) {
|
||||
$sub_string = substr($module["datos"], 0, 12);
|
||||
}
|
||||
else {
|
||||
$sub_string = substr(io_safe_output($module["datos"]),0, 12);
|
||||
}
|
||||
|
||||
if ($module_value == $sub_string) {
|
||||
$dataCell = $module_value;
|
||||
}
|
||||
else {
|
||||
$dataCell = "<span " .
|
||||
"id='hidden_value_module_" . $module["id_agente_modulo"] . "'
|
||||
style='display: none;'>" .
|
||||
$module_value .
|
||||
"</span>" .
|
||||
"<span " .
|
||||
"id='value_module_" . $module["id_agente_modulo"] . "'
|
||||
title='" . $module_value . "' " .
|
||||
"style='white-space: nowrap;'>" .
|
||||
'<span id="value_module_text_' . $module["id_agente_modulo"] . '">' .
|
||||
$sub_string . '</span> ' .
|
||||
"<a href='javascript: toggle_full_value(" . $module["id_agente_modulo"] . ")'>" .
|
||||
html_print_image("images/rosette.png", true) . "</a>" . "</span>";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($module['estado'] == 3) {
|
||||
$option = array ("html_attr" => 'class="redb"');
|
||||
@ -301,3 +377,14 @@ else {
|
||||
ui_pagination ($totalModules);
|
||||
}
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
function toggle_full_value(id) {
|
||||
text = $("#hidden_value_module_" + id).html();
|
||||
old_text = $("#value_module_text_" + id).html();
|
||||
|
||||
$("#hidden_value_module_" + id).html(old_text);
|
||||
|
||||
$("#value_module_text_" + id).html(text);
|
||||
}
|
||||
</script>
|
Loading…
x
Reference in New Issue
Block a user