$agent['id_agente'], 'name' => io_safe_output($agent['nombre']), 'ip' => io_safe_output($agent['direccion']), ]; } echo io_json_mb_encode($data); return; } $get_modules_json_for_multiple_snmp = (bool) get_parameter('get_modules_json_for_multiple_snmp', 0); if ($get_modules_json_for_multiple_snmp) { include_once 'include/graphs/functions_utils.php'; $idSNMP = get_parameter('id_snmp'); $id_snmp_serialize = get_parameter('id_snmp_serialize'); $snmp = unserialize_in_temp($id_snmp_serialize, false); $oid_snmp = []; $out = false; foreach ($idSNMP as $id) { foreach ($snmp[$id] as $key => $value) { // Check if it has "ifXXXX" syntax and skip it if (! preg_match('/if/', $key)) { continue; } $oid_snmp[$value['oid']] = $key; } if ($out === false) { $out = $oid_snmp; } else { $out = array_intersect($out, $oid_snmp); } $oid_snmp = []; } echo io_json_mb_encode($out); } // And and remove groups use the same function $add_secondary_groups = get_parameter('add_secondary_groups'); $remove_secondary_groups = get_parameter('remove_secondary_groups'); if ($add_secondary_groups || $remove_secondary_groups) { $id_agent = get_parameter('id_agent'); $groups_to_add = get_parameter('groups'); if (enterprise_installed()) { if (empty($groups_to_add)) { return 0; } enterprise_include('include/functions_agents.php'); $ret = enterprise_hook( 'agents_update_secondary_groups', [ $id_agent, $add_secondary_groups ? $groups_to_add : [], $remove_secondary_groups ? $groups_to_add : [], ] ); // Echo 0 in case of error. 0 Otherwise. echo $ret ? 1 : 0; } } return; } ui_require_javascript_file('openlayers.pandora'); $new_agent = (bool) get_parameter('new_agent'); if (! isset($id_agente) && ! $new_agent) { db_pandora_audit('ACL Violation', 'Trying to access agent manager witout an agent'); include 'general/noaccess.php'; return; } if ($new_agent) { if (! empty($direccion_agente) && empty($nombre_agente)) { $nombre_agente = $direccion_agente; } $servers = servers_get_names(); if (!empty($servers)) { $array_keys_servers = array_keys($servers); $server_name = reset($array_keys_servers); } } if (!$new_agent) { // Agent remote configuration editor enterprise_include_once('include/functions_config_agents.php'); if (enterprise_installed()) { $filename = config_agents_get_agent_config_filenames($id_agente); } } $disk_conf_delete = (bool) get_parameter('disk_conf_delete'); // Agent remote configuration DELETE if ($disk_conf_delete) { // TODO: Get this working on computers where the Pandora server(s) are not on the webserver // TODO: Get a remote_config editor working in the open version @unlink($filename['md5']); @unlink($filename['conf']); } echo '