2016-02-04 13:11:14 +01:00
|
|
|
<?php
|
|
|
|
// Pandora FMS - http://pandorafms.com
|
|
|
|
// ==================================================
|
|
|
|
// Copyright (c) 2005-2012 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 Lesser General Public License
|
|
|
|
// as published by the Free Software Foundation; 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.
|
|
|
|
|
|
|
|
// Only accesible by ajax
|
|
|
|
if (is_ajax ()) {
|
|
|
|
global $config;
|
2016-02-25 16:38:20 +01:00
|
|
|
|
2016-02-04 13:11:14 +01:00
|
|
|
// Login check
|
|
|
|
check_login ();
|
2016-02-25 16:38:20 +01:00
|
|
|
|
2016-02-25 16:18:14 +01:00
|
|
|
require_once($config['homedir'] . "/include/functions_os.php");
|
2016-02-25 16:38:20 +01:00
|
|
|
|
|
|
|
|
2016-02-24 10:00:01 +01:00
|
|
|
$getNodeData = (bool)get_parameter('getNodeData', 0);
|
2016-03-08 17:04:09 +01:00
|
|
|
$getNodeDetails = (bool)get_parameter('getNodeDetails', 0);
|
2016-03-10 11:06:52 +01:00
|
|
|
$printEditNodeTable = (bool)get_parameter('printEditNodeTable', 0);
|
2016-03-10 16:12:54 +01:00
|
|
|
$printEditMapTable = (bool)get_parameter('printEditMapTable', 0);
|
2016-02-25 16:38:20 +01:00
|
|
|
|
2016-02-24 10:00:01 +01:00
|
|
|
if ($getNodeData) {
|
2016-02-24 11:45:08 +01:00
|
|
|
$id_node_data = (int)get_parameter('id_node_data');
|
2016-02-24 10:00:01 +01:00
|
|
|
$type = (int)get_parameter('type');
|
|
|
|
$id_map = (int)get_parameter('id_map');
|
2016-02-24 11:45:08 +01:00
|
|
|
$data_graph_id = (int)get_parameter('data_graph_id');
|
2016-02-24 16:44:37 +01:00
|
|
|
$node_id = get_parameter('node_id');
|
2016-02-25 16:38:20 +01:00
|
|
|
|
2016-02-25 16:18:14 +01:00
|
|
|
ob_start();
|
|
|
|
?>
|
|
|
|
<div id="tooltip_{data_graph_id}">
|
|
|
|
<div class="title_bar">
|
|
|
|
<span class="title">{title}</span>
|
2016-02-25 16:38:20 +01:00
|
|
|
|
2016-02-25 16:18:14 +01:00
|
|
|
<span class="close_click" onClick="javascript: close_button_tooltip('{data_graph_id}');">✖</span>
|
|
|
|
<span class="open_click" onClick="javascript: tooltip_to_new_window('{data_graph_id}');">➚</span>
|
|
|
|
</div>
|
|
|
|
<div class="body">
|
|
|
|
{body}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<?php
|
|
|
|
$return_data = ob_get_clean();
|
2016-02-25 16:38:20 +01:00
|
|
|
|
2016-02-24 13:04:38 +01:00
|
|
|
switch ($type) {
|
|
|
|
case ITEM_TYPE_AGENT_NETWORKMAP:
|
2016-02-25 16:18:14 +01:00
|
|
|
$return_data = str_replace(
|
|
|
|
"{data_graph_id}",
|
|
|
|
$data_graph_id,
|
|
|
|
$return_data);
|
|
|
|
$return_data = str_replace(
|
|
|
|
"{node_id}",
|
|
|
|
$node_id,
|
|
|
|
$return_data);
|
|
|
|
$return_data = str_replace(
|
|
|
|
"{title}",
|
|
|
|
agents_get_name($id_node_data),
|
|
|
|
$return_data);
|
2016-02-25 16:38:20 +01:00
|
|
|
|
|
|
|
|
2016-02-25 16:18:14 +01:00
|
|
|
$agent_group = groups_get_name(
|
|
|
|
db_get_value('id_grupo', 'tagente', 'id_agente', $id_node_data));
|
2016-02-25 16:38:20 +01:00
|
|
|
|
2016-02-25 16:18:14 +01:00
|
|
|
ob_start();
|
|
|
|
?>
|
|
|
|
<span>
|
|
|
|
<strong><?php echo __('IP Address');?>: </strong>
|
|
|
|
<?php echo agents_get_address($id_node_data);?>
|
|
|
|
</span><br />
|
|
|
|
<span>
|
|
|
|
<strong><?php echo __('OS');?>: </strong>
|
|
|
|
<?php echo os_get_name(agents_get_os($id_node_data));?>
|
|
|
|
</span><br />
|
|
|
|
<span>
|
|
|
|
<strong><?php echo __('Description');?>: </strong>
|
|
|
|
<?php echo db_get_value('comentarios', 'tagente', 'id_agente', $id_node_data);?>
|
|
|
|
</span> <br/>
|
|
|
|
<span>
|
|
|
|
<strong><?php echo __('Group');?>: </strong>
|
|
|
|
<?php echo $agent_group;?>
|
|
|
|
</span><br />
|
|
|
|
<span>
|
|
|
|
<strong><?php echo __('Agent Version');?>: </strong>
|
|
|
|
<?php echo db_get_value('agent_version', 'tagente', 'id_agente', $id_node_data);?>
|
|
|
|
</span><br />
|
|
|
|
<span>
|
|
|
|
<strong><?php echo __('Last Contact');?>: </strong>
|
|
|
|
<?php echo db_get_value('ultimo_contacto', 'tagente', 'id_agente', $id_node_data);?>
|
|
|
|
</span><br />
|
|
|
|
<span>
|
|
|
|
<strong><?php echo __('Remote');?>: </strong>
|
|
|
|
<?php echo db_get_value('ultimo_contacto_remoto', 'tagente', 'id_agente', $id_node_data);?>
|
|
|
|
</span>
|
|
|
|
<?php
|
|
|
|
$body = ob_get_clean();
|
2016-02-25 16:38:20 +01:00
|
|
|
|
2016-02-25 16:18:14 +01:00
|
|
|
$return_data = str_replace(
|
|
|
|
"{body}",
|
|
|
|
$body,
|
|
|
|
$return_data);
|
2016-02-24 13:04:38 +01:00
|
|
|
break;
|
|
|
|
case ITEM_TYPE_MODULE_NETWORKMAP:
|
2016-02-25 16:34:32 +01:00
|
|
|
$node_data = db_get_all_rows_sql("SELECT descripcion
|
2016-02-24 13:04:38 +01:00
|
|
|
FROM tagente_modulo
|
|
|
|
WHERE id_agente_modulo = " . $id_node_data);
|
2016-02-25 16:34:32 +01:00
|
|
|
|
2016-02-24 13:04:38 +01:00
|
|
|
$node_data = $node_data[0];
|
2016-02-25 16:34:32 +01:00
|
|
|
|
|
|
|
$return_data = str_replace(
|
|
|
|
"{data_graph_id}",
|
|
|
|
$data_graph_id,
|
|
|
|
$return_data);
|
|
|
|
$return_data = str_replace(
|
|
|
|
"{node_id}",
|
|
|
|
$node_id,
|
|
|
|
$return_data);
|
|
|
|
$return_data = str_replace(
|
|
|
|
"{title}",
|
|
|
|
modules_get_agentmodule_name($id_node_data),
|
|
|
|
$return_data);
|
|
|
|
|
|
|
|
ob_start();
|
|
|
|
?>
|
|
|
|
<span>
|
|
|
|
<strong><?php echo __('Agent Name');?>: </strong>
|
|
|
|
<?php echo agents_get_name(modules_get_agentmodule_agent($id_node_data));?>
|
|
|
|
</span> <br/>
|
|
|
|
<span>
|
|
|
|
<strong><?php echo __('Description');?>: </strong>
|
|
|
|
<?php echo db_get_value('descripcion', 'tagente_modulo', 'id_agente_modulo', $id_node_data);?>
|
|
|
|
</span> <br/>
|
|
|
|
<?php
|
|
|
|
$body = ob_get_clean();
|
|
|
|
|
|
|
|
$return_data = str_replace(
|
|
|
|
"{body}",
|
|
|
|
$body,
|
|
|
|
$return_data);
|
2016-02-24 13:04:38 +01:00
|
|
|
break;
|
|
|
|
}
|
2016-02-25 16:38:20 +01:00
|
|
|
|
2016-02-24 13:04:38 +01:00
|
|
|
sleep(1);
|
2016-02-24 11:45:08 +01:00
|
|
|
echo json_encode($return_data);
|
|
|
|
return;
|
2016-02-23 17:28:55 +01:00
|
|
|
}
|
2016-03-08 17:04:09 +01:00
|
|
|
else if ($getNodeDetails) {
|
|
|
|
$id_node_data = (int)get_parameter('id_node_data');
|
2016-03-17 11:40:38 +01:00
|
|
|
$type = (int)get_parameter('type');
|
|
|
|
$id_map = (int)get_parameter('id_map');
|
2016-03-08 17:04:09 +01:00
|
|
|
$data_graph_id = (int)get_parameter('data_graph_id');
|
|
|
|
$node_id = get_parameter('node_id');
|
|
|
|
|
2016-03-08 17:09:40 +01:00
|
|
|
ob_start();
|
|
|
|
?>
|
2016-03-17 11:40:38 +01:00
|
|
|
<div id="tooltip_{data_graph_id}">
|
2016-03-08 17:09:40 +01:00
|
|
|
<div class="title_bar">
|
|
|
|
<span class="title">{title}</span>
|
|
|
|
</div>
|
|
|
|
<div class="body">
|
|
|
|
{body}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<?php
|
|
|
|
$details = ob_get_clean();
|
|
|
|
|
2016-03-17 11:40:38 +01:00
|
|
|
switch ($type) {
|
|
|
|
case ITEM_TYPE_AGENT_NETWORKMAP:
|
|
|
|
$details = str_replace(
|
|
|
|
"{data_graph_id}",
|
|
|
|
$data_graph_id,
|
|
|
|
$details);
|
|
|
|
$details = str_replace(
|
|
|
|
"{node_id}",
|
|
|
|
$node_id,
|
|
|
|
$details);
|
|
|
|
$details = str_replace(
|
|
|
|
"{title}",
|
|
|
|
agents_get_name($id_node_data),
|
|
|
|
$details);
|
|
|
|
|
|
|
|
|
|
|
|
$agent_group = groups_get_name(
|
|
|
|
db_get_value('id_grupo', 'tagente', 'id_agente', $id_node_data));
|
|
|
|
|
|
|
|
ob_start();
|
|
|
|
?>
|
|
|
|
<span>
|
|
|
|
<strong><?php echo __('IP Address');?>: </strong>
|
|
|
|
<?php echo agents_get_address($id_node_data);?>
|
|
|
|
</span><br />
|
|
|
|
<span>
|
|
|
|
<strong><?php echo __('OS');?>: </strong>
|
|
|
|
<?php echo os_get_name(agents_get_os($id_node_data));?>
|
|
|
|
</span><br />
|
|
|
|
<span>
|
|
|
|
<strong><?php echo __('Description');?>: </strong>
|
|
|
|
<?php echo db_get_value('comentarios', 'tagente', 'id_agente', $id_node_data);?>
|
|
|
|
</span> <br/>
|
|
|
|
<span>
|
|
|
|
<strong><?php echo __('Group');?>: </strong>
|
|
|
|
<?php echo $agent_group;?>
|
|
|
|
</span><br />
|
|
|
|
<span>
|
|
|
|
<strong><?php echo __('Agent Version');?>: </strong>
|
|
|
|
<?php echo db_get_value('agent_version', 'tagente', 'id_agente', $id_node_data);?>
|
|
|
|
</span><br />
|
|
|
|
<span>
|
|
|
|
<strong><?php echo __('Last Contact');?>: </strong>
|
|
|
|
<?php echo db_get_value('ultimo_contacto', 'tagente', 'id_agente', $id_node_data);?>
|
|
|
|
</span><br />
|
|
|
|
<span>
|
|
|
|
<strong><?php echo __('Remote');?>: </strong>
|
|
|
|
<?php echo db_get_value('ultimo_contacto_remoto', 'tagente', 'id_agente', $id_node_data);?>
|
|
|
|
</span>
|
|
|
|
<?php
|
|
|
|
$body = ob_get_clean();
|
|
|
|
|
|
|
|
$details = str_replace(
|
|
|
|
"{body}",
|
|
|
|
$body,
|
|
|
|
$details);
|
|
|
|
|
|
|
|
break;
|
|
|
|
case ITEM_TYPE_MODULE_NETWORKMAP:
|
|
|
|
$node_data = db_get_all_rows_sql("SELECT descripcion
|
|
|
|
FROM tagente_modulo
|
|
|
|
WHERE id_agente_modulo = " . $id_node_data);
|
|
|
|
|
|
|
|
$node_data = $node_data[0];
|
|
|
|
|
|
|
|
$details = str_replace(
|
|
|
|
"{data_graph_id}",
|
|
|
|
$data_graph_id,
|
|
|
|
$details);
|
|
|
|
$details = str_replace(
|
|
|
|
"{node_id}",
|
|
|
|
$node_id,
|
|
|
|
$details);
|
|
|
|
$details = str_replace(
|
|
|
|
"{title}",
|
|
|
|
modules_get_agentmodule_name($id_node_data),
|
|
|
|
$details);
|
|
|
|
|
|
|
|
ob_start();
|
|
|
|
?>
|
|
|
|
<span>
|
|
|
|
<strong><?php echo __('Agent Name');?>: </strong>
|
|
|
|
<?php echo agents_get_name(modules_get_agentmodule_agent($id_node_data));?>
|
|
|
|
</span> <br/>
|
|
|
|
<span>
|
|
|
|
<strong><?php echo __('Description');?>: </strong>
|
|
|
|
<?php echo db_get_value('descripcion', 'tagente_modulo', 'id_agente_modulo', $id_node_data);?>
|
|
|
|
</span> <br/>
|
|
|
|
<?php
|
|
|
|
$body = ob_get_clean();
|
|
|
|
|
|
|
|
$details = str_replace(
|
|
|
|
"{body}",
|
|
|
|
$body,
|
|
|
|
$details);
|
|
|
|
break;
|
2016-03-08 17:04:09 +01:00
|
|
|
}
|
2016-03-17 10:44:43 +01:00
|
|
|
$body = html_print_table ($table, true);
|
|
|
|
|
|
|
|
$details = str_replace(
|
|
|
|
"{body}",
|
|
|
|
$body,
|
|
|
|
$details);
|
2016-03-17 10:31:18 +01:00
|
|
|
|
2016-03-08 17:04:09 +01:00
|
|
|
echo json_encode($details);
|
|
|
|
return;
|
|
|
|
}
|
2016-03-10 11:06:52 +01:00
|
|
|
else if ($printEditNodeTable) {
|
2016-03-10 14:54:31 +01:00
|
|
|
?>
|
|
|
|
<div title="<?php echo __('Edit node');?>">
|
2016-03-10 15:22:56 +01:00
|
|
|
<div style="text-align: center; width: 100%;">
|
2016-03-10 14:54:31 +01:00
|
|
|
<?php
|
|
|
|
$table = new stdClass();
|
|
|
|
$table->id = 'node_options';
|
|
|
|
$table->width = "100%";
|
|
|
|
|
2016-03-10 15:22:56 +01:00
|
|
|
$table->head = array();
|
|
|
|
$table->head['name'] = __('Nombre del nodo');
|
|
|
|
$table->head['type'] = __('Tipo del nodo (Agente o Modulo)');
|
2016-03-10 14:54:31 +01:00
|
|
|
|
2016-03-10 15:22:56 +01:00
|
|
|
$table->data = array();
|
|
|
|
$table->data[0][0] = __('Capo1');
|
|
|
|
$table->data[0][1] = __('Capo2');
|
2016-03-10 14:54:31 +01:00
|
|
|
$table->data[1][0] = __('Capo1');
|
|
|
|
$table->data[1][1] = __('Capo2');
|
2016-03-10 15:22:56 +01:00
|
|
|
$table->data[2][0] = __('Capo1');
|
|
|
|
$table->data[2][1] = __('Capo2');
|
2016-03-10 14:54:31 +01:00
|
|
|
|
2016-03-10 15:22:56 +01:00
|
|
|
ui_toggle(html_print_table($table, true), __('Node options'),
|
|
|
|
__('Node options'), true);
|
2016-03-10 14:54:31 +01:00
|
|
|
?>
|
|
|
|
</div>
|
2016-03-10 11:06:52 +01:00
|
|
|
</div>
|
2016-03-10 14:54:31 +01:00
|
|
|
<?php
|
2016-03-10 11:06:52 +01:00
|
|
|
return;
|
|
|
|
}
|
2016-03-10 16:12:54 +01:00
|
|
|
else if ($printEditMapTable) {
|
|
|
|
?>
|
|
|
|
<div title="<?php echo __('Edit map');?>">
|
|
|
|
<div style="text-align: center; width: 100%;">
|
|
|
|
<?php
|
|
|
|
$table = new stdClass();
|
|
|
|
$table->id = 'map_options';
|
|
|
|
$table->width = "100%";
|
|
|
|
|
|
|
|
$table->head = array();
|
|
|
|
$table->head['name'] = __('Nombre del mapa');
|
|
|
|
$table->head['type'] = __('Tipo del mapa');
|
|
|
|
|
|
|
|
$table->data = array();
|
|
|
|
$table->data[0][0] = __('Capo1');
|
|
|
|
$table->data[0][1] = __('Capo2');
|
|
|
|
$table->data[1][0] = __('Capo1');
|
|
|
|
$table->data[1][1] = __('Capo2');
|
|
|
|
$table->data[2][0] = __('Capo1');
|
|
|
|
$table->data[2][1] = __('Capo2');
|
|
|
|
|
|
|
|
ui_toggle(html_print_table($table, true), __('Map options'),
|
|
|
|
__('Map options'), true);
|
|
|
|
?>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<?php
|
|
|
|
return;
|
|
|
|
}
|
2016-02-23 17:28:55 +01:00
|
|
|
|
|
|
|
}
|
2016-02-04 13:11:14 +01:00
|
|
|
?>
|