2013-04-10 Sergio Martin <sergio.martin@artica.es>
* D operation/agentes/estado_ultimopaquete.php M operation/agentes/ver_agente.php: Restore a bad merged file from last commit and delete unused file git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7952 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
0e9b89991f
commit
826cfdaf8c
|
@ -1,3 +1,9 @@
|
|||
2013-04-10 Sergio Martin <sergio.martin@artica.es>
|
||||
|
||||
* D operation/agentes/estado_ultimopaquete.php
|
||||
M operation/agentes/ver_agente.php: Restore a bad merged
|
||||
file from last commit and delete unused file
|
||||
|
||||
2013-04-10 Sergio Martin <sergio.martin@artica.es>
|
||||
|
||||
*
|
||||
|
|
|
@ -1,614 +0,0 @@
|
|||
<?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.
|
||||
|
||||
global $config;
|
||||
|
||||
check_login();
|
||||
|
||||
if (isset($_GET["id_agente"])){
|
||||
$id_agente = $_GET["id_agente"];
|
||||
}
|
||||
|
||||
include_once($config['homedir'] . "/include/functions_modules.php");
|
||||
|
||||
// View last data packet
|
||||
// Get timestamp of last packet
|
||||
$agent = db_get_row ('tagente', 'id_agente', $id_agente,
|
||||
array ('ultimo_contacto_remoto',
|
||||
'ultimo_contacto',
|
||||
'intervalo',
|
||||
'id_grupo'));
|
||||
$timestamp_ref = $agent["ultimo_contacto_remoto"];
|
||||
$timestamp_lof = $agent["ultimo_contacto"];
|
||||
$intervalo_agente = $agent["intervalo"];
|
||||
|
||||
// Get last packet (DEPRECATED CODE???)
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
case "postgresql":
|
||||
$sql3 = 'SELECT * FROM tagente_modulo, tagente_estado
|
||||
WHERE tagente_modulo.disabled = 0
|
||||
AND tagente_modulo.id_agente = ' . $id_agente.
|
||||
' AND tagente_estado.utimestamp != 0
|
||||
AND tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo
|
||||
ORDER BY id_module_group, nombre';
|
||||
break;
|
||||
case "oracle":
|
||||
$sql3 = 'SELECT * FROM tagente_modulo, tagente_estado
|
||||
WHERE tagente_modulo.disabled = 0
|
||||
AND tagente_modulo.id_agente = ' . $id_agente.
|
||||
' AND tagente_estado.utimestamp != 0
|
||||
AND tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo
|
||||
ORDER BY id_module_group, dbms_lob.substr(nombre,4000,1)';
|
||||
break;
|
||||
}
|
||||
$label_group = 0;
|
||||
$last_label = "";
|
||||
|
||||
|
||||
$sortField = get_parameter('sort_field');
|
||||
$search_string = io_safe_output(urldecode(trim(get_parameter ("search_string", ""))));
|
||||
$sort = get_parameter('sort', 'none');
|
||||
$selected = 'border: 1px solid black;';
|
||||
$url = 'index.php?sec=estado&sec2=operation/agentes/ver_agente&tab=data&id_agente=' . $id_agente;
|
||||
$selectNameUp = '';
|
||||
$selectNameDown = '';
|
||||
$selectTypeUp = '';
|
||||
$selectTypeDown = '';
|
||||
$selectIntervalUp = '';
|
||||
$selectIntervalDown = '';
|
||||
$selectTimestampUp = '';
|
||||
$selectTimestampDown = '';
|
||||
$selectDataUp = '';
|
||||
$selectDataDown = '';
|
||||
|
||||
$order[] = array('field' => 'id_module_group', 'order' => 'ASC');
|
||||
|
||||
switch ($sortField) {
|
||||
case 'name':
|
||||
switch ($sort) {
|
||||
case 'up':
|
||||
$selectNameUp = $selected;
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
case "postgresql":
|
||||
$order[] = array('field' => 'tagente_modulo.nombre', 'order' => 'ASC');
|
||||
break;
|
||||
case "oracle":
|
||||
$order[] = array('field' => 'dbms_lob.substr(tagente_modulo.nombre,4000,1)', 'order' => 'ASC');
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'down':
|
||||
$selectNameDown = $selected;
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
case "postgresql":
|
||||
$order[] = array('field' => 'tagente_modulo.nombre', 'order' => 'DESC');
|
||||
break;
|
||||
case "oracle":
|
||||
$order[] = array('field' => 'dbms_lob.substr(tagente_modulo.nombre,4000,1)', 'order' => 'DESC');
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'type':
|
||||
switch ($sort) {
|
||||
case 'up':
|
||||
$selectTypeUp = $selected;
|
||||
$order[] = array('field' => 'tagente_modulo.id_tipo_modulo', 'order' => 'ASC');
|
||||
break;
|
||||
case 'down':
|
||||
$selectTypeDown = $selected;
|
||||
$order[] = array('field' => 'tagente_modulo.id_tipo_modulo', 'order' => 'DESC');
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'interval':
|
||||
switch ($sort) {
|
||||
case 'up':
|
||||
$selectIntervalUp = $selected;
|
||||
$order[] = array('field' => 'tagente_modulo.module_interval', 'order' => 'ASC');
|
||||
break;
|
||||
case 'down':
|
||||
$selectIntervalDown = $selected;
|
||||
$order[] = array('field' => 'tagente_modulo.module_interval', 'order' => 'DESC');
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'timestamp':
|
||||
switch ($sort) {
|
||||
case 'up':
|
||||
$selectTimestampUp = $selected;
|
||||
$order[] = array('field' => 'tagente_estado.utimestamp', 'order' => 'ASC');
|
||||
break;
|
||||
case 'down':
|
||||
$selectTimestampDown = $selected;
|
||||
$order[] = array('field' => 'tagente_estado.utimestamp', 'order' => 'DESC');
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'data':
|
||||
switch ($sort) {
|
||||
case 'up':
|
||||
$selectDataUp = $selected;
|
||||
$order[] = array('field' => 'tagente_estado.datos', 'order' => 'ASC');
|
||||
break;
|
||||
case 'down':
|
||||
$selectDataDown = $selected;
|
||||
$order[] = array('field' => 'tagente_estado.datos', 'order' => 'DESC');
|
||||
break;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
default:
|
||||
$selectNameUp = $selected;
|
||||
$selectNameDown = '';
|
||||
$selectTypeUp = '';
|
||||
$selectTypeDown = '';
|
||||
$selectIntervalUp = '';
|
||||
$selectIntervalDown = '';
|
||||
$selectTimestampUp = '';
|
||||
$selectTimestampDown = '';
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
case "postgresql":
|
||||
$order[] = array('field' => 'tagente_modulo.nombre', 'order' => 'ASC');
|
||||
break;
|
||||
case "oracle":
|
||||
$order[] = array('field' => 'dbms_lob.substr(tagente_modulo.nombre,4000,1)', 'order' => 'ASC');
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// Build the order sql
|
||||
if (!empty($order)) {
|
||||
$order_sql = ' ORDER BY ';
|
||||
}
|
||||
$first = true;
|
||||
foreach ($order as $ord) {
|
||||
if ($first) {
|
||||
$first = false;
|
||||
}
|
||||
else {
|
||||
$order_sql .= ',';
|
||||
}
|
||||
|
||||
$order_sql .= $ord['field'].' '.$ord['order'];
|
||||
}
|
||||
|
||||
// Filter form
|
||||
|
||||
$table->width = "98%";
|
||||
$table->cellpadding = 4;
|
||||
$table->cellspacing = 4;
|
||||
$table->class = "databox";
|
||||
$table->size[0] = "230px";
|
||||
$table->head = array ();
|
||||
$table->data = array ();
|
||||
|
||||
$table->data[0][0] = __('Search').':';
|
||||
$table->data[0][0] .= html_print_input_text ('search_string', $search_string, '', 15, 255, true);
|
||||
$table->data[0][1] = html_print_submit_button (__('Filter'), 'filter', false, 'class="sub search"', true);
|
||||
|
||||
echo "<form method='post' action='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=$id_agente&tab=data&sort_field=&sort=none&offset=0'>";
|
||||
html_print_table($table);
|
||||
echo "</form>";
|
||||
|
||||
unset($table);
|
||||
|
||||
// Get limit and offset parameters
|
||||
$limit = (int) $config["block_size"];
|
||||
$offset = (int) get_parameter ('offset');
|
||||
|
||||
$params = implode(',', array ('*'));
|
||||
|
||||
$where = sprintf("(tagente_modulo.id_policy_module = 0 AND disabled = 0 AND tagente_estado.utimestamp !=0 AND tagente_modulo.id_agente = %s AND delete_pending = 0)", $id_agente);
|
||||
|
||||
$search_string_entities = io_safe_input($search_string);
|
||||
|
||||
$basic_where = sprintf(" tagente_estado.utimestamp !=0 AND tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo AND (nombre LIKE '%%%s%%' OR nombre LIKE '%%%s%%' OR descripcion LIKE '%%%s%%' OR descripcion LIKE '%%%s%%') AND", $search_string, $search_string_entities, $search_string, $search_string_entities);
|
||||
|
||||
$where_tags = tags_get_acl_tags($config['id_user'], $agent['id_grupo'], 'AR', 'module_condition', 'AND', 'tagente_modulo');
|
||||
|
||||
switch ($config["dbtype"]) {
|
||||
case "postgresql":
|
||||
$limit_sql = " LIMIT $limit OFFSET $offset ";
|
||||
case "mysql":
|
||||
if (!isset($limit_sql)) {
|
||||
$limit_sql = " LIMIT $offset, $limit ";
|
||||
}
|
||||
|
||||
$order[] = array('field' => 'tagente_modulo.nombre', 'order' => 'ASC');
|
||||
|
||||
$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);
|
||||
break;
|
||||
case "oracle":
|
||||
$order[] = array('field' => 'dbms_lob.substr(tagente_modulo.nombre,4000,1)', 'order' => 'ASC');
|
||||
|
||||
$set = array();
|
||||
$set['limit'] = $limit;
|
||||
$set['offset'] = $offset;
|
||||
$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);
|
||||
|
||||
$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>";
|
||||
return;
|
||||
}
|
||||
|
||||
// Prepare pagination
|
||||
ui_pagination ($total_modules, ui_get_url_refresh (array ('id_agente' => $id_agente, 'tab' => 'data','sort_field' => $sortField, 'sort' => $sort, 'search_string' => urlencode($search_string))));
|
||||
|
||||
$isFunctionPolicies = enterprise_include_once ('include/functions_policies.php');
|
||||
|
||||
echo "<table width='98%' cellpadding='3' cellspacing='3' class='databox'>";
|
||||
echo "<th><span title='" . __('Force execution') . "'>".__('F.')."</span></th>";
|
||||
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
|
||||
echo "<th><span title='" . __('Policy') . "'>".__('P.')."</span></th>";
|
||||
}
|
||||
echo "<th>".__('Module name') . ' ' .
|
||||
'<a href="' . $url . '&sort_field=name&sort=up">' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp, "alt" => "up")) . '</a>' .
|
||||
'<a href="' . $url . '&sort_field=name&sort=down">' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown, "alt" => "down")) . '</a>';
|
||||
echo "</th>";
|
||||
echo "<th>".__('Type') . ' ' .
|
||||
'<a href="' . $url . '&sort_field=type&sort=up">' . html_print_image("images/sort_up.png", true, array("style" => $selectTypeUp, "alt" => "up")) . '</a>' .
|
||||
'<a href="' . $url . '&sort_field=type&sort=down">' . html_print_image("images/sort_down.png", true, array("style" => $selectTypeDown, "alt" => "down")) . '</a>';
|
||||
echo "</th>";
|
||||
echo "<th>".__('int') . ' ' .
|
||||
'<a href="' . $url . '&sort_field=interval&sort=up">' . html_print_image("images/sort_up.png", true, array("style" => $selectIntervalUp, "alt" => "up")) . '</a>' .
|
||||
'<a href="' . $url . '&sort_field=interval&sort=down">' . html_print_image("images/sort_down.png", true, array("style" => $selectIntervalDown, "alt" => "down")) . '</a>';
|
||||
echo "</th>";
|
||||
echo "<th>".__('Description') . "</th>";
|
||||
echo "<th>".__('Data') . ' ' .
|
||||
'<a href="' . $url . '&sort_field=data&sort=up">' . html_print_image("images/sort_up.png", true, array("style" => $selectDataUp, "alt" => "up")) . '</a>' .
|
||||
'<a href="' . $url . '&sort_field=data&sort=down">' . html_print_image("images/sort_down.png", true, array("style" => $selectDataDown, "alt" => "down")) . '</a>';
|
||||
echo "</th>";
|
||||
echo "<th>".__('Graph')."</th>";
|
||||
echo "<th>".__('Raw Data')."</th>";
|
||||
echo "<th>".__('Timestamp') . ' ' .
|
||||
'<a href="' . $url . '&sort_field=timestamp&sort=up">' . html_print_image("images/sort_up.png", true, array("style" => $selectTimestampUp, "alt" => "up")) . '</a>' .
|
||||
'<a href="' . $url . '&sort_field=timestamp&sort=down">' . html_print_image("images/sort_down.png", true, array("style" => $selectTimestampDown, "alt" => "down")) . '</a>';
|
||||
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";
|
||||
$color = 0;
|
||||
}
|
||||
else {
|
||||
$tdcolor = "datos2";
|
||||
$color = 1;
|
||||
}
|
||||
|
||||
if ($module["id_module_group"] != $last_modulegroup ) {
|
||||
// Render module group names (fixed code)
|
||||
$nombre_grupomodulo = modules_get_modulegroup_name ($module["id_module_group"]);
|
||||
$last_modulegroup = $module["id_module_group"];
|
||||
$colspan = 9 + (int)$isFunctionPolicies;
|
||||
echo "<tr><td class='datos3' align='center' colspan='".$colspan."'>
|
||||
<b>".$nombre_grupomodulo."</b></td></tr>";
|
||||
}
|
||||
|
||||
// Begin to render data ...
|
||||
echo "<tr><td class='$tdcolor'>";
|
||||
// Render network exec module button, only when
|
||||
// Agent Write for this module and group, is given
|
||||
// Is a network module
|
||||
// Has flag = 0
|
||||
if ($write && $module["id_modulo"] > 1 && $module["id_tipo_modulo"] < 100) {
|
||||
if ($module["flag"] == 0) {
|
||||
echo "<a href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=".$id_agente."&id_agente_modulo=".$module["id_agente_modulo"]."&flag=1&tab=data&refr=60'>" . html_print_image('images/target.png', true, array("border" => '0', "alt" => __('Force'))) . "</a>";
|
||||
}
|
||||
else {
|
||||
echo "<a href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=".$id_agente."&id_agente_modulo=".$module["id_agente_modulo"]."&tab=data&refr=60'>" . html_print_image('images/refresh.png', true, array("border" => '0', "alt" => '')) . "</a>";
|
||||
}
|
||||
}
|
||||
echo "</td>";
|
||||
|
||||
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
|
||||
if ($module["id_policy_module"] != 0) {
|
||||
$linked = policies_is_module_linked($module['id_agente_modulo']);
|
||||
$id_policy = db_get_value_sql('SELECT id_policy
|
||||
FROM tpolicy_modules
|
||||
WHERE id = '.$module["id_policy_module"]);
|
||||
$name_policy = db_get_value_sql('SELECT name
|
||||
FROM tpolicies
|
||||
WHERE id = '.$id_policy);
|
||||
$policyInfo = policies_info_module_policy($module["id_policy_module"]);
|
||||
|
||||
$adopt = false;
|
||||
if (policies_is_module_adopt($module['id_agente_modulo'])) {
|
||||
$adopt = true;
|
||||
}
|
||||
|
||||
if ($linked) {
|
||||
if ($adopt) {
|
||||
$img = 'images/policies_brick.png';
|
||||
$title = __('(Adopt) ') . $name_policy;
|
||||
}
|
||||
else {
|
||||
$img = 'images/policies.png';
|
||||
$title = $name_policy;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ($adopt) {
|
||||
$img = 'images/policies_not_brick.png';
|
||||
$title = __('(Unlinked) (Adopt) ') . $name_policy;
|
||||
}
|
||||
else {
|
||||
$img = 'images/unlinkpolicy.png';
|
||||
$title = __('(Unlinked) ') . $name_policy;
|
||||
}
|
||||
}
|
||||
|
||||
echo "<td>";
|
||||
|
||||
echo'<a href="?sec=gpolicies&sec2=enterprise/godmode/policies/policies&id=' . $id_policy . '">' .
|
||||
html_print_image($img,true, array('title' => $title)) .
|
||||
'</a>';
|
||||
echo "</td>";
|
||||
}
|
||||
else {
|
||||
echo "<td></td>";
|
||||
}
|
||||
}
|
||||
$nombre_grupomodulo = modules_get_modulegroup_name ($module["id_module_group"]);
|
||||
if ($nombre_grupomodulo != "") {
|
||||
// Show label module group
|
||||
if (($label_group == 0) || ($last_label != $nombre_grupomodulo)) {
|
||||
$label_group = -1;
|
||||
$last_label = $nombre_grupomodulo;
|
||||
$texto = $texto. "
|
||||
<td class='$tdcolor' align='center' colspan='7'>
|
||||
<b><span style='font-size: 7.5pt'>".$nombre_grupomodulo."</span></b></td>";
|
||||
}
|
||||
}
|
||||
$nombre_tipo_modulo = modules_get_moduletype_name ($module["id_tipo_modulo"]);
|
||||
echo "<td class='".$tdcolor."_id' title='".io_safe_output($module["nombre"])."'>";
|
||||
if ($module['quiet']) {
|
||||
html_print_image("images/dot_green.disabled.png", false, array("border" => '0', "title" => __('Quiet'), "alt" => ""));
|
||||
echo " ";
|
||||
}
|
||||
ui_print_string_substr ($module["nombre"], 35, false, 10);
|
||||
echo "</td><td class='".$tdcolor."'> ";
|
||||
|
||||
ui_print_moduletype_icon ($module["id_tipo_modulo"]);
|
||||
echo "</td><td class='".$tdcolor."'>";
|
||||
|
||||
if ($module["module_interval"] != 0){
|
||||
echo $module["module_interval"];
|
||||
$real_interval = $module["module_interval"];
|
||||
}
|
||||
else {
|
||||
echo $intervalo_agente;
|
||||
$real_interval = $intervalo_agente;
|
||||
}
|
||||
|
||||
if (($module["id_tipo_modulo"] != 3)
|
||||
AND ($module["id_tipo_modulo"] != 10)
|
||||
AND ($module["id_tipo_modulo"] != 17)
|
||||
AND ($module["id_tipo_modulo"] != 23)) {
|
||||
echo "</td><td class='".$tdcolor."f9' title='".io_safe_output($module["descripcion"])."'>";
|
||||
echo ui_print_truncate_text(io_safe_output($module["descripcion"]), 'description', false);
|
||||
echo "</td>";
|
||||
}
|
||||
else {
|
||||
echo "<td></td>";
|
||||
}
|
||||
|
||||
if ($module["id_tipo_modulo"] == 24) { // Log4x
|
||||
echo "<td class='".$tdcolor."f9' colspan='1'> </td>";
|
||||
echo "<td class='".$tdcolor."f9' colspan='1'> x</td>";
|
||||
|
||||
switch ($module["datos"]) {
|
||||
case 10:
|
||||
echo "<td class=$tdcolor style='color:darkgreen; font-weight:bold;'>".__('TRACE')."</td>";
|
||||
break;
|
||||
case 20:
|
||||
echo "<td class=$tdcolor style='color:darkgreen; font-weight:bold;'>".__('DEBUG')."</td>";
|
||||
break;
|
||||
case 30:
|
||||
echo "<td class=$tdcolor style='color:darkgreen; font-weight:bold;'>".__('INFO')."</td>";
|
||||
break;
|
||||
case 40:
|
||||
echo "<td class=$tdcolor style='color:darkorange; font-weight:bold;'>".__('WARN')."</td>";
|
||||
break;
|
||||
case 50:
|
||||
echo "<td class=$tdcolor style='color:red; font-weight:bold;'>".__('ERROR')."</td>";
|
||||
break;
|
||||
case 60:
|
||||
echo "<td class=$tdcolor style='color:red; font-weight:bold;'>".__('FATAL')."</td>";
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
else if (($module["id_tipo_modulo"] == 100) OR ($module['history_data'] == 0)) {
|
||||
echo "<td class='".$tdcolor."f9' colspan='2' title='".$module["datos"]."'>";
|
||||
echo substr(io_safe_output($module["datos"]),0,12);
|
||||
}
|
||||
else {
|
||||
$graph_type = return_graphtype ($module["id_tipo_modulo"]);
|
||||
|
||||
if ((is_numeric($module["datos"])) && !modules_is_string_type($module['id_tipo_modulo'])) {
|
||||
echo "<td class=".$tdcolor.">";
|
||||
echo format_for_graph($module["datos"]);
|
||||
}
|
||||
else {
|
||||
|
||||
if (strlen($module["datos"]) > 0 ) $colspan = /*2*/ 1;
|
||||
else $colspan= 1;
|
||||
|
||||
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)
|
||||
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)";
|
||||
|
||||
$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 {
|
||||
//Fixed the data from Selenium Plugin
|
||||
if ($module_value != strip_tags($module_value)) {
|
||||
$module_value = io_safe_input($module_value);
|
||||
$sub_string = substr($module_value,0, 12);
|
||||
}
|
||||
else {
|
||||
$sub_string = substr(io_safe_output($module_value),0, 12);
|
||||
}
|
||||
}
|
||||
|
||||
if ($module_value == $sub_string) {
|
||||
$out = $module_value;
|
||||
}
|
||||
else {
|
||||
$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>";
|
||||
}
|
||||
}
|
||||
|
||||
echo $out;
|
||||
}
|
||||
echo "</td>";
|
||||
|
||||
$handle = "stat".$nombre_tipo_modulo."_".$module["id_agente_modulo"];
|
||||
$url = 'include/procesos.php?agente='.$module["id_agente_modulo"];
|
||||
$win_handle=dechex(crc32($module["id_agente_modulo"].$module["nombre"]));
|
||||
echo "<td class=".$tdcolor." width='78'>";
|
||||
$graph_label = io_safe_output($module["nombre"]);
|
||||
|
||||
echo "<a href='javascript:" .
|
||||
"winopeng(\"operation/agentes/stat_win.php?type=$graph_type&period=" . SECONDS_1MONTH . "&id=".$module["id_agente_modulo"]."&label=".base64_encode($graph_label)."&refresh=" . SECONDS_10MINUTES . "\", \"month_".$win_handle."\")'>" . html_print_image('images/grafica_m.png' , true, array("border" => '0', "alt" => '')) . "</a> ";
|
||||
|
||||
$link ="winopeng(" .
|
||||
"'operation/agentes/stat_win.php?type=$graph_type&period=" . SECONDS_1WEEK . "&id=".$module["id_agente_modulo"]."&label=".base64_encode($graph_label)."&refresh=" . SECONDS_10MINUTES . "','week_".$win_handle."')";
|
||||
echo '<a href="javascript:'.$link.'">' . html_print_image("images/grafica_w.png", true, array("border" => '0', "alt" => '')) . '</a> ';
|
||||
|
||||
$link ="winopeng(" .
|
||||
"'operation/agentes/stat_win.php?type=$graph_type&period=" . SECONDS_1DAY . "&id=".$module["id_agente_modulo"]."&label=".base64_encode($graph_label)."&refresh=" . SECONDS_10MINUTES . "','day_".$win_handle."')";
|
||||
echo '<a href="javascript:'.$link.'">' . html_print_image("images/grafica_d.png", true, array("border" => '0', "alt" => '')) . '</a> ';
|
||||
|
||||
$link ="winopeng(" .
|
||||
"'operation/agentes/stat_win.php?type=$graph_type&period=" . SECONDS_1HOUR . "&id=".$module["id_agente_modulo"]."&label=".base64_encode($graph_label)."&refresh=" . SECONDS_10MINUTES . "','hour_".$win_handle."')";
|
||||
echo '<a href="javascript:'.$link.'">' . html_print_image("images/grafica_h.png", true, array("border" => '0', "alt" => "")) . '</a>';
|
||||
}
|
||||
|
||||
|
||||
if ($module['history_data'] == 1) {
|
||||
// RAW Table data
|
||||
echo "<td class=".$tdcolor." width=70>";
|
||||
echo "<a href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=$id_agente&tab=data_view&period=" . SECONDS_1MONTH . "&id=".$module["id_agente_modulo"]."'>" . html_print_image('images/data_m.png', true, array("border" => '0', "alt" => '')) . "</a> ";
|
||||
echo "<a href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=$id_agente&tab=data_view&period=" . SECONDS_1WEEK . "&id=".$module["id_agente_modulo"]."'>" . html_print_image('images/data_w.png', true, array("border" => '0', "alt" => '')) . "</a> ";
|
||||
echo "<a href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=$id_agente&tab=data_view&period=" . SECONDS_1DAY ."&id=".$module["id_agente_modulo"]."'>" . html_print_image('images/data_d.png', true, array("border" => '0', "alt" => '')) . "</a>";
|
||||
}
|
||||
else {
|
||||
echo "<td class=".$tdcolor."></td>";
|
||||
}
|
||||
|
||||
echo "<td class='".$tdcolor."f9'>";
|
||||
if ($module["utimestamp"] != 0){
|
||||
$seconds = get_system_time () - $module["utimestamp"];
|
||||
if ($module['id_tipo_modulo'] < 21 && $module["module_interval"] > 0 && $module["utimestamp"] > 0 && $seconds >= ($module["module_interval"] * 2)) {
|
||||
echo '<span class="redb">';
|
||||
}
|
||||
else {
|
||||
echo '<span>';
|
||||
}
|
||||
}
|
||||
ui_print_timestamp ($module["utimestamp"], false);
|
||||
echo '</span>';
|
||||
echo "</td></tr>";
|
||||
}
|
||||
echo '</table>';
|
||||
?>
|
||||
|
||||
<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>
|
|
@ -692,12 +692,14 @@ if (check_acl ($config['id_user'],$id_grupo, "AW") || $is_extra) {
|
|||
$managetab['active'] = true;
|
||||
else
|
||||
$managetab['active'] = false;
|
||||
|
||||
$managetab['godmode'] = 1;
|
||||
}
|
||||
|
||||
|
||||
/* Main tab */
|
||||
$maintab['text'] = '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$id_agente.'">'
|
||||
. html_print_image("images/monitor.png", true, array("title" => __('Main')))
|
||||
. html_print_image("images/agent_mc.png", true, array("title" => __('Main')))
|
||||
. '</a>';
|
||||
if ($tab == 'main')
|
||||
$maintab['active'] = true;
|
||||
|
@ -705,28 +707,15 @@ else
|
|||
$maintab['active'] = false;
|
||||
|
||||
|
||||
/* Data */
|
||||
$datatab['text']= '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$id_agente.'&tab=data">'
|
||||
. html_print_image("images/lightbulb.png", true, array("title" => __('Data')))
|
||||
. '</a>';
|
||||
|
||||
if (($tab == 'data') OR ($tab == 'data_view'))
|
||||
$datatab['active'] = true;
|
||||
else
|
||||
$datatab['active'] = false;
|
||||
|
||||
|
||||
/* Alert tab */
|
||||
$alerttab['text'] = '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$id_agente.'&tab=alert">'
|
||||
. html_print_image("images/bell.png", true, array("title" => __('Alerts')))
|
||||
. html_print_image("images/op_alerts.png", true, array("title" => __('Alerts')))
|
||||
. '</a>';
|
||||
if ($tab == 'alert')
|
||||
$alerttab['active'] = true;
|
||||
else
|
||||
$alerttab['active'] = false;
|
||||
|
||||
|
||||
|
||||
/* Inventory */
|
||||
$inventorytab = enterprise_hook ('inventory_tab');
|
||||
if ($inventorytab == -1)
|
||||
|
@ -744,19 +733,11 @@ $policyTab = enterprise_hook('policy_tab');
|
|||
if ($policyTab == -1)
|
||||
$policyTab = "";
|
||||
|
||||
|
||||
/* Group tab */
|
||||
$grouptab['text']= '<a href="index.php?sec=estado&sec2=operation/agentes/estado_agente&group_id='.$id_grupo.'">'
|
||||
. html_print_image("images/agents_group.png", true, array( "title" => __('Group')))
|
||||
. '</a>';
|
||||
$grouptab['active']=false;
|
||||
|
||||
|
||||
/* GIS tab */
|
||||
$gistab="";
|
||||
if ($config['activate_gis']) {
|
||||
$gistab['text'] = '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&tab=gis&id_agente='.$id_agente.'">'
|
||||
.html_print_image("images/world.png", true, array( "title" => __('GIS data')))
|
||||
.html_print_image("images/op_gis.png", true, array( "title" => __('GIS data')))
|
||||
.'</a>';
|
||||
|
||||
if ($tab == 'gis')
|
||||
|
@ -794,7 +775,7 @@ else
|
|||
|
||||
/* Custom fields tab */
|
||||
$custom_fields['text'] = '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&tab=custom_fields&id_agente='.$id_agente.'">'
|
||||
. html_print_image("images/note.png", true, array("title" => __('Custom fields')))
|
||||
. html_print_image("images/custom_field.png", true, array("title" => __('Custom fields')))
|
||||
. '</a>';
|
||||
if ($tab == 'custom_fields') {
|
||||
$custom_fields['active'] = true;
|
||||
|
@ -806,7 +787,7 @@ else {
|
|||
|
||||
/* Graphs tab */
|
||||
$graphs['text'] = '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&tab=graphs&id_agente='.$id_agente.'">'
|
||||
. html_print_image("images/chart_curve.png", true, array("title" => __('Graphs')))
|
||||
. html_print_image("images/chart.png", true, array("title" => __('Graphs')))
|
||||
. '</a>';
|
||||
if ($tab == 'graphs') {
|
||||
$graphs['active'] = true;
|
||||
|
@ -817,13 +798,10 @@ else {
|
|||
|
||||
|
||||
$onheader = array('manage' => $managetab,
|
||||
'separator' => "",
|
||||
'main' => $maintab,
|
||||
'data' => $datatab,
|
||||
'alert' => $alerttab,
|
||||
'inventory' => $inventorytab,
|
||||
'collection' => $collectiontab,
|
||||
'group' => $grouptab,
|
||||
'gis' => $gistab,
|
||||
'custom' => $custom_fields,
|
||||
'graphs' => $graphs,
|
||||
|
@ -952,9 +930,6 @@ switch ($tab) {
|
|||
case "data_view":
|
||||
require ("datos_agente.php");
|
||||
break;
|
||||
case "data":
|
||||
require ("estado_ultimopaquete.php");
|
||||
break;
|
||||
case "alert":
|
||||
require ("alerts_status.php");
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue