2012-08-22 Miguel de Dios <miguel.dedios@artica.es>
* operation/tree.php, godmode/massive/massive_edit_modules.php, godmode/massive/massive_edit_agents.php, include/functions_treeview.php: added the view of quiet agents and modules in treeview, and added in massive operations for agents and modules to set the quiet for these. * operation/menu.php: cleaned source code style. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6903 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
85b6b1f0fe
commit
def4b397d8
|
@ -78,7 +78,9 @@ if ($update_agents) {
|
|||
$values['cascade_protection'] = get_parameter('cascade_protection');
|
||||
if (get_parameter ('delete_conf', 0) != 0)
|
||||
$values['delete_conf'] = get_parameter('delete_conf');
|
||||
|
||||
if (get_parameter('quiet_select', -1) != -1)
|
||||
$values['quiet'] = get_parameter('quiet_select');
|
||||
|
||||
$fields = db_get_all_fields_in_table('tagent_custom_fields');
|
||||
|
||||
if ($fields === false) $fields = array();
|
||||
|
@ -127,30 +129,30 @@ if ($update_agents) {
|
|||
|
||||
$n_edited = 0;
|
||||
$result = false;
|
||||
foreach ($id_agents as $id_agent) {
|
||||
foreach ($id_agents as $id_agent) {
|
||||
if (!empty($values)) {
|
||||
$result = db_process_sql_update ('tagente',
|
||||
$values,
|
||||
array ('id_agente' => $id_agent));
|
||||
$values,
|
||||
array ('id_agente' => $id_agent));
|
||||
}
|
||||
|
||||
|
||||
// Update Custom Fields
|
||||
foreach ($fields as $field) {
|
||||
if (get_parameter_post ('customvalue_'.$field['id_field'], '') != '') {
|
||||
$key = $field['id_field'];
|
||||
$value = get_parameter_post ('customvalue_'.$field['id_field'], '');
|
||||
|
||||
|
||||
$old_value = db_get_all_rows_filter('tagent_custom_data', array('id_agent' => $id_agent, 'id_field' => $key));
|
||||
|
||||
|
||||
if ($old_value === false) {
|
||||
// Create custom field if not exist
|
||||
$result = db_process_sql_insert ('tagent_custom_data',
|
||||
array('id_field' => $key,'id_agent' => $id_agent, 'description' => $value));
|
||||
array('id_field' => $key,'id_agent' => $id_agent, 'description' => $value));
|
||||
}
|
||||
else {
|
||||
else {
|
||||
$result = db_process_sql_update ('tagent_custom_data',
|
||||
array('description' => $value),
|
||||
array('id_field' => $key,'id_agent' => $id_agent));
|
||||
array('description' => $value),
|
||||
array('id_field' => $key,'id_agent' => $id_agent));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -170,9 +172,8 @@ if ($update_agents) {
|
|||
|
||||
|
||||
ui_print_result_message ($result !== false,
|
||||
__('Agents updated successfully').'('.$n_edited.')',
|
||||
__('Agents cannot be updated'));
|
||||
|
||||
__('Agents updated successfully').'('.$n_edited.')',
|
||||
__('Agents cannot be updated'));
|
||||
}
|
||||
$id_group = 0;
|
||||
|
||||
|
@ -277,6 +278,7 @@ $new_agent = true;
|
|||
$icon_path = '';
|
||||
$update_gis_data = -1;
|
||||
$cascade_protection = -1;
|
||||
$quiet_select = -1;
|
||||
|
||||
$table->width = '95%';
|
||||
$table->class = "databox_color";
|
||||
|
@ -311,14 +313,14 @@ $table->data[3][1] .= '<span id="n_configurations"></span>';
|
|||
$table->data[3][1] .= ') '.html_print_checkbox_extended ("delete_conf", 1, 0, false, '', 'style="margin-right: 40px;"', true).'</div>';
|
||||
|
||||
$table->data[3][1] .= '<div id="not_available_configurations" style="display: none"><em>'.__('Not available').'</em></div>';
|
||||
|
||||
|
||||
$listIcons = gis_get_array_list_icons();
|
||||
|
||||
$arraySelectIcon = array();
|
||||
foreach ($listIcons as $index => $value) $arraySelectIcon[$index] = $index;
|
||||
|
||||
$path = 'images/gis_map/icons/'; //TODO set better method the path
|
||||
if($icon_path == '') {
|
||||
if ($icon_path == '') {
|
||||
$display_icons = 'none';
|
||||
// Hack to show no icon. Use any given image to fix not found image errors
|
||||
$path_without = "images/spinner.png";
|
||||
|
@ -351,6 +353,12 @@ if ($config['activate_gis']) {
|
|||
$table->data[5][1] .= __('Active').' '.html_print_radio_button_extended ("update_gis_data", 1, '', $update_gis_data, false, '', 'style="margin-right: 40px;"', true);
|
||||
}
|
||||
|
||||
$table->data[6][0] = __('Quiet');
|
||||
$table->data[6][0] .= ui_print_help_tip(__('The agent still runs but the alerts and events will be stop'), true);
|
||||
$table->data[6][1] = html_print_select(array(-1 => __('No change'),
|
||||
1 => __('Yes'), 0 => __('No')),
|
||||
"quiet_select", $quiet_select, "", '', 0, true);
|
||||
|
||||
ui_toggle(html_print_table ($table, true), __('Advanced options'));
|
||||
unset($table);
|
||||
|
||||
|
|
|
@ -75,9 +75,9 @@ if ($update) {
|
|||
if ($force) {
|
||||
if ($force == 'type') {
|
||||
$condition = '';
|
||||
if($module_type != 0)
|
||||
if ($module_type != 0)
|
||||
$condition = ' AND t2.id_tipo_modulo = '.$module_type;
|
||||
|
||||
|
||||
$agents_ = db_get_all_rows_sql('SELECT DISTINCT(t1.id_agente)
|
||||
FROM tagente t1, tagente_modulo t2
|
||||
WHERE t1.id_agente = t2.id_agente');
|
||||
|
@ -199,7 +199,7 @@ $snmp_versions['3'] = 'v. 3';
|
|||
|
||||
$table->width = '99%';
|
||||
$table->data = array ();
|
||||
|
||||
|
||||
$table->data[0][0] = __('Selection mode');
|
||||
$table->data[0][1] = __('Select modules first').' '.html_print_radio_button_extended ("selection_mode", 'modules', '', $selection_mode, false, '', 'style="margin-right: 40px;"', true);
|
||||
$table->data[0][2] = '';
|
||||
|
@ -348,6 +348,12 @@ $table->data['edit8'][2] = __('Tags');
|
|||
$table->data['edit8'][3] = html_print_select_from_sql ('SELECT id_tag, name FROM ttag ORDER BY name',
|
||||
'id_tag[]', $id_tag, '',__('None'),'0', true, true, false, false);
|
||||
|
||||
$table->data['edit9'][0] = __('Quiet');
|
||||
$table->data['edit9'][0] .= ui_print_help_tip(__('The module still store data but the alerts and events will be stop'), true);
|
||||
$table->data['edit9'][1] = html_print_select(array(-1 => __('No change'),
|
||||
1 => __('Yes'), 0 => __('No')),
|
||||
"quiet_select", -1, "", '', 0, true);
|
||||
|
||||
echo '<form method="post" action="index.php?sec=gmassive&sec2=godmode/massive/massive_operations&option=edit_modules" id="form_edit">';
|
||||
html_print_table ($table);
|
||||
|
||||
|
@ -594,6 +600,10 @@ function process_manage_edit ($module_name, $agents_select = null) {
|
|||
$values['history_data'] = get_parameter('history_data');
|
||||
}
|
||||
|
||||
if (get_parameter('quiet_select', -1) != -1) {
|
||||
$values['quiet'] = get_parameter('quiet_select');
|
||||
}
|
||||
|
||||
// Whether to update module tag info
|
||||
$update_tags = get_parameter('id_tag', false);
|
||||
|
||||
|
|
|
@ -0,0 +1,683 @@
|
|||
<?php
|
||||
|
||||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2011 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.
|
||||
|
||||
function treeview_printTable($id_agente) {
|
||||
global $config;
|
||||
|
||||
require_once ("include/functions_agents.php");
|
||||
require_once ($config["homedir"] . '/include/functions_graph.php');
|
||||
include_graphs_dependencies();
|
||||
require_once ($config['homedir'] . '/include/functions_groups.php');
|
||||
require_once ($config['homedir'] . '/include/functions_gis.php');
|
||||
|
||||
$agent = db_get_row ("tagente", "id_agente", $id_agente);
|
||||
|
||||
if ($agent === false) {
|
||||
echo '<h3 class="error">'.__('There was a problem loading agent').'</h3>';
|
||||
return;
|
||||
}
|
||||
|
||||
$is_extra = enterprise_hook('policies_is_agent_extra_policy', array($id_agente));
|
||||
|
||||
if($is_extra === ENTERPRISE_NOT_HOOK) {
|
||||
$is_extra = false;
|
||||
}
|
||||
|
||||
if (! check_acl ($config["id_user"], $agent["id_grupo"], "AR") && !$is_extra) {
|
||||
db_pandora_audit("ACL Violation",
|
||||
"Trying to access Agent General Information");
|
||||
require_once ("general/noaccess.php");
|
||||
return;
|
||||
}
|
||||
|
||||
echo '<div id="id_div3" width="450px">';
|
||||
echo '<table cellspacing="4" cellpadding="4" border="0" class="databox" style="width:70%">';
|
||||
//Agent name
|
||||
echo '<tr><td class="datos"><b>'.__('Agent name').'</b></td>';
|
||||
if ($agent['disabled']) {
|
||||
$cellName = "<em>" . ui_print_agent_name ($agent["id_agente"], true, 500, "text-transform: uppercase;", true) . ui_print_help_tip(__('Disabled'), true) . "</em>";
|
||||
}
|
||||
else {
|
||||
$cellName = ui_print_agent_name ($agent["id_agente"], true, 500, "text-transform: uppercase;", true);
|
||||
}
|
||||
echo '<td class="datos"><b>'.$cellName.'</b></td>';
|
||||
|
||||
//Addresses
|
||||
echo '<tr><td class="datos2"><b>'.__('IP Address').'</b></td>';
|
||||
echo '<td class="datos2" colspan="2">';
|
||||
$ips = array();
|
||||
$addresses = agents_get_addresses ($id_agente);
|
||||
$address = agents_get_address($id_agente);
|
||||
|
||||
foreach($addresses as $k => $add) {
|
||||
if($add == $address) {
|
||||
unset($addresses[$k]);
|
||||
}
|
||||
}
|
||||
|
||||
echo $address;
|
||||
|
||||
if (!empty($addresses)) {
|
||||
ui_print_help_tip(__('Other IP addresses').': <br>'.implode('<br>',$addresses));
|
||||
}
|
||||
|
||||
echo '</td></tr>';
|
||||
|
||||
// Agent Interval
|
||||
echo '<tr><td class="datos"><b>'.__('Interval').'</b></td>';
|
||||
echo '<td class="datos" colspan="2">'.human_time_description_raw ($agent["intervalo"]).'</td></tr>';
|
||||
|
||||
// Comments
|
||||
echo '<tr><td class="datos2"><b>'.__('Description').'</b></td>';
|
||||
echo '<td class="datos2" colspan="2">'.$agent["comentarios"].'</td></tr>';
|
||||
|
||||
// Agent version
|
||||
echo '<tr><td class="datos2"><b>'.__('Agent Version'). '</b></td>';
|
||||
echo '<td class="datos2" colspan="2">'.$agent["agent_version"].'</td></tr>';
|
||||
|
||||
// Position Information
|
||||
if ($config['activate_gis']) {
|
||||
$dataPositionAgent = gis_get_data_last_position_agent($agent['id_agente']);
|
||||
|
||||
echo '<tr><td class="datos2"><b>'.__('Position (Long, Lat)'). '</b></td>';
|
||||
echo '<td class="datos2" colspan="2">';
|
||||
|
||||
if ($dataPositionAgent === false) {
|
||||
echo __('There is no GIS data.');
|
||||
}
|
||||
else {
|
||||
echo '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&tab=gis&id_agente='.$id_agente.'">';
|
||||
if ($dataPositionAgent['description'] != "")
|
||||
echo $dataPositionAgent['description'];
|
||||
else
|
||||
echo $dataPositionAgent['stored_longitude'].', '.$dataPositionAgent['stored_latitude'];
|
||||
echo "</a>";
|
||||
}
|
||||
|
||||
echo '</td></tr>';
|
||||
}
|
||||
|
||||
// If the url description is setted
|
||||
if ($agent['url_address'] != '') {
|
||||
echo '<tr><td class="datos"><b>'.__('Url address').'</b></td>';
|
||||
echo '<td class="datos2" colspan="2"><a href='.$agent["url_address"].'>' . $agent["url_address"] . '</a></td></tr>';
|
||||
}
|
||||
|
||||
// Last contact
|
||||
echo '<tr><td class="datos2"><b>'.__('Last contact')." / ".__('Remote').'</b></td><td class="datos2 f9" colspan="2">';
|
||||
ui_print_timestamp ($agent["ultimo_contacto"]);
|
||||
|
||||
echo " / ";
|
||||
|
||||
if ($agent["ultimo_contacto_remoto"] == "01-01-1970 00:00:00") {
|
||||
echo __('Never');
|
||||
}
|
||||
else {
|
||||
echo $agent["ultimo_contacto_remoto"];
|
||||
}
|
||||
echo '</td></tr>';
|
||||
|
||||
// Timezone Offset
|
||||
if ($agent['timezone_offset'] != 0) {
|
||||
echo '<tr><td class="datos2"><b>'.__('Timezone Offset'). '</b></td>';
|
||||
echo '<td class="datos2" colspan="2">'.$agent["timezone_offset"].'</td></tr>';
|
||||
}
|
||||
// Next contact (agent)
|
||||
$progress = agents_get_next_contact($id_agente);
|
||||
|
||||
echo '<tr><td class="datos"><b>'.__('Next agent contact').'</b></td>';
|
||||
echo '<td class="datos f9" colspan="2">' . progress_bar($progress, 200, 20) . '</td></tr>';
|
||||
|
||||
// Custom fields
|
||||
$fields = db_get_all_rows_filter('tagent_custom_fields', array('display_on_front' => 1));
|
||||
if ($fields === false) {
|
||||
$fields = array ();
|
||||
}
|
||||
if ($fields) {
|
||||
foreach ($fields as $field) {
|
||||
echo '<tr><td class="datos"><b>'.$field['name'] . ui_print_help_tip (__('Custom field'), true).'</b></td>';
|
||||
$custom_value = db_get_value_filter('description', 'tagent_custom_data', array('id_field' => $field['id_field'], 'id_agent' => $id_agente));
|
||||
if ($custom_value === false || $custom_value == '') {
|
||||
$custom_value = '<i>-'.__('empty').'-</i>';
|
||||
}
|
||||
echo '<td class="datos f9" colspan="2">'.$custom_value.'</td></tr>';
|
||||
}
|
||||
}
|
||||
|
||||
//End of table
|
||||
echo '</table></div>';
|
||||
|
||||
// Blank space below title, DONT remove this, this
|
||||
// Breaks the layout when Flash charts are enabled :-o
|
||||
echo '<div id="id_div" style="height: 10px"> </div>';
|
||||
|
||||
//Floating div
|
||||
echo '<div id="agent_access" width:35%; padding-top:11px;">';
|
||||
|
||||
if ($config["agentaccess"]) {
|
||||
echo '<b>'.__('Agent access rate (24h)').'</b><br />';
|
||||
|
||||
graphic_agentaccess($id_agente, 280, 110, 86400);
|
||||
}
|
||||
|
||||
echo '<br>';
|
||||
graph_graphic_agentevents ($id_agente, 290, 15, 86400, '');
|
||||
|
||||
echo '</div>';
|
||||
|
||||
|
||||
echo '<form id="agent_detail" method="post" action="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$id_agente.'">';
|
||||
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
||||
html_print_submit_button (__('Go to agent detail'), 'upd_button', false, 'class="sub upd"');
|
||||
echo '</div>';
|
||||
echo '</form>';
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
function treeview_printTree($type) {
|
||||
global $config;
|
||||
|
||||
$search_free = get_parameter('search_free', '');
|
||||
$select_status = get_parameter('status', -1);
|
||||
|
||||
echo '<table class="databox" style="width:98%">';
|
||||
echo '<tr><td style="width:60%" valign="top">';
|
||||
|
||||
//Get all groups
|
||||
$avariableGroups = users_get_groups (); //db_get_all_rows_in_table('tgrupo', 'nombre');
|
||||
|
||||
//Get all groups with agents
|
||||
$full_groups = db_get_all_rows_sql("SELECT DISTINCT tagente.id_grupo
|
||||
FROM tagente, tagente_estado
|
||||
WHERE tagente.id_agente = tagente_estado.id_agente AND
|
||||
tagente_estado.utimestamp != 0
|
||||
UNION
|
||||
SELECT tagente.id_grupo
|
||||
FROM tagente
|
||||
WHERE disabled = 0
|
||||
AND id_agente NOT IN (SELECT tagente.id_agente
|
||||
FROM tagente, tagente_modulo
|
||||
WHERE tagente.id_agente = tagente_modulo.id_agente
|
||||
AND tagente.disabled = 0
|
||||
AND tagente_modulo.disabled = 0
|
||||
group by tagente.id_agente
|
||||
having COUNT(*) > 0)");
|
||||
|
||||
$fgroups = array();
|
||||
|
||||
foreach ($full_groups as $fg) {
|
||||
$fgroups[$fg['id_grupo']] = "";
|
||||
}
|
||||
|
||||
// We only want groups with agents, so we need the intesect of both arrays.
|
||||
// Not for policies, we need all groups
|
||||
if ($type != 'policies')
|
||||
$avariableGroups = array_intersect_key($avariableGroups, $fgroups);
|
||||
|
||||
$avariableGroupsIds = implode(',',array_keys($avariableGroups));
|
||||
if($avariableGroupsIds == '') {
|
||||
$avariableGroupsIds == -1;
|
||||
}
|
||||
|
||||
if ($type !== 'policies') {
|
||||
// Filter groups by agent status
|
||||
switch ($select_status) {
|
||||
case NORMAL:
|
||||
foreach ($avariableGroups as $group_name) {
|
||||
$id_group = db_get_value_sql('SELECT id_grupo FROM tgrupo where nombre ="' . $group_name . '"');
|
||||
|
||||
$num_ok = groups_agent_ok($id_group);
|
||||
|
||||
if ($num_ok <= 0)
|
||||
unset($avariableGroups[$id_group]);
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
case WARNING:
|
||||
foreach ($avariableGroups as $group_name) {
|
||||
$id_group = db_get_value_sql('SELECT id_grupo FROM tgrupo where nombre ="' . $group_name . '"');
|
||||
|
||||
$num_warning = groups_agent_warning($id_group);
|
||||
|
||||
if ($num_warning <= 0)
|
||||
unset($avariableGroups[$id_group]);
|
||||
}
|
||||
break;
|
||||
case CRITICAL:
|
||||
foreach ($avariableGroups as $group_name) {
|
||||
$id_group = db_get_value_sql('SELECT id_grupo FROM tgrupo where nombre ="' . $group_name . '"');
|
||||
|
||||
$num_critical = groups_agent_critical($id_group);
|
||||
|
||||
if ($num_critical <= 0)
|
||||
unset($avariableGroups[$id_group]);
|
||||
}
|
||||
break;
|
||||
case UNKNOWN:
|
||||
foreach ($avariableGroups as $group_name) {
|
||||
$id_group = db_get_value_sql('SELECT id_grupo FROM tgrupo where nombre ="' . $group_name . '"');
|
||||
|
||||
$num_unknown = groups_agent_unknown($id_group);
|
||||
|
||||
if ($num_unknown <= 0)
|
||||
unset($avariableGroups[$id_group]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// If there are not groups display error and return
|
||||
if (empty($avariableGroups)) {
|
||||
ui_print_error_message("There aren't agents in this agrupation");
|
||||
echo '</td></tr>';
|
||||
echo '</table>';
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if ($search_free != '') {
|
||||
$sql_search = " AND id_grupo IN (SELECT id_grupo FROM tagente
|
||||
WHERE nombre COLLATE utf8_general_ci LIKE '%$search_free%')";
|
||||
}
|
||||
else {
|
||||
$sql_search ='';
|
||||
}
|
||||
|
||||
|
||||
switch ($type) {
|
||||
default:
|
||||
case 'os':
|
||||
//Skip agent with all modules in not init status
|
||||
|
||||
$sql_search .= " AND id_agente NOT IN (SELECT tagente_estado.id_agente FROM
|
||||
tagente_estado GROUP BY id_agente HAVING SUM(utimestamp) = 0)";
|
||||
|
||||
$sql = agents_get_agents(array (
|
||||
'order' => 'nombre COLLATE utf8_general_ci ASC',
|
||||
'disabled' => 0,
|
||||
'status' => $select_status,
|
||||
'search' => $sql_search),
|
||||
|
||||
array ('tagente.id_os'),
|
||||
'AR',
|
||||
false,
|
||||
true);
|
||||
|
||||
$sql_os = sprintf("SELECT * FROM tconfig_os WHERE id_os IN (%s)", $sql);
|
||||
|
||||
$list = db_get_all_rows_sql($sql_os);
|
||||
|
||||
break;
|
||||
case 'group':
|
||||
$stringAvariableGroups = (
|
||||
implode(', ',
|
||||
array_map(
|
||||
create_function('&$itemA', '{ return "\'" . $itemA . "\'"; }'), $avariableGroups
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
case "postgresql":
|
||||
$list = db_get_all_rows_sql("SELECT * FROM tgrupo WHERE nombre IN (" . $stringAvariableGroups . ") $sql_search");
|
||||
break;
|
||||
case "oracle":
|
||||
$list = db_get_all_rows_sql("SELECT * FROM tgrupo WHERE dbms_lob.substr(nombre,4000,1) IN (" . $stringAvariableGroups . ")");
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'module_group':
|
||||
//Skip agents which only have not init modules
|
||||
$sql_search .= " AND id_agente NOT IN (SELECT tagente_estado.id_agente FROM
|
||||
tagente_estado GROUP BY id_agente HAVING SUM(utimestamp) = 0)";
|
||||
|
||||
$sql = agents_get_agents(array (
|
||||
'order' => 'nombre COLLATE utf8_general_ci ASC',
|
||||
'disabled' => 0,
|
||||
'status' => $select_status,
|
||||
'search' => $sql_search),
|
||||
array ('id_agente'),
|
||||
'AR',
|
||||
false,
|
||||
true);
|
||||
|
||||
// Skip agents without modules
|
||||
$sql .= ' AND id_agente IN
|
||||
(SELECT tagente.id_agente
|
||||
FROM tagente, tagente_modulo
|
||||
WHERE tagente.id_agente = tagente_modulo.id_agente
|
||||
AND tagente.disabled = 0
|
||||
AND tagente_modulo.disabled = 0
|
||||
GROUP BY tagente.id_agente
|
||||
HAVING COUNT(*) > 0)';
|
||||
|
||||
$sql_module_groups = sprintf("SELECT * FROM tmodule_group
|
||||
WHERE id_mg IN (SELECT id_module_group FROM tagente_modulo WHERE id_agente IN (%s))", $sql);
|
||||
|
||||
|
||||
$list = db_get_all_rows_sql($sql_module_groups);
|
||||
|
||||
if ($list == false) {
|
||||
$list = array();
|
||||
}
|
||||
|
||||
array_push($list, array('id_mg' => 0, 'name' => 'Not assigned'));
|
||||
|
||||
break;
|
||||
case 'policies':
|
||||
$avariableGroups = users_get_groups ();
|
||||
|
||||
$groups_id = array_keys($avariableGroups);
|
||||
$groups = implode(',',$groups_id);
|
||||
|
||||
if ($search_free != '') {
|
||||
$sql = "SELECT DISTINCT tpolicies.id, tpolicies.name
|
||||
FROM tpolicies, tpolicy_modules,
|
||||
tagente_estado, tagente, tagente_modulo
|
||||
WHERE
|
||||
tagente.id_agente = tagente_estado.id_agente AND
|
||||
tagente_modulo.id_agente = tagente_estado.id_agente AND
|
||||
tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo AND
|
||||
tagente_estado.utimestamp != 0 AND
|
||||
tagente_modulo.id_policy_module != 0 AND
|
||||
tpolicy_modules.id = tagente_modulo.id_policy_module AND
|
||||
tpolicies.id = tpolicy_modules.id_policy AND
|
||||
tagente.id_grupo IN ($groups) AND
|
||||
tagente.nombre LIKE '%$search_free%' AND
|
||||
tagente.disabled = 0 AND
|
||||
tagente_modulo.disabled = 0";
|
||||
|
||||
$list = db_get_all_rows_sql($sql);
|
||||
|
||||
if ($list === false)
|
||||
$list = array();
|
||||
|
||||
$element = 0;
|
||||
switch ($select_status) {
|
||||
case NORMAL:
|
||||
foreach ($list as $policy_element) {
|
||||
|
||||
$policy_agents_ok = policies_agents_ok($policy_element['id']);
|
||||
|
||||
if ($policy_agents_ok <= 0)
|
||||
unset($list[$element]);
|
||||
|
||||
$element++;
|
||||
}
|
||||
break;
|
||||
case CRITICAL:
|
||||
foreach ($list as $policy_element) {
|
||||
|
||||
$policy_agents_critical = policies_agents_critical($policy_element['id']);
|
||||
|
||||
if ($policy_agents_critical <= 0)
|
||||
unset($list[$element]);
|
||||
|
||||
$element++;
|
||||
}
|
||||
break;
|
||||
case WARNING:
|
||||
foreach ($list as $policy_element) {
|
||||
|
||||
$policy_agents_warning = policies_agents_warning($policy_element['id']);
|
||||
|
||||
if ($policy_agents_warning <= 0)
|
||||
unset($list[$element]);
|
||||
|
||||
$element++;
|
||||
}
|
||||
break;
|
||||
case UNKNOWN:
|
||||
foreach ($list as $policy_element) {
|
||||
|
||||
$policy_agents_unknown = policies_agents_unknown($policy_element['id']);
|
||||
|
||||
if ($policy_agents_unknown <= 0)
|
||||
unset($list[$element]);
|
||||
|
||||
$element++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if ($list === false)
|
||||
$list = array();
|
||||
|
||||
array_push($list, array('id' => 0, 'name' => 'No policy'));
|
||||
}
|
||||
else {
|
||||
$list = db_get_all_rows_sql("SELECT DISTINCT tpolicies.id,
|
||||
tpolicies.name
|
||||
FROM tpolicies, tpolicy_modules, tagente_estado,
|
||||
tagente, tagente_modulo
|
||||
WHERE
|
||||
tagente.id_agente = tagente_estado.id_agente AND
|
||||
tagente_modulo.id_agente = tagente_estado.id_agente AND
|
||||
tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo AND
|
||||
tagente_estado.utimestamp != 0 AND
|
||||
tagente_modulo.id_policy_module != 0 AND
|
||||
tpolicy_modules.id = tagente_modulo.id_policy_module AND
|
||||
tpolicies.id = tpolicy_modules.id_policy AND
|
||||
tagente.id_grupo IN ($groups) AND
|
||||
tagente.disabled = 0 AND
|
||||
tagente_modulo.disabled = 0");
|
||||
|
||||
$element = 0;
|
||||
switch ($select_status) {
|
||||
case NORMAL:
|
||||
foreach ($list as $policy_element) {
|
||||
|
||||
$policy_agents_ok = policies_agents_ok($policy_element['id']);
|
||||
|
||||
if ($policy_agents_ok <= 0)
|
||||
unset($list[$element]);
|
||||
|
||||
$element++;
|
||||
}
|
||||
break;
|
||||
case CRITICAL:
|
||||
foreach ($list as $policy_element) {
|
||||
|
||||
$policy_agents_critical = policies_agents_critical($policy_element['id']);
|
||||
|
||||
if ($policy_agents_critical <= 0)
|
||||
unset($list[$element]);
|
||||
|
||||
$element++;
|
||||
}
|
||||
break;
|
||||
case WARNING:
|
||||
foreach ($list as $policy_element) {
|
||||
|
||||
$policy_agents_warning = policies_agents_warning($policy_element['id']);
|
||||
|
||||
if ($policy_agents_warning <= 0)
|
||||
unset($list[$element]);
|
||||
|
||||
$element++;
|
||||
}
|
||||
break;
|
||||
case UNKNOWN:
|
||||
foreach ($list as $policy_element) {
|
||||
|
||||
$policy_agents_unknown = policies_agents_unknown($policy_element['id']);
|
||||
|
||||
if ($policy_agents_unknown <= 0)
|
||||
unset($list[$element]);
|
||||
|
||||
$element++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if ($list === false)
|
||||
$list = array();
|
||||
|
||||
array_push($list, array('id' => 0, 'name' => 'No policy'));
|
||||
}
|
||||
break;
|
||||
case 'module':
|
||||
$avariableGroupsIds = implode(',',array_keys($avariableGroups));
|
||||
if($avariableGroupsIds == ''){
|
||||
$avariableGroupsIds == -1;
|
||||
}
|
||||
|
||||
if ($search_free != '') {
|
||||
$sql_search = " AND t1.id_agente IN (SELECT id_agente FROM tagente
|
||||
WHERE nombre COLLATE utf8_general_ci LIKE '%$search_free%')";
|
||||
}
|
||||
else {
|
||||
$sql_search = '';
|
||||
}
|
||||
|
||||
if ($select_status != -1)
|
||||
$sql_search .= " AND estado = " . $select_status . " ";
|
||||
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
case "postgresql":
|
||||
$list = db_get_all_rows_sql('SELECT t1.nombre
|
||||
FROM tagente_modulo t1, tagente t2,
|
||||
tagente_estado t3
|
||||
WHERE t1.id_agente = t2.id_agente AND
|
||||
t1.id_agente_modulo = t3.id_agente_modulo AND
|
||||
t2.disabled = 0 AND t1.disabled = 0 AND
|
||||
t3.utimestamp !=0 AND
|
||||
t2.id_grupo in (' . $avariableGroupsIds . ')' .
|
||||
$sql_search.'
|
||||
GROUP BY t1.nombre ORDER BY t1.nombre');
|
||||
break;
|
||||
case "oracle":
|
||||
$list = db_get_all_rows_sql('
|
||||
SELECT dbms_lob.substr(t1.nombre,4000,1) as nombre
|
||||
FROM tagente_modulo t1, tagente t2,
|
||||
tagente_estado t3
|
||||
WHERE t1.id_agente = t2.id_agente AND
|
||||
t2.id_grupo in (' . $avariableGroupsIds . ') AND
|
||||
t1.id_agente_modulo = t3.id_agente_modulo AND
|
||||
t2.disabled = 0 AND
|
||||
t1.disabled = 0 AND
|
||||
t3.utimestamp !=0
|
||||
GROUP BY dbms_lob.substr(t1.nombre,4000,1)
|
||||
ORDER BY dbms_lob.substr(t1.nombre,4000,1) ASC');
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if ($list === false) {
|
||||
ui_print_error_message("There aren't agents in this agrupation");
|
||||
echo '</td></tr>';
|
||||
echo '</table>';
|
||||
}
|
||||
else {
|
||||
echo "<ul style='margin: 0; margin-top: 20px; padding: 0;'>\n";
|
||||
|
||||
$first = true;
|
||||
foreach ($list as $item) {
|
||||
|
||||
$iconImg = '';
|
||||
switch ($type) {
|
||||
default:
|
||||
case 'os':
|
||||
$id = $item['id_os'];
|
||||
$name = $item['name'];
|
||||
$iconImg = html_print_image(str_replace('.png' ,'_small.png', ui_print_os_icon ($item['id_os'], false, true, false)) . " ", true);
|
||||
$numh_ok = os_agents_ok($id);
|
||||
$num_critical = os_agents_critical($id);
|
||||
$num_warning = os_agents_warning($id);
|
||||
$num_unknown = os_agents_unknown($id);
|
||||
break;
|
||||
case 'group':
|
||||
$id = $item['id_grupo'];
|
||||
$name = $item['nombre'];
|
||||
$iconImg = html_print_image ("images/groups_small/" . groups_get_icon($item['id_grupo']).".png", true, array ("style" => 'vertical-align: middle; width: 16px; height: 16px;'));
|
||||
$num_ok = groups_agent_ok($id);
|
||||
$num_critical = groups_agent_critical($id);
|
||||
$num_warning = groups_agent_warning($id);
|
||||
$num_unknown = groups_agent_unknown ($id);
|
||||
break;
|
||||
case 'module_group':
|
||||
$id = $item['id_mg'];
|
||||
$name = $item['name'];
|
||||
$num_ok = modules_group_agent_ok($id);
|
||||
$num_critical = modules_group_agent_critical ($id);
|
||||
$num_warning = modules_group_agent_warning($id);
|
||||
$num_unknown = modules_group_agent_unknown($id);
|
||||
break;
|
||||
case 'policies':
|
||||
$id = $item['id'];
|
||||
$name = $item['name'];
|
||||
$num_ok = policies_agents_ok($id);
|
||||
$num_critical = policies_agents_critical($id);
|
||||
$num_warning = policies_agents_warning($id);
|
||||
$num_unknown = policies_agents_unknown($id);
|
||||
break;
|
||||
case 'module':
|
||||
$id = str_replace(array(' ','#','/'), array('_articapandora_'.ord(' ').'_pandoraartica_', '_articapandora_'.ord('#').'_pandoraartica_', '_articapandora_'.ord('/').'_pandoraartica_'),io_safe_output($item['nombre']));
|
||||
$name = io_safe_output($item['nombre']);
|
||||
$module_name = $item['nombre'];
|
||||
$num_ok = modules_agents_ok($module_name);
|
||||
$num_critical = modules_agents_critical($module_name);
|
||||
$num_warning = modules_agents_warning($module_name);
|
||||
$num_unknown = modules_agents_unknown($module_name);
|
||||
break;
|
||||
}
|
||||
|
||||
$lessBranchs = 0;
|
||||
if ($first) {
|
||||
if ($item != end($list)) {
|
||||
$img = html_print_image ("operation/tree/first_closed.png", true, array ("style" => 'vertical-align: middle;', "id" => "tree_image_" . $type . "_" . $id, "pos_tree" => "0"));
|
||||
$first = false;
|
||||
}
|
||||
else {
|
||||
$lessBranchs = 1;
|
||||
$img = html_print_image ("operation/tree/one_closed.png", true, array ("style" => 'vertical-align: middle;', "id" => "tree_image_" . $type . "_" . $id, "pos_tree" => "1"));
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ($item != end($list))
|
||||
$img = html_print_image ("operation/tree/closed.png", true, array ("style" => 'vertical-align: middle;', "id" => "tree_image_" . $type . "_" . $id, "pos_tree" => "2"));
|
||||
else
|
||||
{
|
||||
$lessBranchs = 1;
|
||||
$img = html_print_image ("operation/tree/last_closed.png", true, array ("style" => 'vertical-align: middle;', "id" => "tree_image_" . $type . "_" . $id, "pos_tree" => "3"));
|
||||
}
|
||||
}
|
||||
|
||||
echo "<li style='margin: 0px 0px 0px 0px;'>
|
||||
<a onfocus='JavaScript: this.blur()' href='javascript: loadSubTree(\"" . $type . "\",\"" . $id . "\", " . $lessBranchs . ", \"\")'>" .
|
||||
$img . $iconImg ." " . __($name) . ' ('.
|
||||
'<span class="green">'.'<b>'.$num_ok.'</b>'.'</span>'.
|
||||
' : <span class="red">'.$num_critical.'</span>' .
|
||||
' : <span class="yellow">'.$num_warning.'</span>'.
|
||||
' : <span class="grey">'.$num_unknown.'</span>'.') '. "</a>";
|
||||
|
||||
echo "<div hiddenDiv='1' loadDiv='0' style='margin: 0px; padding: 0px;' class='tree_view' id='tree_div_" . $type . "_" . $id . "'></div>";
|
||||
echo "</li>\n";
|
||||
}
|
||||
echo "</ul>\n";
|
||||
echo '</td>';
|
||||
echo '<td style="width:38%" valign="top">';
|
||||
echo '<div id="cont"> </div>';
|
||||
echo '</td></tr>';
|
||||
echo '</table>';
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -27,9 +27,9 @@ $menu_operation['class'] = 'operation';
|
|||
|
||||
// Agent read, Server read
|
||||
if (check_acl ($config['id_user'], 0, "AR")) {
|
||||
|
||||
|
||||
enterprise_hook ('metaconsole_menu');
|
||||
|
||||
|
||||
//View agents
|
||||
$menu_operation["estado"]["text"] = __('Monitoring');
|
||||
$menu_operation["estado"]["sec2"] = "operation/agentes/tactical";
|
||||
|
@ -39,13 +39,13 @@ if (check_acl ($config['id_user'], 0, "AR")) {
|
|||
$sub = array ();
|
||||
$sub["operation/agentes/tactical"]["text"] = __('Tactical view');
|
||||
$sub["operation/agentes/tactical"]["refr"] = 0;
|
||||
|
||||
|
||||
$sub["operation/agentes/group_view"]["text"] = __('Group view');
|
||||
$sub["operation/agentes/group_view"]["refr"] = 0;
|
||||
|
||||
$sub['operation/tree']['text'] = __('Tree view');
|
||||
$sub["operation/tree"]["refr"] = 0;
|
||||
|
||||
|
||||
$sub['operation/tree']['text'] = __('Tree view');
|
||||
$sub["operation/tree"]["refr"] = 0;
|
||||
|
||||
$sub["operation/agentes/estado_agente"]["text"] = __('Agent detail');
|
||||
$sub["operation/agentes/estado_agente"]["refr"] = 0;
|
||||
$sub["operation/agentes/estado_agente"]["subsecs"] = array(
|
||||
|
@ -129,7 +129,7 @@ if (check_acl ($config['id_user'], 0, "AR")) {
|
|||
}
|
||||
else if (!empty($config['refr'])) {
|
||||
$sub["godmode/reporting/map_builder"]["refr"] = $config['refr'];
|
||||
}
|
||||
}
|
||||
else {
|
||||
$sub["godmode/reporting/map_builder"]["refr"] = 60;
|
||||
}
|
||||
|
@ -162,15 +162,15 @@ if (check_acl ($config['id_user'], 0, "AR")) {
|
|||
}
|
||||
$sub2["operation/visual_console/render_view&id=".$layout["id"]]["text"] = mb_substr ($name, 0, 19);
|
||||
$sub2["operation/visual_console/render_view&id=".$layout["id"]]["title"] = $name;
|
||||
if (!empty($config['vc_refr'])){
|
||||
if (!empty($config['vc_refr'])) {
|
||||
$sub2["operation/visual_console/render_view&id=".$layout["id"]]["refr"] = $config['vc_refr'];
|
||||
}
|
||||
elseif (!empty($config['refr'])){
|
||||
}
|
||||
elseif (!empty($config['refr'])) {
|
||||
$sub2["operation/visual_console/render_view&id=".$layout["id"]]["refr"] = $config['refr'];
|
||||
}
|
||||
else{
|
||||
else {
|
||||
$sub2["operation/visual_console/render_view&id=".$layout["id"]]["refr"] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$sub["godmode/reporting/map_builder"]["sub2"] = $sub2;
|
||||
|
@ -180,17 +180,17 @@ if (check_acl ($config['id_user'], 0, "AR")) {
|
|||
$sub["godmode/reporting/graphs"]["subsecs"] = array(
|
||||
"operation/reporting/graph_viewer",
|
||||
"godmode/reporting/graph_builder");
|
||||
|
||||
|
||||
$sub["operation/agentes/exportdata"]["text"] = __('Export data');
|
||||
$sub["operation/agentes/exportdata"]["subsecs"] = array("operation/agentes/exportdata");
|
||||
|
||||
enterprise_hook ('dashboard_menu');
|
||||
enterprise_hook ('reporting_godmenu');
|
||||
|
||||
|
||||
enterprise_hook ('dashboard_menu');
|
||||
enterprise_hook ('reporting_godmenu');
|
||||
|
||||
|
||||
$menu_operation["reporting"]["sub"] = $sub;
|
||||
//End reporting
|
||||
|
||||
|
||||
|
||||
//INI GIS Maps
|
||||
if ($config['activate_gis']) {
|
||||
|
@ -215,9 +215,9 @@ if (check_acl ($config['id_user'], 0, "AR")) {
|
|||
|
||||
foreach ($gisMaps as $gisMap) {
|
||||
$is_in_group = in_array($gisMap['group_id'], $own_groups);
|
||||
if (!$is_in_group){
|
||||
if (!$is_in_group) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (! check_acl ($config["id_user"], $gisMap["group_id"], "IR")) {
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -22,185 +22,14 @@ define('UNKNOWN', 3);
|
|||
|
||||
global $config;
|
||||
|
||||
require_once ('include/functions_treeview.php');
|
||||
|
||||
if (is_ajax ())
|
||||
{
|
||||
|
||||
function printTable($id_agente) {
|
||||
global $config;
|
||||
|
||||
require_once ("include/functions_agents.php");
|
||||
require_once ($config["homedir"] . '/include/functions_graph.php');
|
||||
include_graphs_dependencies();
|
||||
require_once ($config['homedir'] . '/include/functions_groups.php');
|
||||
require_once ($config['homedir'] . '/include/functions_gis.php');
|
||||
|
||||
$agent = db_get_row ("tagente", "id_agente", $id_agente);
|
||||
|
||||
if ($agent === false) {
|
||||
echo '<h3 class="error">'.__('There was a problem loading agent').'</h3>';
|
||||
return;
|
||||
}
|
||||
|
||||
$is_extra = enterprise_hook('policies_is_agent_extra_policy', array($id_agente));
|
||||
|
||||
if($is_extra === ENTERPRISE_NOT_HOOK) {
|
||||
$is_extra = false;
|
||||
}
|
||||
|
||||
if (! check_acl ($config["id_user"], $agent["id_grupo"], "AR") && !$is_extra) {
|
||||
db_pandora_audit("ACL Violation",
|
||||
"Trying to access Agent General Information");
|
||||
require_once ("general/noaccess.php");
|
||||
return;
|
||||
}
|
||||
|
||||
echo '<div id="id_div3" width="450px">';
|
||||
echo '<table cellspacing="4" cellpadding="4" border="0" class="databox" style="width:70%">';
|
||||
//Agent name
|
||||
echo '<tr><td class="datos"><b>'.__('Agent name').'</b></td>';
|
||||
if ($agent['disabled']) {
|
||||
$cellName = "<em>" . ui_print_agent_name ($agent["id_agente"], true, 500, "text-transform: uppercase;", true) . ui_print_help_tip(__('Disabled'), true) . "</em>";
|
||||
}
|
||||
else {
|
||||
$cellName = ui_print_agent_name ($agent["id_agente"], true, 500, "text-transform: uppercase;", true);
|
||||
}
|
||||
echo '<td class="datos"><b>'.$cellName.'</b></td>';
|
||||
|
||||
//Addresses
|
||||
echo '<tr><td class="datos2"><b>'.__('IP Address').'</b></td>';
|
||||
echo '<td class="datos2" colspan="2">';
|
||||
$ips = array();
|
||||
$addresses = agents_get_addresses ($id_agente);
|
||||
$address = agents_get_address($id_agente);
|
||||
|
||||
foreach($addresses as $k => $add) {
|
||||
if($add == $address) {
|
||||
unset($addresses[$k]);
|
||||
}
|
||||
}
|
||||
|
||||
echo $address;
|
||||
|
||||
if (!empty($addresses)) {
|
||||
ui_print_help_tip(__('Other IP addresses').': <br>'.implode('<br>',$addresses));
|
||||
}
|
||||
|
||||
echo '</td></tr>';
|
||||
|
||||
// Agent Interval
|
||||
echo '<tr><td class="datos"><b>'.__('Interval').'</b></td>';
|
||||
echo '<td class="datos" colspan="2">'.human_time_description_raw ($agent["intervalo"]).'</td></tr>';
|
||||
|
||||
// Comments
|
||||
echo '<tr><td class="datos2"><b>'.__('Description').'</b></td>';
|
||||
echo '<td class="datos2" colspan="2">'.$agent["comentarios"].'</td></tr>';
|
||||
|
||||
// Agent version
|
||||
echo '<tr><td class="datos2"><b>'.__('Agent Version'). '</b></td>';
|
||||
echo '<td class="datos2" colspan="2">'.$agent["agent_version"].'</td></tr>';
|
||||
|
||||
// Position Information
|
||||
if ($config['activate_gis']) {
|
||||
$dataPositionAgent = gis_get_data_last_position_agent($agent['id_agente']);
|
||||
|
||||
echo '<tr><td class="datos2"><b>'.__('Position (Long, Lat)'). '</b></td>';
|
||||
echo '<td class="datos2" colspan="2">';
|
||||
|
||||
if ($dataPositionAgent === false) {
|
||||
echo __('There is no GIS data.');
|
||||
}
|
||||
else {
|
||||
echo '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&tab=gis&id_agente='.$id_agente.'">';
|
||||
if ($dataPositionAgent['description'] != "")
|
||||
echo $dataPositionAgent['description'];
|
||||
else
|
||||
echo $dataPositionAgent['stored_longitude'].', '.$dataPositionAgent['stored_latitude'];
|
||||
echo "</a>";
|
||||
}
|
||||
|
||||
echo '</td></tr>';
|
||||
}
|
||||
|
||||
// If the url description is setted
|
||||
if ($agent['url_address'] != ''){
|
||||
echo '<tr><td class="datos"><b>'.__('Url address').'</b></td>';
|
||||
echo '<td class="datos2" colspan="2"><a href='.$agent["url_address"].'>' . $agent["url_address"] . '</a></td></tr>';
|
||||
}
|
||||
|
||||
// Last contact
|
||||
echo '<tr><td class="datos2"><b>'.__('Last contact')." / ".__('Remote').'</b></td><td class="datos2 f9" colspan="2">';
|
||||
ui_print_timestamp ($agent["ultimo_contacto"]);
|
||||
|
||||
echo " / ";
|
||||
|
||||
if ($agent["ultimo_contacto_remoto"] == "01-01-1970 00:00:00") {
|
||||
echo __('Never');
|
||||
}
|
||||
else {
|
||||
echo $agent["ultimo_contacto_remoto"];
|
||||
}
|
||||
echo '</td></tr>';
|
||||
|
||||
// Timezone Offset
|
||||
if ($agent['timezone_offset'] != 0) {
|
||||
echo '<tr><td class="datos2"><b>'.__('Timezone Offset'). '</b></td>';
|
||||
echo '<td class="datos2" colspan="2">'.$agent["timezone_offset"].'</td></tr>';
|
||||
}
|
||||
// Next contact (agent)
|
||||
$progress = agents_get_next_contact($id_agente);
|
||||
|
||||
echo '<tr><td class="datos"><b>'.__('Next agent contact').'</b></td>';
|
||||
echo '<td class="datos f9" colspan="2">' . progress_bar($progress, 200, 20) . '</td></tr>';
|
||||
|
||||
// Custom fields
|
||||
$fields = db_get_all_rows_filter('tagent_custom_fields', array('display_on_front' => 1));
|
||||
if ($fields === false) {
|
||||
$fields = array ();
|
||||
}
|
||||
if ($fields)
|
||||
foreach($fields as $field) {
|
||||
echo '<tr><td class="datos"><b>'.$field['name'] . ui_print_help_tip (__('Custom field'), true).'</b></td>';
|
||||
$custom_value = db_get_value_filter('description', 'tagent_custom_data', array('id_field' => $field['id_field'], 'id_agent' => $id_agente));
|
||||
if($custom_value === false || $custom_value == '') {
|
||||
$custom_value = '<i>-'.__('empty').'-</i>';
|
||||
}
|
||||
echo '<td class="datos f9" colspan="2">'.$custom_value.'</td></tr>';
|
||||
}
|
||||
|
||||
//End of table
|
||||
echo '</table></div>';
|
||||
|
||||
// Blank space below title, DONT remove this, this
|
||||
// Breaks the layout when Flash charts are enabled :-o
|
||||
echo '<div id="id_div" style="height: 10px"> </div>';
|
||||
|
||||
//Floating div
|
||||
echo '<div id="agent_access" width:35%; padding-top:11px;">';
|
||||
|
||||
if ($config["agentaccess"]){
|
||||
echo '<b>'.__('Agent access rate (24h)').'</b><br />';
|
||||
|
||||
graphic_agentaccess($id_agente, 280, 110, 86400);
|
||||
}
|
||||
|
||||
echo '<br>';
|
||||
graph_graphic_agentevents ($id_agente, 290, 15, 86400, '');
|
||||
|
||||
echo '</div>';
|
||||
|
||||
echo '<form id="agent_detail" method="post" action="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$id_agente.'">';
|
||||
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
||||
html_print_submit_button (__('Go to agent detail'), 'upd_button', false, 'class="sub upd"');
|
||||
echo '</div>';
|
||||
echo '</form>';
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
require_once ('include/functions_reporting.php');
|
||||
require_once ('include/functions_users.php');
|
||||
require_once ('include/functions_servers.php');
|
||||
|
||||
|
||||
global $config;
|
||||
|
||||
$enterpriseEnable = false;
|
||||
|
@ -215,10 +44,10 @@ if (is_ajax ())
|
|||
$statusSel = get_parameter('status');
|
||||
$search_free = get_parameter('search_free', '');
|
||||
$printTable = get_parameter('printTable', 0);
|
||||
|
||||
|
||||
if ($printTable) {
|
||||
$id_agente = get_parameter('id_agente');
|
||||
printTable($id_agente);
|
||||
treeview_printTable($id_agente);
|
||||
}
|
||||
/*
|
||||
* It's a binary for branch (0 show - 1 hide)
|
||||
|
@ -227,7 +56,7 @@ if (is_ajax ())
|
|||
* 0 1 - hide the 2º branch
|
||||
* 1 0 - hide the 1º branch
|
||||
* 1 1 - hide 2 branch
|
||||
*/
|
||||
*/
|
||||
$lessBranchs = get_parameter('less_branchs');
|
||||
|
||||
switch ($type) {
|
||||
|
@ -395,6 +224,8 @@ if (is_ajax ())
|
|||
|
||||
$countRows = db_get_num_rows($sql);
|
||||
}
|
||||
|
||||
//Empty Branch
|
||||
if ($countRows === 0) {
|
||||
echo "<ul style='margin: 0; padding: 0;'>\n";
|
||||
echo "<li style='margin: 0; padding: 0;'>";
|
||||
|
@ -408,6 +239,7 @@ if (is_ajax ())
|
|||
return;
|
||||
}
|
||||
|
||||
//Branch with items
|
||||
$new = true;
|
||||
$count = 0;
|
||||
echo "<ul style='margin: 0; padding: 0;'>\n";
|
||||
|
@ -592,6 +424,10 @@ if (is_ajax ())
|
|||
ui_print_timestamp ($agent_info["last_contact"]);
|
||||
echo ")";
|
||||
}
|
||||
if ($row['quiet']) {
|
||||
echo " ";
|
||||
html_print_image("images/dot_green.disabled.png", false, array("border" => '0', "title" => __('Quiet'), "alt" => ""));
|
||||
}
|
||||
echo "</a>";
|
||||
echo "<div hiddenDiv='1' loadDiv='0' style='margin: 0px; padding: 0px;' class='tree_view' id='tree_div" . $id . "_agent_" . $type . "_" . $row["id_agente"] . "'></div>";
|
||||
echo "</li>";
|
||||
|
@ -599,7 +435,7 @@ if (is_ajax ())
|
|||
|
||||
echo "</ul>\n";
|
||||
break;
|
||||
|
||||
|
||||
//also aknolegment as second subtree/branch
|
||||
case 'agent_group':
|
||||
case 'agent_module_group':
|
||||
|
@ -765,6 +601,10 @@ if (is_ajax ())
|
|||
echo "<a href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=" . $row['id_agente'] . "&tab=data_view&period=86400&id=".$row["id_agente_modulo"]."'>" . html_print_image ("images/binary.png", true, array ("style" => 'vertical-align: middle;', "border" => "0" )) . "</a>";
|
||||
echo " ";
|
||||
echo io_safe_output($row['nombre']);
|
||||
if ($row['quiet']) {
|
||||
echo " ";
|
||||
html_print_image("images/dot_green.disabled.png", false, array("border" => '0', "title" => __('Quiet'), "alt" => ""));
|
||||
}
|
||||
|
||||
if (is_numeric($row["datos"]))
|
||||
$data = format_numeric($row["datos"]);
|
||||
|
@ -789,7 +629,7 @@ if (is_ajax ())
|
|||
|
||||
return;
|
||||
}
|
||||
|
||||
//End of AJAX code.
|
||||
|
||||
include_once($config['homedir'] . "/include/functions_groups.php");
|
||||
include_once($config['homedir'] . "/include/functions_os.php");
|
||||
|
@ -798,501 +638,6 @@ include_once($config['homedir'] . "/include/functions_servers.php");
|
|||
include_once($config['homedir'] . "/include/functions_reporting.php");
|
||||
include_once($config['homedir'] . "/include/functions_ui.php");
|
||||
|
||||
|
||||
function printTree_($type) {
|
||||
global $config;
|
||||
|
||||
$search_free = get_parameter('search_free', '');
|
||||
$select_status = get_parameter('status', -1);
|
||||
|
||||
echo '<table class="databox" style="width:98%">';
|
||||
echo '<tr><td style="width:60%" valign="top">';
|
||||
|
||||
//Get all groups
|
||||
$avariableGroups = users_get_groups (); //db_get_all_rows_in_table('tgrupo', 'nombre');
|
||||
|
||||
//Get all groups with agents
|
||||
$full_groups = db_get_all_rows_sql("SELECT DISTINCT tagente.id_grupo
|
||||
FROM tagente, tagente_estado
|
||||
WHERE tagente.id_agente = tagente_estado.id_agente AND
|
||||
tagente_estado.utimestamp != 0
|
||||
UNION
|
||||
SELECT tagente.id_grupo
|
||||
FROM tagente
|
||||
WHERE disabled = 0
|
||||
AND id_agente NOT IN (SELECT tagente.id_agente
|
||||
FROM tagente, tagente_modulo
|
||||
WHERE tagente.id_agente = tagente_modulo.id_agente
|
||||
AND tagente.disabled = 0
|
||||
AND tagente_modulo.disabled = 0
|
||||
group by tagente.id_agente
|
||||
having COUNT(*) > 0)");
|
||||
|
||||
$fgroups = array();
|
||||
|
||||
foreach ($full_groups as $fg) {
|
||||
$fgroups[$fg['id_grupo']] = "";
|
||||
}
|
||||
|
||||
// We only want groups with agents, so we need the intesect of both arrays.
|
||||
// Not for policies, we need all groups
|
||||
if ($type != 'policies')
|
||||
$avariableGroups = array_intersect_key($avariableGroups, $fgroups);
|
||||
|
||||
$avariableGroupsIds = implode(',',array_keys($avariableGroups));
|
||||
if($avariableGroupsIds == ''){
|
||||
$avariableGroupsIds == -1;
|
||||
}
|
||||
|
||||
if ($type !== 'policies') {
|
||||
// Filter groups by agent status
|
||||
switch ($select_status) {
|
||||
case NORMAL:
|
||||
foreach ($avariableGroups as $group_name) {
|
||||
$id_group = db_get_value_sql('SELECT id_grupo FROM tgrupo where nombre ="' . $group_name . '"');
|
||||
|
||||
$num_ok = groups_agent_ok($id_group);
|
||||
|
||||
if ($num_ok <= 0)
|
||||
unset($avariableGroups[$id_group]);
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
case WARNING:
|
||||
foreach ($avariableGroups as $group_name) {
|
||||
$id_group = db_get_value_sql('SELECT id_grupo FROM tgrupo where nombre ="' . $group_name . '"');
|
||||
|
||||
$num_warning = groups_agent_warning($id_group);
|
||||
|
||||
if ($num_warning <= 0)
|
||||
unset($avariableGroups[$id_group]);
|
||||
}
|
||||
break;
|
||||
case CRITICAL:
|
||||
foreach ($avariableGroups as $group_name) {
|
||||
$id_group = db_get_value_sql('SELECT id_grupo FROM tgrupo where nombre ="' . $group_name . '"');
|
||||
|
||||
$num_critical = groups_agent_critical($id_group);
|
||||
|
||||
if ($num_critical <= 0)
|
||||
unset($avariableGroups[$id_group]);
|
||||
}
|
||||
break;
|
||||
case UNKNOWN:
|
||||
foreach ($avariableGroups as $group_name) {
|
||||
$id_group = db_get_value_sql('SELECT id_grupo FROM tgrupo where nombre ="' . $group_name . '"');
|
||||
|
||||
$num_unknown = groups_agent_unknown($id_group);
|
||||
|
||||
if ($num_unknown <= 0)
|
||||
unset($avariableGroups[$id_group]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// If there are not groups display error and return
|
||||
if (empty($avariableGroups)) {
|
||||
ui_print_error_message("There aren't agents in this agrupation");
|
||||
echo '</td></tr>';
|
||||
echo '</table>';
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if ($search_free != '') {
|
||||
$sql_search = " AND id_grupo IN (SELECT id_grupo FROM tagente
|
||||
WHERE nombre COLLATE utf8_general_ci LIKE '%$search_free%')";
|
||||
}
|
||||
else {
|
||||
$sql_search ='';
|
||||
}
|
||||
|
||||
|
||||
switch ($type) {
|
||||
default:
|
||||
case 'os':
|
||||
//Skip agent with all modules in not init status
|
||||
|
||||
$sql_search .= " AND id_agente NOT IN (SELECT tagente_estado.id_agente FROM
|
||||
tagente_estado GROUP BY id_agente HAVING SUM(utimestamp) = 0)";
|
||||
|
||||
$sql = agents_get_agents(array (
|
||||
'order' => 'nombre COLLATE utf8_general_ci ASC',
|
||||
'disabled' => 0,
|
||||
'status' => $select_status,
|
||||
'search' => $sql_search),
|
||||
|
||||
array ('tagente.id_os'),
|
||||
'AR',
|
||||
false,
|
||||
true);
|
||||
|
||||
$sql_os = sprintf("SELECT * FROM tconfig_os WHERE id_os IN (%s)", $sql);
|
||||
|
||||
$list = db_get_all_rows_sql($sql_os);
|
||||
|
||||
break;
|
||||
case 'group':
|
||||
$stringAvariableGroups = (
|
||||
implode(', ',
|
||||
array_map(
|
||||
create_function('&$itemA', '{ return "\'" . $itemA . "\'"; }'), $avariableGroups
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
case "postgresql":
|
||||
$list = db_get_all_rows_sql("SELECT * FROM tgrupo WHERE nombre IN (" . $stringAvariableGroups . ") $sql_search");
|
||||
break;
|
||||
case "oracle":
|
||||
$list = db_get_all_rows_sql("SELECT * FROM tgrupo WHERE dbms_lob.substr(nombre,4000,1) IN (" . $stringAvariableGroups . ")");
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'module_group':
|
||||
//Skip agents which only have not init modules
|
||||
$sql_search .= " AND id_agente NOT IN (SELECT tagente_estado.id_agente FROM
|
||||
tagente_estado GROUP BY id_agente HAVING SUM(utimestamp) = 0)";
|
||||
|
||||
$sql = agents_get_agents(array (
|
||||
'order' => 'nombre COLLATE utf8_general_ci ASC',
|
||||
'disabled' => 0,
|
||||
'status' => $select_status,
|
||||
'search' => $sql_search),
|
||||
array ('id_agente'),
|
||||
'AR',
|
||||
false,
|
||||
true);
|
||||
|
||||
// Skip agents without modules
|
||||
$sql .= ' AND id_agente IN
|
||||
(SELECT tagente.id_agente
|
||||
FROM tagente, tagente_modulo
|
||||
WHERE tagente.id_agente = tagente_modulo.id_agente
|
||||
AND tagente.disabled = 0
|
||||
AND tagente_modulo.disabled = 0
|
||||
group by tagente.id_agente
|
||||
having COUNT(*) > 0)';
|
||||
|
||||
$sql_module_groups = sprintf("SELECT * FROM tmodule_group
|
||||
WHERE id_mg IN (SELECT id_module_group FROM tagente_modulo WHERE id_agente IN (%s))", $sql);
|
||||
|
||||
|
||||
$list = db_get_all_rows_sql($sql_module_groups);
|
||||
|
||||
if ($list == false) {
|
||||
$list = array();
|
||||
}
|
||||
|
||||
array_push($list, array('id_mg' => 0, 'name' => 'Not assigned'));
|
||||
|
||||
break;
|
||||
case 'policies':
|
||||
$avariableGroups = users_get_groups ();
|
||||
|
||||
$groups_id = array_keys($avariableGroups);
|
||||
$groups = implode(',',$groups_id);
|
||||
|
||||
if ($search_free != '') {
|
||||
$sql = "SELECT DISTINCT tpolicies.id, tpolicies.name
|
||||
FROM tpolicies, tpolicy_modules,
|
||||
tagente_estado, tagente, tagente_modulo
|
||||
WHERE
|
||||
tagente.id_agente = tagente_estado.id_agente AND
|
||||
tagente_modulo.id_agente = tagente_estado.id_agente AND
|
||||
tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo AND
|
||||
tagente_estado.utimestamp != 0 AND
|
||||
tagente_modulo.id_policy_module != 0 AND
|
||||
tpolicy_modules.id = tagente_modulo.id_policy_module AND
|
||||
tpolicies.id = tpolicy_modules.id_policy AND
|
||||
tagente.id_grupo IN ($groups) AND
|
||||
tagente.nombre LIKE '%$search_free%' AND
|
||||
tagente.disabled = 0 AND
|
||||
tagente_modulo.disabled = 0";
|
||||
|
||||
$list = db_get_all_rows_sql($sql);
|
||||
|
||||
if ($list === false)
|
||||
$list = array();
|
||||
|
||||
$element = 0;
|
||||
switch ($select_status) {
|
||||
case NORMAL:
|
||||
foreach ($list as $policy_element) {
|
||||
|
||||
$policy_agents_ok = policies_agents_ok($policy_element['id']);
|
||||
|
||||
if ($policy_agents_ok <= 0)
|
||||
unset($list[$element]);
|
||||
|
||||
$element++;
|
||||
}
|
||||
break;
|
||||
case CRITICAL:
|
||||
foreach ($list as $policy_element) {
|
||||
|
||||
$policy_agents_critical = policies_agents_critical($policy_element['id']);
|
||||
|
||||
if ($policy_agents_critical <= 0)
|
||||
unset($list[$element]);
|
||||
|
||||
$element++;
|
||||
}
|
||||
break;
|
||||
case WARNING:
|
||||
foreach ($list as $policy_element) {
|
||||
|
||||
$policy_agents_warning = policies_agents_warning($policy_element['id']);
|
||||
|
||||
if ($policy_agents_warning <= 0)
|
||||
unset($list[$element]);
|
||||
|
||||
$element++;
|
||||
}
|
||||
break;
|
||||
case UNKNOWN:
|
||||
foreach ($list as $policy_element) {
|
||||
|
||||
$policy_agents_unknown = policies_agents_unknown($policy_element['id']);
|
||||
|
||||
if ($policy_agents_unknown <= 0)
|
||||
unset($list[$element]);
|
||||
|
||||
$element++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if ($list === false)
|
||||
$list = array();
|
||||
|
||||
array_push($list, array('id' => 0, 'name' => 'No policy'));
|
||||
}
|
||||
else {
|
||||
$list = db_get_all_rows_sql("SELECT DISTINCT tpolicies.id,
|
||||
tpolicies.name
|
||||
FROM tpolicies, tpolicy_modules, tagente_estado,
|
||||
tagente, tagente_modulo
|
||||
WHERE
|
||||
tagente.id_agente = tagente_estado.id_agente AND
|
||||
tagente_modulo.id_agente = tagente_estado.id_agente AND
|
||||
tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo AND
|
||||
tagente_estado.utimestamp != 0 AND
|
||||
tagente_modulo.id_policy_module != 0 AND
|
||||
tpolicy_modules.id = tagente_modulo.id_policy_module AND
|
||||
tpolicies.id = tpolicy_modules.id_policy AND
|
||||
tagente.id_grupo IN ($groups) AND
|
||||
tagente.disabled = 0 AND
|
||||
tagente_modulo.disabled = 0");
|
||||
|
||||
$element = 0;
|
||||
switch ($select_status) {
|
||||
case NORMAL:
|
||||
foreach ($list as $policy_element) {
|
||||
|
||||
$policy_agents_ok = policies_agents_ok($policy_element['id']);
|
||||
|
||||
if ($policy_agents_ok <= 0)
|
||||
unset($list[$element]);
|
||||
|
||||
$element++;
|
||||
}
|
||||
break;
|
||||
case CRITICAL:
|
||||
foreach ($list as $policy_element) {
|
||||
|
||||
$policy_agents_critical = policies_agents_critical($policy_element['id']);
|
||||
|
||||
if ($policy_agents_critical <= 0)
|
||||
unset($list[$element]);
|
||||
|
||||
$element++;
|
||||
}
|
||||
break;
|
||||
case WARNING:
|
||||
foreach ($list as $policy_element) {
|
||||
|
||||
$policy_agents_warning = policies_agents_warning($policy_element['id']);
|
||||
|
||||
if ($policy_agents_warning <= 0)
|
||||
unset($list[$element]);
|
||||
|
||||
$element++;
|
||||
}
|
||||
break;
|
||||
case UNKNOWN:
|
||||
foreach ($list as $policy_element) {
|
||||
|
||||
$policy_agents_unknown = policies_agents_unknown($policy_element['id']);
|
||||
|
||||
if ($policy_agents_unknown <= 0)
|
||||
unset($list[$element]);
|
||||
|
||||
$element++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if ($list === false)
|
||||
$list = array();
|
||||
|
||||
array_push($list, array('id' => 0, 'name' => 'No policy'));
|
||||
}
|
||||
break;
|
||||
case 'module':
|
||||
$avariableGroupsIds = implode(',',array_keys($avariableGroups));
|
||||
if($avariableGroupsIds == ''){
|
||||
$avariableGroupsIds == -1;
|
||||
}
|
||||
|
||||
if ($search_free != '') {
|
||||
$sql_search = " AND t1.id_agente IN (SELECT id_agente FROM tagente
|
||||
WHERE nombre COLLATE utf8_general_ci LIKE '%$search_free%')";
|
||||
}
|
||||
else {
|
||||
$sql_search = '';
|
||||
}
|
||||
|
||||
if ($select_status != -1)
|
||||
$sql_search .= " AND estado = " . $select_status . " ";
|
||||
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
case "postgresql":
|
||||
$list = db_get_all_rows_sql('SELECT t1.nombre
|
||||
FROM tagente_modulo t1, tagente t2,
|
||||
tagente_estado t3
|
||||
WHERE t1.id_agente = t2.id_agente AND
|
||||
t1.id_agente_modulo = t3.id_agente_modulo AND
|
||||
t2.disabled = 0 AND t1.disabled = 0 AND
|
||||
t3.utimestamp !=0 AND
|
||||
t2.id_grupo in (' . $avariableGroupsIds . ')' .
|
||||
$sql_search.'
|
||||
GROUP BY t1.nombre ORDER BY t1.nombre');
|
||||
break;
|
||||
case "oracle":
|
||||
$list = db_get_all_rows_sql('
|
||||
SELECT dbms_lob.substr(t1.nombre,4000,1) as nombre
|
||||
FROM tagente_modulo t1, tagente t2,
|
||||
tagente_estado t3
|
||||
WHERE t1.id_agente = t2.id_agente AND
|
||||
t2.id_grupo in (' . $avariableGroupsIds . ') AND
|
||||
t1.id_agente_modulo = t3.id_agente_modulo AND
|
||||
t2.disabled = 0 AND
|
||||
t1.disabled = 0 AND
|
||||
t3.utimestamp !=0
|
||||
GROUP BY dbms_lob.substr(t1.nombre,4000,1)
|
||||
ORDER BY dbms_lob.substr(t1.nombre,4000,1) ASC');
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if ($list === false) {
|
||||
ui_print_error_message("There aren't agents in this agrupation");
|
||||
echo '</td></tr>';
|
||||
echo '</table>';
|
||||
}
|
||||
else {
|
||||
echo "<ul style='margin: 0; margin-top: 20px; padding: 0;'>\n";
|
||||
|
||||
$first = true;
|
||||
foreach ($list as $item) {
|
||||
|
||||
$iconImg = '';
|
||||
switch ($type) {
|
||||
default:
|
||||
case 'os':
|
||||
$id = $item['id_os'];
|
||||
$name = $item['name'];
|
||||
$iconImg = html_print_image(str_replace('.png' ,'_small.png', ui_print_os_icon ($item['id_os'], false, true, false)) . " ", true);
|
||||
$num_ok = os_agents_ok($id);
|
||||
$num_critical = os_agents_critical($id);
|
||||
$num_warning = os_agents_warning($id);
|
||||
$num_unknown = os_agents_unknown($id);
|
||||
break;
|
||||
case 'group':
|
||||
$id = $item['id_grupo'];
|
||||
$name = $item['nombre'];
|
||||
$iconImg = html_print_image ("images/groups_small/" . groups_get_icon($item['id_grupo']).".png", true, array ("style" => 'vertical-align: middle; width: 16px; height: 16px;'));
|
||||
$num_ok = groups_agent_ok($id);
|
||||
$num_critical = groups_agent_critical($id);
|
||||
$num_warning = groups_agent_warning($id);
|
||||
$num_unknown = groups_agent_unknown ($id);
|
||||
break;
|
||||
case 'module_group':
|
||||
$id = $item['id_mg'];
|
||||
$name = $item['name'];
|
||||
$num_ok = modules_group_agent_ok($id);
|
||||
$num_critical = modules_group_agent_critical ($id);
|
||||
$num_warning = modules_group_agent_warning($id);
|
||||
$num_unknown = modules_group_agent_unknown($id);
|
||||
break;
|
||||
case 'policies':
|
||||
$id = $item['id'];
|
||||
$name = $item['name'];
|
||||
$num_ok = policies_agents_ok($id);
|
||||
$num_critical = policies_agents_critical($id);
|
||||
$num_warning = policies_agents_warning($id);
|
||||
$num_unknown = policies_agents_unknown($id);
|
||||
break;
|
||||
case 'module':
|
||||
$id = str_replace(array(' ','#','/'), array('_articapandora_'.ord(' ').'_pandoraartica_', '_articapandora_'.ord('#').'_pandoraartica_', '_articapandora_'.ord('/').'_pandoraartica_'),io_safe_output($item['nombre']));
|
||||
$name = io_safe_output($item['nombre']);
|
||||
$module_name = $item['nombre'];
|
||||
$num_ok = modules_agents_ok($module_name);
|
||||
$num_critical = modules_agents_critical($module_name);
|
||||
$num_warning = modules_agents_warning($module_name);
|
||||
$num_unknown = modules_agents_unknown($module_name);
|
||||
break;
|
||||
}
|
||||
|
||||
$lessBranchs = 0;
|
||||
if ($first) {
|
||||
if ($item != end($list)) {
|
||||
$img = html_print_image ("operation/tree/first_closed.png", true, array ("style" => 'vertical-align: middle;', "id" => "tree_image_" . $type . "_" . $id, "pos_tree" => "0"));
|
||||
$first = false;
|
||||
}
|
||||
else {
|
||||
$lessBranchs = 1;
|
||||
$img = html_print_image ("operation/tree/one_closed.png", true, array ("style" => 'vertical-align: middle;', "id" => "tree_image_" . $type . "_" . $id, "pos_tree" => "1"));
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ($item != end($list))
|
||||
$img = html_print_image ("operation/tree/closed.png", true, array ("style" => 'vertical-align: middle;', "id" => "tree_image_" . $type . "_" . $id, "pos_tree" => "2"));
|
||||
else
|
||||
{
|
||||
$lessBranchs = 1;
|
||||
$img = html_print_image ("operation/tree/last_closed.png", true, array ("style" => 'vertical-align: middle;', "id" => "tree_image_" . $type . "_" . $id, "pos_tree" => "3"));
|
||||
}
|
||||
}
|
||||
|
||||
echo "<li style='margin: 0px 0px 0px 0px;'>
|
||||
<a onfocus='JavaScript: this.blur()' href='javascript: loadSubTree(\"" . $type . "\",\"" . $id . "\", " . $lessBranchs . ", \"\")'>" .
|
||||
$img . $iconImg ." " . __($name) . ' ('.
|
||||
'<span class="green">'.'<b>'.$num_ok.'</b>'.'</span>'.
|
||||
' : <span class="red">'.$num_critical.'</span>' .
|
||||
' : <span class="yellow">'.$num_warning.'</span>'.
|
||||
' : <span class="grey">'.$num_unknown.'</span>'.') '. "</a>";
|
||||
|
||||
echo "<div hiddenDiv='1' loadDiv='0' style='margin: 0px; padding: 0px;' class='tree_view' id='tree_div_" . $type . "_" . $id . "'></div>";
|
||||
echo "</li>\n";
|
||||
}
|
||||
echo "</ul>\n";
|
||||
echo '</td>';
|
||||
echo '<td style="width:38%" valign="top">';
|
||||
echo '<div id="cont"> </div>';
|
||||
echo '</td></tr>';
|
||||
echo '</table>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
global $config;
|
||||
|
||||
$enterpriseEnable = false;
|
||||
|
@ -1300,7 +645,7 @@ if (enterprise_include_once('include/functions_policies.php') !== ENTERPRISE_NOT
|
|||
$enterpriseEnable = true;
|
||||
}
|
||||
|
||||
///////// INI MENU AND TABS /////////////
|
||||
///////// INI MENU AND TABS /////////////
|
||||
$img_style = array ("class" => "top", "width" => 16);
|
||||
$activeTab = get_parameter('sort_by','group');
|
||||
|
||||
|
@ -1372,9 +717,11 @@ echo "</form>";
|
|||
echo "<div class='pepito' id='a'></div>";
|
||||
echo "<div class='pepito' id='b'></div>";
|
||||
echo "<div class='pepito' id='c'></div>";
|
||||
///////// END MENU AND TABS /////////////
|
||||
printTree_($activeTab);
|
||||
///////// END MENU AND TABS /////////////
|
||||
|
||||
|
||||
|
||||
treeview_printTree($activeTab);
|
||||
?>
|
||||
|
||||
<script language="javascript" type="text/javascript">
|
||||
|
@ -1511,10 +858,10 @@ printTree_($activeTab);
|
|||
url: "ajax.php",
|
||||
data: "page=<?php echo $_GET['sec2']; ?>&printTable=1&id_agente=" +
|
||||
id_agent, success: function(data){
|
||||
$('#cont').html(data);
|
||||
$('#cont').html(data);
|
||||
}
|
||||
});
|
||||
|
||||
loadSubTree(type, div_id, less_branchs, id_father);
|
||||
loadSubTree(type, div_id, less_branchs, id_father);
|
||||
}
|
||||
</script>
|
Loading…
Reference in New Issue