'.__('There was a problem loading agent').''; 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 '
'.__('Agent name').' | '; if ($agent['disabled']) { $cellName = "" . ui_print_agent_name ($agent["id_agente"], true, 500, "text-transform: uppercase;", true) . ui_print_help_tip(__('Disabled'), true) . ""; } else { $cellName = ui_print_agent_name ($agent["id_agente"], true, 500, "text-transform: uppercase;", true); } echo ''.$cellName.' | '; //Addresses echo '|
'.__('IP Address').' | '; echo '';
$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').': '.implode(' ',$addresses)); } echo ' | |
'.__('Interval').' | '; echo ''.human_time_description_raw ($agent["intervalo"]).' | |
'.__('Description').' | '; echo ''.$agent["comentarios"].' | |
'.__('Agent Version'). ' | '; echo ''.$agent["agent_version"].' | |
'.__('Position (Long, Lat)'). ' | '; echo ''; if ($dataPositionAgent === false) { echo __('There is no GIS data.'); } else { echo ''; if ($dataPositionAgent['description'] != "") echo $dataPositionAgent['description']; else echo $dataPositionAgent['stored_longitude'].', '.$dataPositionAgent['stored_latitude']; echo ""; } echo ' | |
'.__('Url address').' | '; echo '' . $agent["url_address"] . ' | |
'.__('Last contact')." / ".__('Remote').' | '; 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 ' | |
'.__('Timezone Offset'). ' | '; echo ''.$agent["timezone_offset"].' | |
'.__('Next agent contact').' | '; echo '' . progress_bar($progress, 200, 20) . ' | |
'.$field['name'] . ui_print_help_tip (__('Custom field'), true).' | '; $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 = '-'.__('empty').'-'; } echo ''.$custom_value.' |
';
//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 id_grupo FROM tagente");
$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.
$avariableGroups = array_intersect_key($avariableGroups, $fgroups);
$avariableGroupsIds = implode(',',array_keys($avariableGroups));
if($avariableGroupsIds == ''){
$avariableGroupsIds == -1;
}
switch ($type) {
default:
case 'os':
if ($search_free != '') {
$sql = "SELECT * FROM tconfig_os
WHERE id_os IN (SELECT id_os FROM tagente
WHERE nombre COLLATE utf8_general_ci LIKE '%$search_free%')";
$list = db_get_all_rows_sql($sql);
} else {
$list = db_get_all_rows_sql("SELECT DISTINCT (tagente.id_os), tconfig_os.name FROM tagente, tconfig_os WHERE tagente.id_os = tconfig_os.id_os");
}
break;
case 'group':
$stringAvariableGroups = (
implode(', ',
array_map(
create_function('&$itemA', '{ return "\'" . $itemA . "\'"; }'), $avariableGroups
)
)
);
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 ($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':
if ($search_free != '') {
$sql = "SELECT * FROM tmodule_group
WHERE id_mg IN (SELECT id_module_group FROM tagente_modulo
WHERE id_agente IN (SELECT id_agente FROM tagente
WHERE nombre COLLATE utf8_general_ci LIKE '%$search_free%'))";
$list = db_get_all_rows_sql($sql);
} else {
$list = db_get_all_rows_sql("SELECT distinct id_mg, name FROM tmodule_group, tagente_modulo WHERE tmodule_group.id_mg = tagente_modulo.id_module_group");
if ($list !== false)
array_push($list, array('id_mg' => 0, 'name' => 'Not assigned'));
}
break;
case 'policies':
$groups_id = array_keys($avariableGroups);
$groups = implode(',',$groups_id);
if ($search_free != '') {
$sql = "SELECT * FROM tpolicies
WHERE id_group IN ($groups)
AND id IN (SELECT id_policy FROM tpolicy_agents
WHERE id_agent IN (SELECT id_agente FROM tagente
WHERE nombre COLLATE utf8_general_ci LIKE '%$search_free%'))";
$list = db_get_all_rows_sql($sql);
} 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
tpolicies.id_group IN ($groups)");
if ($list !== false)
array_push($list, array('id' => 0, 'name' => 'No policy'));
}
break;
case 'module':
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 ='';
}
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 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 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");
}
else {
echo "
| ';
echo '';
echo ' ';
echo ' ';
echo' ';
echo ' |