2008-12-12 Evi Vanoost <vanooste@rcbi.rochester.edu>

* pandora_console/operation/agentes/datos_agente.php: Rewrite. Uses new
	functions and better security and validation
	
	* pandora_console/include/functions_db.php: Renamed some functions and
	created agentmodule functions for consistency with documentation and to
	avoid searching for and typing certain function names: 
	get_agentmodules is now get_agent_modules; 
	dame_grupo is now get_group_name; 
	dame_nombre_agente is now get_agent_name; get_agentmodule_agent is new; 
	dame_nombre_agente_agentemodulo is now get_agentmodule_agent_name;
	dame_nombre_modulo_agentemodulo is now get_agentmodule_name;
	dame_id_tipo_modulo_agentemodulo is now get_agentmodule_type;
	dame_nombre_tipo_modulo is now get_moduletype_name; dame_nombre_grupo is
	now get_group_name; get_agentmodule_count is get_agent_modules_count;
	get_agentmodule_group is new; get_agent_group is new;
	
	* pandora_console/include/functions_reporting.php, 
	pandora_console/include/functions.php,
	pandora_console/operation/incidents/incident.php,
	pandora_console/operation/users/user.php,
	pandora_console/operation/users/user_edit.php,
	pandora_console/operation/events/events.php,
	pandora_console/operation/visual_console/index.php,
	pandora_console/operation/agentes/estado_grupo.php,
	pandora_console/operation/agentes/export_csv.php,
	pandora_console/operation/agentes/estado_agente.php,
	pandora_console/operation/agentes/estado_ultimopaquete.php,
	pandora_console/operation/agentes/estado_generalagente.php,
	pandora_console/operation/agentes/sla_view.php,
	pandora_console/operation/agentes/exportdata.php,
	pandora_console/operation/agentes/ver_agente.php,
	pandora_console/operation/agentes/tactical.php,
	pandora_console/operation/agentes/networkmap.php,
	pandora_console/operation/messages/message.php,
	pandora_console/operation/reporting/reporting_xml.php,
	pandora_console/operation/reporting/reporting_viewer.php,
	pandora_console/reporting/fgraph.php,
	pandora_console/godmode/groups/group_list.php,
	pandora_console/godmode/users/user_list.php,
	pandora_console/godmode/users/configure_user.php,
	pandora_console/godmode/db/db_refine.php,
	pandora_console/godmode/db/db_info.php,
	pandora_console/godmode/db/db_purge.php,
	pandora_console/godmode/agentes/manage_config.php,
	pandora_console/godmode/agentes/modificar_agente.php,
	pandora_console/godmode/agentes/configurar_agente.php,
	pandora_console/godmode/agentes/manage_config_remote.php,
	pandora_console/godmode/modules/manage_network_components_form_network.php,
	pandora_console/godmode/modules/manage_network_components_form_wmi.php,
	pandora_console/godmode/reporting/reporting_builder.php,
	pandora_console/godmode/reporting/map_builder.php,
	pandora_console/godmode/reporting/graph_builder.php: Renamed functions


git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1291 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
guruevi 2008-12-12 21:54:40 +00:00
parent 08ea3b2d30
commit 0e2b6c7ed8
39 changed files with 298 additions and 311 deletions

View File

@ -1,3 +1,58 @@
2008-12-12 Evi Vanoost <vanooste@rcbi.rochester.edu>
* pandora_console/operation/agentes/datos_agente.php: Rewrite. Uses new
functions and better security and validation
* pandora_console/include/functions_db.php: Renamed some functions and
created agentmodule functions for consistency with documentation and to
avoid searching for and typing certain function names:
get_agentmodules is now get_agent_modules;
dame_grupo is now get_group_name;
dame_nombre_agente is now get_agent_name; get_agentmodule_agent is new;
dame_nombre_agente_agentemodulo is now get_agentmodule_agent_name;
dame_nombre_modulo_agentemodulo is now get_agentmodule_name;
dame_id_tipo_modulo_agentemodulo is now get_agentmodule_type;
dame_nombre_tipo_modulo is now get_moduletype_name; dame_nombre_grupo is
now get_group_name; get_agentmodule_count is get_agent_modules_count;
get_agentmodule_group is new; get_agent_group is new;
* pandora_console/include/functions_reporting.php,
pandora_console/include/functions.php,
pandora_console/operation/incidents/incident.php,
pandora_console/operation/users/user.php,
pandora_console/operation/users/user_edit.php,
pandora_console/operation/events/events.php,
pandora_console/operation/visual_console/index.php,
pandora_console/operation/agentes/estado_grupo.php,
pandora_console/operation/agentes/export_csv.php,
pandora_console/operation/agentes/estado_agente.php,
pandora_console/operation/agentes/estado_ultimopaquete.php,
pandora_console/operation/agentes/estado_generalagente.php,
pandora_console/operation/agentes/sla_view.php,
pandora_console/operation/agentes/exportdata.php,
pandora_console/operation/agentes/ver_agente.php,
pandora_console/operation/agentes/tactical.php,
pandora_console/operation/agentes/networkmap.php,
pandora_console/operation/messages/message.php,
pandora_console/operation/reporting/reporting_xml.php,
pandora_console/operation/reporting/reporting_viewer.php,
pandora_console/reporting/fgraph.php,
pandora_console/godmode/groups/group_list.php,
pandora_console/godmode/users/user_list.php,
pandora_console/godmode/users/configure_user.php,
pandora_console/godmode/db/db_refine.php,
pandora_console/godmode/db/db_info.php,
pandora_console/godmode/db/db_purge.php,
pandora_console/godmode/agentes/manage_config.php,
pandora_console/godmode/agentes/modificar_agente.php,
pandora_console/godmode/agentes/configurar_agente.php,
pandora_console/godmode/agentes/manage_config_remote.php,
pandora_console/godmode/modules/manage_network_components_form_network.php,
pandora_console/godmode/modules/manage_network_components_form_wmi.php,
pandora_console/godmode/reporting/reporting_builder.php,
pandora_console/godmode/reporting/map_builder.php,
pandora_console/godmode/reporting/graph_builder.php: Renamed functions
2008-12-10 Evi Vanoost <vanooste@rcbi.rochester.edu> 2008-12-10 Evi Vanoost <vanooste@rcbi.rochester.edu>
* include/functions.php: format_for_graph is now much simpler and uses * include/functions.php: format_for_graph is now much simpler and uses

View File

@ -186,7 +186,7 @@ echo "<div id='menu_tab_frame'>";
echo "<div id='menu_tab_left'><ul class='mn'>"; echo "<div id='menu_tab_left'><ul class='mn'>";
echo "<li class='nomn'>"; echo "<li class='nomn'>";
echo "<a href='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente=$id_agente'> echo "<a href='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente=$id_agente'>
<img src='images/setup.png' class='top' border='0'>&nbsp; ".substr(dame_nombre_agente($id_agente),0,15)." - ".__('Setup mode')."</a>"; <img src='images/setup.png' class='top' border='0'>&nbsp; ".substr(get_agent_name ($id_agente),0,15)." - ".__('Setup mode')."</a>";
echo "</li>"; echo "</li>";
echo "</ul></div>"; echo "</ul></div>";

View File

@ -89,7 +89,7 @@ if (isset($_POST["copy"])) {
//For each destination agent //For each destination agent
if ($modulos == 1) { if ($modulos == 1) {
echo '<br /><br />'.__('Copying module').'<b> ['.dame_nombre_agente ($origen).' - '.$module["nombre"].'] -> ['.dame_nombre_agente ($id_agent_dest).']</b>'; echo '<br /><br />'.__('Copying module').'<b> ['.get_agent_name ($origen).' - '.$module["nombre"].'] -> ['.get_agent_name ($id_agent_dest).']</b>';
$sql = sprintf ('INSERT INTO tagente_modulo $sql = sprintf ('INSERT INTO tagente_modulo
(id_agente, id_tipo_modulo, descripcion, (id_agente, id_tipo_modulo, descripcion,
nombre, max, min, module_interval, nombre, max, min, module_interval,
@ -172,7 +172,7 @@ if (isset($_POST["copy"])) {
} }
foreach ($module_alerts as $alert) { foreach ($module_alerts as $alert) {
echo '<br /><br />'.__('Copying alert').'<b> ['.dame_nombre_agente ($origen).' - '.$module["nombre"].'] -> ['.dame_nombre_agente ($id_agent_dest).']</b>'; echo '<br /><br />'.__('Copying alert').'<b> ['.get_agent_name ($origen).' - '.$module["nombre"].'] -> ['.get_agent_name ($id_agent_dest).']</b>';
if (!empty ($alert["id_agent"])) { if (!empty ($alert["id_agent"])) {
//Compound alert //Compound alert
$alert["id_agent"] = $id_agent_dest; $alert["id_agent"] = $id_agent_dest;

View File

@ -61,8 +61,8 @@ if ((isset($_GET["operacion"])) AND ($update_agent == -1) AND ($update_group ==
// For every agent in destination // For every agent in destination
$id_agente = $destino[$a]; $id_agente = $destino[$a];
$agent_name_src = dame_nombre_agente($id_origen); $agent_name_src = get_agent_name($id_origen);
$agent_name_dst = dame_nombre_agente($id_agente); $agent_name_dst = get_agent_name($id_agente);
echo "<br><br>".__('copyage')."<b> [".$agent_name_src."] -> [".$agent_name_dst."]</b>"; echo "<br><br>".__('copyage')."<b> [".$agent_name_src."] -> [".$agent_name_dst."]</b>";
$source = $config["remote_config"]."/".md5($agent_name_src); $source = $config["remote_config"]."/".md5($agent_name_src);
@ -88,7 +88,7 @@ if ((isset($_GET["operacion"])) AND ($update_agent == -1) AND ($update_group ==
echo '<select name="id_group" style="width:200px">'; echo '<select name="id_group" style="width:200px">';
if ($id_group != 0) if ($id_group != 0)
echo "<option value=$id_group>".dame_nombre_grupo ($id_group); echo "<option value=$id_group>".get_group_name ($id_group)."</option>";
list_group ($config["id_user"]); list_group ($config["id_user"]);
echo '</select>'; echo '</select>';
echo '&nbsp;&nbsp;'; echo '&nbsp;&nbsp;';
@ -108,7 +108,7 @@ if ((isset($_GET["operacion"])) AND ($update_agent == -1) AND ($update_group ==
echo '<select name="origen" style="width:200px">'; echo '<select name="origen" style="width:200px">';
if (($update_agent != 1) AND ($origen != -1)){ if (($update_agent != 1) AND ($origen != -1)){
$agent_name_src = dame_nombre_agente ($origen); $agent_name_src = get_agent_name ($origen);
$source = $config["remote_config"]."/". md5($agent_name_src).".conf"; $source = $config["remote_config"]."/". md5($agent_name_src).".conf";
if (file_exists($source)) if (file_exists($source))
echo "<option value=".$_POST["origen"].">" . $agent_name_src . "</option>"; echo "<option value=".$_POST["origen"].">" . $agent_name_src . "</option>";

View File

@ -18,7 +18,7 @@
// Load global vars // Load global vars
require("include/config.php"); require_once ("include/config.php");
if (give_acl($config["id_user"], 0, "AW") != 1) { if (give_acl($config["id_user"], 0, "AW") != 1) {
audit_db($config["id_user"],$REMOTE_ADDR, "ACL Violation", audit_db($config["id_user"],$REMOTE_ADDR, "ACL Violation",
@ -31,16 +31,17 @@ if (give_acl($config["id_user"], 0, "AW") != 1) {
$offset = get_parameter ("offset", 0); $offset = get_parameter ("offset", 0);
$group_id = get_parameter ("group_id", 0); $group_id = get_parameter ("group_id", 0);
$ag_group = get_parameter ("ag_group", -1); $ag_group = get_parameter ("ag_group", -1);
if (($ag_group == -1) && ($group_id != 0)) if (($ag_group == -1) && ($group_id != 0)) {
$ag_group = $group_id; $ag_group = $group_id;
}
if (isset ($_GET["ag_group_refresh"])){ if (isset ($_GET["ag_group_refresh"])){
$ag_group = $_GET["ag_group_refresh"]; $ag_group = get_parameter_get ("ag_group_refresh", -1);
} }
$search = get_parameter ("search", ""); $search = get_parameter ("search", "");
if (isset($_GET["borrar_agente"])){ // if delete agent if (isset ($_GET["borrar_agente"])) { // if delete agent
$id_agente = get_parameter_get ("borrar_agente"); $id_agente = get_parameter_get ("borrar_agente");
$agent_name = dame_nombre_agente ($id_agente); $agent_name = get_agent_name ($id_agente);
$id_grupo = dame_id_grupo ($id_agente); $id_grupo = dame_id_grupo ($id_agente);
if (give_acl ($config["id_user"], $id_grupo, "AW")==1) { if (give_acl ($config["id_user"], $id_grupo, "AW")==1) {
//Start transaction - this improves consistency //Start transaction - this improves consistency
@ -148,10 +149,10 @@ echo "<select name='ag_group' onChange='javascript:this.form.submit();'
class='w130'>"; class='w130'>";
if ( $ag_group > 1 ){ if ( $ag_group > 1 ){
echo "<option value='".$ag_group."'>".dame_nombre_grupo ($ag_group). echo "<option value='".$ag_group."'>".get_group_name ($ag_group).
"</option>"; "</option>";
} }
echo "<option value=1>".dame_nombre_grupo(1)."</option>"; // Group all is always active echo "<option value=1>".get_group_name (1)."</option>"; // Group all is always active
$mis_grupos = list_group ($config["id_user"]); //Print combo for groups and set an array with all groups $mis_grupos = list_group ($config["id_user"]); //Print combo for groups and set an array with all groups
echo "</select>"; echo "</select>";
echo "<td valign='top'> echo "<td valign='top'>
@ -265,7 +266,7 @@ if (mysql_num_rows($result)){
// Group icon and name // Group icon and name
echo "<td class='$tdcolor'> echo "<td class='$tdcolor'>
<img src='images/groups_small/".show_icon_group($id_grupo).".png' class='bot' border='0'> <img src='images/groups_small/".show_icon_group($id_grupo).".png' class='bot' border='0'>
&nbsp; ".dame_grupo($id_grupo)."</td>"; &nbsp; ".get_group_name ($id_grupo)."</td>";
// Description // Description
echo "<td class='".$tdcolor."f9'>".$row["comentarios"]."</td>"; echo "<td class='".$tdcolor."f9'>".$row["comentarios"]."</td>";
// Action // Action

View File

@ -80,9 +80,9 @@ foreach ($result as $row) {
//First row is a link to the agent //First row is a link to the agent
$data[0] = '<strong><a href="index.php?sec=gagente&sec2=operation/agentes/ver_agente&id_agente='. $data[0] = '<strong><a href="index.php?sec=gagente&sec2=operation/agentes/ver_agente&id_agente='.
$row["id_agente"].'">'.dame_nombre_agente ($row["id_agente"]).'</a></strong>'; $row["id_agente"].'">'.get_agent_name ($row["id_agente"]).'</a></strong>';
//Second row is a number of modules for the agent //Second row is a number of modules for the agent
$data[1] = get_agentmodule_count ($row["id_agente"]); $data[1] = get_agent_modules_count ($row["id_agente"]);
//Then the number of data packets for the agent //Then the number of data packets for the agent
$data[2] = $row["count"]; $data[2] = $row["count"];

View File

@ -80,7 +80,7 @@ $data["total"] = 0;
if (isset($_POST["purgedb"])) { if (isset($_POST["purgedb"])) {
$from_date = get_parameter_post ("date_purge", 0); //0: No time selected $from_date = get_parameter_post ("date_purge", 0); //0: No time selected
if ($id_agent > 0) { if ($id_agent > 0) {
echo __('Purge task launched for agent')." ".dame_nombre_agente ($id_agent)." :: ".__('Data older than')." ".human_time_description ($from_date); echo __('Purge task launched for agent')." ".get_agent_name ($id_agent)." :: ".__('Data older than')." ".human_time_description ($from_date);
echo "<h3>".__('Please be patient. This operation can take a long time depending on the amount of modules.')."</h3>"; echo "<h3>".__('Please be patient. This operation can take a long time depending on the amount of modules.')."</h3>";
$sql = sprintf ("SELECT id_agente_modulo FROM tagente_modulo WHERE id_agente = %d", $id_agent); $sql = sprintf ("SELECT id_agente_modulo FROM tagente_modulo WHERE id_agente = %d", $id_agent);
@ -94,7 +94,7 @@ if (isset($_POST["purgedb"])) {
process_sql ("START TRANSACTION;"); //We start a transaction for consistency process_sql ("START TRANSACTION;"); //We start a transaction for consistency
$errors = 0; $errors = 0;
foreach ($result as $row) { foreach ($result as $row) {
echo __('Deleting records for module')." ".dame_nombre_modulo_agentemodulo ($row["id_agente_modulo"]); echo __('Deleting records for module')." ".get_agentmodule_name ($row["id_agente_modulo"]);
echo "<br />"; echo "<br />";
flush (); //Flush here in case there are errors and the script dies, at least we know where we ended flush (); //Flush here in case there are errors and the script dies, at least we know where we ended
set_time_limit (); //Reset the time limit just in case set_time_limit (); //Reset the time limit just in case
@ -145,7 +145,7 @@ print_help_tip (__("Click here to get the data from the agent specified in the s
echo '</noscript><br />'; echo '</noscript><br />';
if ($id_agent > 0) { if ($id_agent > 0) {
$title = __('Information on agent').' '.dame_nombre_agente ($id_agent).' '.__('in the database'); $title = __('Information on agent').' '.get_agent_name ($id_agent).' '.__('in the database');
} else { } else {
$title = __('Information on all agents').' '.__('in the database'); $title = __('Information on all agents').' '.__('in the database');
} }
@ -153,7 +153,7 @@ if ($id_agent > 0) {
echo "<h3>".$title."</h3>"; echo "<h3>".$title."</h3>";
flush (); //Flush before we do some SQL stuff flush (); //Flush before we do some SQL stuff
if ($id_agent > 0) { //If the agent is not All or Not selected if ($id_agent > 0) { //If the agent is not All or Not selected
$modules = get_agentmodules ($id_agent); $modules = get_agent_modules ($id_agent);
sprintf ("AND id_agente_modulo IN(%s)", implode (",", array_keys ($modules))); sprintf ("AND id_agente_modulo IN(%s)", implode (",", array_keys ($modules)));
} else { } else {
$query = ""; $query = "";

View File

@ -57,7 +57,7 @@ if ((isset ($_GET["operacion"])) && (!isset ($_POST["update_agent"]))) {
// Copy // Copy
for ($a = 0; $a < count ($origen_modulo); $a++) { // For every agent selected for ($a = 0; $a < count ($origen_modulo); $a++) { // For every agent selected
$id_agentemodulo = $origen_modulo[$a]; $id_agentemodulo = $origen_modulo[$a];
echo "<br><br>".__('Filtering data module')."<b> [".dame_nombre_modulo_agentemodulo ($id_agentemodulo)."]</b>"; echo "<br><br>".__('Filtering data module')."<b> [".get_agentmodule_name ($id_agentemodulo)."]</b>";
$sql ='DELETE FROM tagente_datos WHERE id_agente_modulo = '.$origen_modulo[$a].' AND ( datos < '.$min.' OR datos > '.$max.' )'; $sql ='DELETE FROM tagente_datos WHERE id_agente_modulo = '.$origen_modulo[$a].' AND ( datos < '.$min.' OR datos > '.$max.' )';
process_sql ($sql); process_sql ($sql);
//echo "<br>DEBUG DELETE $sql1 <br>"; //echo "<br>DEBUG DELETE $sql1 <br>";
@ -74,7 +74,7 @@ if ((isset ($_GET["operacion"])) && (!isset ($_POST["update_agent"]))) {
<select name="origen" class="w130"> <select name="origen" class="w130">
<?php <?php
if ( (isset ($_POST["update_agent"])) && (isset ($_POST["origen"])) ) { if ( (isset ($_POST["update_agent"])) && (isset ($_POST["origen"])) ) {
echo "<option value=".$_POST["origen"].">".dame_nombre_agente($_POST["origen"]); echo "<option value=".$_POST["origen"].">".get_agent_name($_POST["origen"]);
} }
// Show combo with agents // Show combo with agents
$sql1='SELECT * FROM tagente'; $sql1='SELECT * FROM tagente';

View File

@ -121,7 +121,7 @@ foreach ($groups as $id_group => $group_name) {
$data[0] = '<img src="images/groups_small/'.$group["icon"].'.png" border="0">'; $data[0] = '<img src="images/groups_small/'.$group["icon"].'.png" border="0">';
$data[1] = '<strong><a href="index.php?sec=gagente&sec2=godmode/groups/configure_group&id_group='.$id_group.'">'.$group_name.'</a></strong>'; $data[1] = '<strong><a href="index.php?sec=gagente&sec2=godmode/groups/configure_group&id_group='.$id_group.'">'.$group_name.'</a></strong>';
$data[2] = dame_nombre_grupo ($group["parent"]); $data[2] = get_group_name ($group["parent"]);
$data[3] = $group['disabled'] ? __('Disabled') : __('Enabled'); $data[3] = $group['disabled'] ? __('Disabled') : __('Enabled');
$data[4] = '<a href="index.php?sec=gagente&sec2=godmode/groups/group_list&id_group='.$id_group.'&delete_group=1" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;"><img border="0" src="images/cross.png"></a>'; $data[4] = '<a href="index.php?sec=gagente&sec2=godmode/groups/group_list&id_group='.$id_group.'&delete_group=1" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;"><img border="0" src="images/cross.png"></a>';

View File

@ -201,7 +201,7 @@ echo "<td class='datos2'>";
echo '<select name="tipo" onChange="type_change()">'; echo '<select name="tipo" onChange="type_change()">';
$sql1="SELECT id_tipo, nombre FROM ttipo_modulo WHERE id_tipo != '$type' ORDER BY nombre"; $sql1="SELECT id_tipo, nombre FROM ttipo_modulo WHERE id_tipo != '$type' ORDER BY nombre";
$result=mysql_query($sql1); $result=mysql_query($sql1);
echo "<option value='$type'>". dame_nombre_tipo_modulo($type); echo "<option value='$type'>". get_moduletype_name ($type);
while ($row=mysql_fetch_array($result)){ while ($row=mysql_fetch_array($result)){
echo "<option value='".$row["id_tipo"]."'>".$row["nombre"]."</option>"; echo "<option value='".$row["id_tipo"]."'>".$row["nombre"]."</option>";
} }

View File

@ -96,7 +96,7 @@ echo '<td class="datos2"><input type="text" name="name" size="25" value="' . $na
echo '<td class="datos2">' . __('Module type') . '</td>'; echo '<td class="datos2">' . __('Module type') . '</td>';
echo '<td class="datos2">'; echo '<td class="datos2">';
echo '<select name="tipo">'; echo '<select name="tipo">';
echo '<option value="' . $type . '">' . dame_nombre_tipo_modulo($type); echo '<option value="' . $type . '">' . get_moduletype_name ($type);
$result = mysql_query('SELECT id_tipo, nombre FROM ttipo_modulo WHERE categoria IN (0,1,2) ORDER BY nombre;'); $result = mysql_query('SELECT id_tipo, nombre FROM ttipo_modulo WHERE categoria IN (0,1,2) ORDER BY nombre;');
while ($row = mysql_fetch_array($result)){ while ($row = mysql_fetch_array($result)){
echo '<option value="' . $row['id_tipo'] . '">' . $row['nombre'] . '</option>'; echo '<option value="' . $row['id_tipo'] . '">' . $row['nombre'] . '</option>';

View File

@ -229,9 +229,9 @@ if (isset ($chunk1)) {
} }
echo "<tr><td class='$tdcolor'>"; echo "<tr><td class='$tdcolor'>";
echo dame_nombre_agente($agent_array[$a])."</td>"; echo get_agent_name ($agent_array[$a])."</td>";
echo "<td class='$tdcolor'>"; echo "<td class='$tdcolor'>";
echo dame_nombre_modulo_agentemodulo($module_array[$a])."</td>"; echo get_agentmodule_name ($module_array[$a])."</td>";
echo "<td class='$tdcolor'>"; echo "<td class='$tdcolor'>";
echo $weight_array[$a]."</td>"; echo $weight_array[$a]."</td>";
echo "<td class='$tdcolor' align='center'>"; echo "<td class='$tdcolor' align='center'>";

View File

@ -273,7 +273,7 @@ if (! $edit_layout && ! $id_layout) {
$data[0] = '<a href="index.php?sec=greporting&sec2=godmode/reporting/map_builder&id_layout='.$map['id'].'">'.$map['name'].'</a>'; $data[0] = '<a href="index.php?sec=greporting&sec2=godmode/reporting/map_builder&id_layout='.$map['id'].'">'.$map['name'].'</a>';
$data[1] = '<img src="images/'.dame_grupo_icono ($map['id_group']).'.png" /> '; $data[1] = '<img src="images/'.dame_grupo_icono ($map['id_group']).'.png" /> ';
$data[1] .= dame_nombre_grupo ($map['id_group']); $data[1] .= get_group_name ($map['id_group']);
$data[2] = '<a href="index.php?sec=greporting&sec2=godmode/reporting/map_builder&id_layout='.$map['id'].'&delete_layout=1"> $data[2] = '<a href="index.php?sec=greporting&sec2=godmode/reporting/map_builder&id_layout='.$map['id'].'&delete_layout=1">
<img src="images/cross.png"></a>'; <img src="images/cross.png"></a>';
array_push ($table->data, $data); array_push ($table->data, $data);

View File

@ -271,8 +271,8 @@ if ($edit_sla_report_content) {
foreach ($slas as $sla) { foreach ($slas as $sla) {
$data = array (); $data = array ();
$data[0] = dame_nombre_agente_agentemodulo ($sla['id_agent_module']); $data[0] = get_agentmodule_agent_name ($sla['id_agent_module']);
$data[1] = dame_nombre_modulo_agentemodulo ($sla['id_agent_module']); $data[1] = get_agentmodule_name ($sla['id_agent_module']);
$data[2] = $sla['sla_min']; $data[2] = $sla['sla_min'];
$data[3] = $sla['sla_max']; $data[3] = $sla['sla_max'];
$data[4] = $sla['sla_limit'].'%'; $data[4] = $sla['sla_limit'].'%';
@ -338,7 +338,7 @@ if ($edit_sla_report_content) {
if ($report_id_group) { if ($report_id_group) {
/* Changing the group is not allowed. */ /* Changing the group is not allowed. */
$table->data[1][1] = '<a href="index.php?sec=estado&sec2=operation/agentes/estado_agente&refr=60&group_id='. $table->data[1][1] = '<a href="index.php?sec=estado&sec2=operation/agentes/estado_agente&refr=60&group_id='.
$report_id_group.'">'.dame_grupo ($report_id_group).'</a>'; $report_id_group.'">'.get_group_name ($report_id_group).'</a>';
} else { } else {
$table->data[1][1] = print_select_from_sql ('SELECT id_grupo, nombre FROM tgrupo ORDER BY nombre', $table->data[1][1] = print_select_from_sql ('SELECT id_grupo, nombre FROM tgrupo ORDER BY nombre',
'report_id_group', $report_id_group, '', '--', 0, true); 'report_id_group', $report_id_group, '', '--', 0, true);
@ -472,7 +472,7 @@ if ($edit_sla_report_content) {
$data[2] = '--'; $data[2] = '--';
$data[3] = '--'; $data[3] = '--';
if (get_report_type_data_source ($report_content['type']) == 'module') { if (get_report_type_data_source ($report_content['type']) == 'module') {
$data[2] = strtolower (dame_nombre_agente_agentemodulo ($report_content['id_agent_module'])); $data[2] = strtolower (get_agentmodule_agent_name ($report_content['id_agent_module']));
$data[3] = strtolower (get_db_value ('descripcion', 'tagente_modulo', 'id_agente_modulo', $report_content['id_agent_module'])); $data[3] = strtolower (get_db_value ('descripcion', 'tagente_modulo', 'id_agente_modulo', $report_content['id_agent_module']));
} }
$data[4] = human_time_description ($report_content['period']); $data[4] = human_time_description ($report_content['period']);

View File

@ -264,7 +264,7 @@ if ($modo == "edicion") { // Only show groups for existing users
} }
echo '<td class="'.$tdcolor.'">'; echo '<td class="'.$tdcolor.'">';
echo "<b style='margin-left:10px'>".dame_perfil($row["id_perfil"])."</b> / "; echo "<b style='margin-left:10px'>".dame_perfil($row["id_perfil"])."</b> / ";
echo "<b>".dame_grupo($row["id_grupo"])."</b>"; echo "<b>".get_group_name ($row["id_grupo"])."</b>";
echo '<td class="'.$tdcolor.'t"><a href="index.php?sec=gusuarios&sec2=godmode/users/configure_user&id_usuario_mio='.$id_usuario_mio.'&borrar_grupo='.$row["id_up"].' " onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;"><img border=0 src="images/cross.png"></a><tr>'; echo '<td class="'.$tdcolor.'t"><a href="index.php?sec=gusuarios&sec2=godmode/users/configure_user&id_usuario_mio='.$id_usuario_mio.'&borrar_grupo='.$row["id_up"].' " onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;"><img border=0 src="images/cross.png"></a><tr>';
} }
} }

View File

@ -95,7 +95,7 @@ foreach ($result as $row) {
foreach ($profiles as $profile) { foreach ($profiles as $profile) {
$data[2] .= dame_perfil ($profile["id_perfil"])." / "; $data[2] .= dame_perfil ($profile["id_perfil"])." / ";
$data[2] .= dame_grupo ($profile["id_grupo"])."<br />"; $data[2] .= get_group_name ($profile["id_grupo"])."<br />";
} }
$data[2] .= "</span></a>"; $data[2] .= "</span></a>";

View File

@ -506,49 +506,7 @@ function human_time_description_raw ($seconds) {
* @return A human readable label for a period of time. * @return A human readable label for a period of time.
*/ */
function human_time_description ($period) { function human_time_description ($period) {
global $lang_label; return human_time_description_raw ($period); //human_time_description_raw does the same but by calculating instead of a switch
switch ($period) {
case 3600:
return __('1 hour');
break;
case 7200:
return __('2 hours');
break;
case 21600:
return __('6 hours');
break;
case 43200:
return __('12 hours');
break;
case 86400:
return __('1 day');
break;
case 172800:
return __('2 days');
break;
case 432000:
return __('5 days');
break;
case 604800:
return __('1 week');
break;
case 1296000:
return __('15 days');
break;
case 2592000:
return __('1 month');
break;
case 5184000:
return __('2 months');
break;
case 15552000:
return __('6 months');
break;
default:
return human_time_description_raw ($period);
}
return $period_label;
} }
/** /**
@ -858,11 +816,11 @@ function show_alert_show_view ($data, $tdcolor = "datos", $combined = 0) {
if ($combined == 0) { if ($combined == 0) {
$id_agente = give_agent_id_from_module_id ($data["id_agente_modulo"]); $id_agente = give_agent_id_from_module_id ($data["id_agente_modulo"]);
$agent_name = dame_nombre_agente ($id_agente); $agent_name = get_agent_name ($id_agente);
$module_name = dame_nombre_modulo_agentemodulo ($data["id_agente_modulo"]); $module_name = get_agentmodule_name ($data["id_agente_modulo"]);
} else { } else {
$id_agente = $data["id_agent"]; $id_agente = $data["id_agent"];
$agent_name = dame_nombre_agente ($id_agente); $agent_name = get_agent_name ($id_agente);
} }
$alert_name = dame_nombre_alerta ($data["id_alerta"]); $alert_name = dame_nombre_alerta ($data["id_alerta"]);

View File

@ -254,7 +254,7 @@ function get_group_agents ($id_group, $disabled = false, $case = "lower") {
* *
* @return An array with all modules in the agent. If multiple rows are selected, they will be in an array * @return An array with all modules in the agent. If multiple rows are selected, they will be in an array
*/ */
function get_agentmodules ($id_agent, $details = false) { function get_agent_modules ($id_agent, $details = false) {
$id_agent = safe_int ($id_agent, 1); $id_agent = safe_int ($id_agent, 1);
if (empty ($id_agent)) { if (empty ($id_agent)) {
@ -364,17 +364,6 @@ function get_reports ($id_user) {
return $user_reports; return $user_reports;
} }
/**
* Get group name from group.
*
* @param id_group Id group to get the name.
*
* @return The name of the given group
*/
function dame_grupo ($id_group) {
return (string) get_db_value ('nombre', 'tgrupo', 'id_grupo', (int) $id_group);
}
/** /**
* Get group icon from group. * Get group icon from group.
* *
@ -397,18 +386,6 @@ function dame_agente_id ($agent_name) {
return (int) get_db_value ('id_agente', 'tagente', 'nombre', $agent_name); return (int) get_db_value ('id_agente', 'tagente', 'nombre', $agent_name);
} }
/**
* DEPRECATED: Use get_agent_name instead
*
* @param id_agent Agent id.
*
* @return Name of the given agent.
*/
function dame_nombre_agente ($id_agent) {
return get_agent_name ($id_agent, "none");
}
/** /**
* Get name of an agent. * Get name of an agent.
* *
@ -497,6 +474,17 @@ function giveme_module_type ($id_type) {
return (string) get_db_value ('nombre', 'ttipo_modulo', 'id_tipo', (int) $id_type); return (string) get_db_value ('nombre', 'ttipo_modulo', 'id_tipo', (int) $id_type);
} }
/**
* Get agent id of an agent module.
*
* @param (int) id_agentmodule Agent module id.
*
* @return (int) The id of the agent of given agent module
*/
function get_agentmodule_agent ($id_agentmodule) {
return (int) get_db_value ('id_agente', 'tagente_modulo', 'id_agente_modulo', (int) $id_agentmodule);
}
/** /**
* Get agent name of an agent module. * Get agent name of an agent module.
* *
@ -504,11 +492,8 @@ function giveme_module_type ($id_type) {
* *
* @return The name of the given agent module. * @return The name of the given agent module.
*/ */
function dame_nombre_agente_agentemodulo ($id_agente_modulo) { function get_agentmodule_agent_name ($id_agentmodule) {
$id_agent = get_db_value ('id_agente', 'tagente_modulo', 'id_agente_modulo', (int) $id_agente_modulo); return (string) get_agent_name (get_agentmodule_agent ($id_agentmodule)); //since this is a helper function we don't need to do casting
if ($id_agent)
return dame_nombre_agente ($id_agent);
return '';
} }
/** /**
@ -518,7 +503,7 @@ function dame_nombre_agente_agentemodulo ($id_agente_modulo) {
* *
* @return Name of the given agent module. * @return Name of the given agent module.
*/ */
function dame_nombre_modulo_agentemodulo ($id_agente_modulo) { function get_agentmodule_name ($id_agente_modulo) {
return (string) get_db_value ('nombre', 'tagente_modulo', 'id_agente_modulo', (int) $id_agente_modulo); return (string) get_db_value ('nombre', 'tagente_modulo', 'id_agente_modulo', (int) $id_agente_modulo);
} }
@ -529,8 +514,8 @@ function dame_nombre_modulo_agentemodulo ($id_agente_modulo) {
* *
* @return Module type of the given agent module. * @return Module type of the given agent module.
*/ */
function dame_id_tipo_modulo_agentemodulo ($id_agente_modulo) { function get_agentmodule_type ($id_agentmodule) {
return (int) get_db_value ('id_tipo_modulo', 'tagente_modulo', 'id_agente_modulo', (int) $id_agente_modulo); return (int) get_db_value ('id_tipo_modulo', 'tagente_modulo', 'id_agente_modulo', (int) $id_agentmodule);
} }
/** /**
@ -790,7 +775,7 @@ function get_alert_last_fire_timestamp_in_period ($id_agent_module, $period, $da
* @return Name of the given server * @return Name of the given server
*/ */
function give_server_name ($id_server) { function give_server_name ($id_server) {
return (string) get_db_value ('name', 'tserver', 'id_server', $id_server); return (string) get_db_value ('name', 'tserver', 'id_server', (int) $id_server);
} }
/** /**
@ -800,20 +785,9 @@ function give_server_name ($id_server) {
* *
* @return Name of the given type. * @return Name of the given type.
*/ */
function dame_nombre_tipo_modulo ($id_type) { function get_moduletype_name ($id_type) {
return (string) get_db_value ('nombre', 'ttipo_modulo', 'id_tipo', $id_type); return (string) get_db_value ('nombre', 'ttipo_modulo', 'id_tipo', (int) $id_type);
} }
/**
* Get group name from the id
*
* @param id_group Group id
*
* @return The name of the given group
*/
function dame_nombre_grupo ($id_group) {
return (string) get_db_value ('nombre', 'tgrupo', 'id_grupo', $id_group);
}
/** /**
* Get group id of an agent. * Get group id of an agent.
@ -2098,7 +2072,7 @@ function smal_event_table ($filter = "", $limit = 10, $width = 440) {
echo "</td>"; echo "</td>";
if ($event["id_agente"] > 0) { if ($event["id_agente"] > 0) {
// Agent name // Agent name
$agent_name = dame_nombre_agente ($event["id_agente"]); $agent_name = get_agent_name ($event["id_agente"]);
echo "<td class='".$tdclass."f9' title='$agent_name'><a href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=".$event["id_agente"]."'><b>"; echo "<td class='".$tdclass."f9' title='$agent_name'><a href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=".$event["id_agente"]."'><b>";
echo substr ($agent_name, 0, 14); echo substr ($agent_name, 0, 14);
if (strlen ($agent_name) > 14) if (strlen ($agent_name) > 14)
@ -2340,18 +2314,49 @@ function get_server_info ($id_server = -1) {
* @return integer with the number of agent modules * @return integer with the number of agent modules
* *
**/ **/
function get_agentmodule_count ($id_agent = 0) { function get_agent_modules_count ($id_agent = 0) {
$id_agent = safe_int ($id_agent); //Make sure we're all int's and filter out bad stuff $id_agent = safe_int ($id_agent, 1); //Make sure we're all int's and filter out bad stuff
if (empty ($id_agent) || $id_agent < 1) { if (empty ($id_agent)) {
//If the array proved empty or the agent is less than 1 (eg. -1) //If the array proved empty or the agent is less than 1 (eg. -1)
$filter = ''; $filter = '';
} elseif (is_array ($id_agent)) {
//If it's an array of agents, flatten the aray
$filter = sprintf (" WHERE id_agente IN (%s)", implode (",",$id_agent));
} else { } else {
$filter = sprintf (" WHERE id_agente = %d", $id_agent); $filter = sprintf (" WHERE id_agente IN (%s)", implode (",",$id_agent));
} }
return (int) get_db_sql ("SELECT COUNT(*) FROM tagente_modulo".$filter); return (int) get_db_sql ("SELECT COUNT(*) FROM tagente_modulo".$filter);
} }
?>
/**
* This function gets the agent group for a given agent module
*
* @param (int) $id_module: The agent module id
*
* @return (int) The group id
**/
function get_agentmodule_group ($id_module) {
$agent = (int) get_agentmodule_agent ((int) $id_module);
return (int) get_agent_group ($agent);
}
/**
* This function gets the group for a given agent
*
* @param (int) $id_agent: The agent id
*
* @return (int) The group id
**/
function get_agent_group ($id_agent) {
return (int) get_db_value ('id_grupo', 'tagente', 'id_agente', (int) $id_agent);
}
/**
* This function gets the group name for a given group id
*
* @param (int) $id_group: The group id
*
* @return (string) The group name
**/
function get_group_name ($id_group) {
return (string) get_db_value ('nombre', 'tgrupo', 'id_grupo', (int) $id_group);
}
?>

View File

@ -358,7 +358,7 @@ function get_fired_alerts_reporting_table ($alerts_fired) {
$data = array (); $data = array ();
foreach ($alerts as $alert) { foreach ($alerts as $alert) {
if (! isset ($data[0])) if (! isset ($data[0]))
$data[0] = dame_nombre_agente ($id_agent); $data[0] = get_agent_name ($id_agent);
else else
$data[0] = ''; $data[0] = '';
$data[1] = $alert['descripcion']; $data[1] = $alert['descripcion'];
@ -619,7 +619,7 @@ function get_agent_monitors_reporting_table ($id_agent, $period = 0, $date = 0)
function get_agent_modules_reporting_table ($id_agent, $period = 0, $date = 0) { function get_agent_modules_reporting_table ($id_agent, $period = 0, $date = 0) {
$table->data = array (); $table->data = array ();
$n_a_string = __('N/A').'(*)'; $n_a_string = __('N/A').'(*)';
$modules = get_agentmodules ($id_agent, array ("nombre", "descripcion")); $modules = get_agent_modules ($id_agent, array ("nombre", "descripcion"));
if ($modules === false) if ($modules === false)
$modules = array(); $modules = array();
$data = array (); $data = array ();
@ -649,7 +649,7 @@ function get_agent_detailed_reporting ($id_agent, $period = 0, $date = 0, $retur
/* Show modules in agent */ /* Show modules in agent */
$output .= '<div class="agent_reporting">'; $output .= '<div class="agent_reporting">';
$output .= '<h3 style="text-decoration: underline">'.__('Agent').' - '.dame_nombre_agente ($id_agent).'</h3>'; $output .= '<h3 style="text-decoration: underline">'.__('Agent').' - '.get_agent_name ($id_agent).'</h3>';
$output .= '<h4>'.__('Modules').'</h3>'; $output .= '<h4>'.__('Modules').'</h3>';
$table_modules = get_agent_modules_reporting_table ($id_agent, $period, $date); $table_modules = get_agent_modules_reporting_table ($id_agent, $period, $date);
$table_modules->width = '99%'; $table_modules->width = '99%';

View File

@ -16,126 +16,91 @@
// along with this program; if not, write to the Free Software // along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
// Load global vars // Load global vars
require ("include/config.php"); require_once ("include/config.php");
check_login(); check_login();
if (! give_acl ($config['id_user'], 0, "AR")) { $module_id = get_parameter_get ("id", 0);
$period = get_parameter_get ("period", 86400);
$group = get_agentmodule_group ($module_id);
if (! give_acl ($config['id_user'], $group, "AR") || $module_id == 0) {
audit_db ($config['id_user'], $REMOTE_ADDR, "ACL Violation", audit_db ($config['id_user'], $REMOTE_ADDR, "ACL Violation",
"Trying to access Agent Data view"); "Trying to access Agent Data view");
require ("general/noaccess.php"); require ("general/noaccess.php");
exit; exit;
} }
function datos_raw ($id_agente_modulo, $periodo) { if (isset ($_GET["delete"])) {
global $config; $delete = get_parameter_get ("delete", 0);
$sql = sprintf ("DELETE FROM tagente_datos WHERE id_agente_datos = %d", $delete);
$periodo_label = $periodo; process_sql ($sql);
switch ($periodo) { } elseif (isset($_GET["delete_text"])) {
case "mes": $delete = get_parameter_get ("delete_string", 0);
$periodo = 2592000; $sql = sprintf ("DELETE FROM tagente_datos_string WHERE id_tagente_datos_string = %d", $delete);
$et=__('One month'); process_sql ($sql);
break; }
case "semana":
$periodo = 604800;
$et=__('One week');
break;
case "dia":
$periodo = 86400;
$et=__('Last 24 Hours');
break;
}
$periodo = time () - $periodo;
$id_agent = give_agent_id_from_module_id ($id_agente_modulo);
$id_group = get_db_value ("id_grupo", "tagente", "id_agente", $id_agent);
// Different query for string data type
$id_tipo_modulo = dame_id_tipo_modulo_agentemodulo($id_agente_modulo);
if (preg_match("/string/", dame_nombre_tipo_modulo ($id_tipo_modulo) )) {
$sql1="SELECT * FROM tagente_datos_string WHERE id_agente_modulo = ".
$id_agente_modulo." AND id_agente = $id_agent AND utimestamp > '".$periodo."'
ORDER BY timestamp DESC";
$string_type = 1;
}
else {
$sql1 = "SELECT * FROM tagente_datos WHERE id_agente_modulo = ".
$id_agente_modulo." AND id_agente = $id_agent AND utimestamp > '".$periodo."'
ORDER BY timestamp DESC";
$string_type = 0;
}
$result = mysql_query ($sql1);
$nombre_agente = dame_nombre_agente_agentemodulo ($id_agente_modulo);
$nombre_modulo = dame_nombre_modulo_agentemodulo ($id_agente_modulo);
echo "<h2>".__('Received data from')."
'$nombre_agente' / '$nombre_modulo' </h2>";
echo "<h3>". $et ."</h3>";
if (mysql_num_rows ($result)) {
echo "<table cellpadding='3' cellspacing='3' width='600' class='databox'>";
$color=1;
echo "<th>".__('Delete')."</th>";
echo "<th>".__('Timestamp')."</th>";
echo "<th width='400'>".__('Data')."</th>";
while ($row=mysql_fetch_array($result)){
if ($color == 1){
$tdcolor = "datos";
$color = 0;
} else {
$tdcolor = "datos2";
$color = 1;
}
echo "<tr>";
if (give_acl ($config['id_user'], $id_group, "AW") ==1) {
echo "<td class='".$tdcolor."' width=20>";
if ($string_type == 0)
echo "<a href='index.php?sec=estado&sec2=operation/agentes/datos_agente&tipo=$periodo_label&id=$id_agente_modulo&delete=".$row["id_agente_datos"]."'><img src='images/cross.png' border=0>";
else
echo "<a href='index.php?sec=estado&sec2=operation/agentes/datos_agente&tipo=$periodo_label&id=$id_agente_modulo&delete_text=".$row["id_tagente_datos_string"]."'><img src='images/cross.png' border=0>";
} else {
echo "<td class='".$tdcolor."'>";
}
echo "<td class='".$tdcolor."' style='width:150px'>".$row["timestamp"]."</td>";
echo "<td class='".$tdcolor."'>";
if (is_numeric ($row["datos"])) {
echo format_for_graph ($row["datos"]);
} else {
echo salida_limpia ($row["datos"]);
}
echo "</td></tr>";
}
echo "</table>";
} else {
echo "<div class='nf'>no_data</div>";
}
}
// --------------- // Different query for string data type
// Page begin if (preg_match ("/string/", get_moduletype_name (get_agentmodule_type ($module_id)))) {
// --------------- $sql = sprintf ("SELECT * FROM tagente_datos_string WHERE id_agente_modulo = %d AND utimestamp > %d ORDER BY timestamp DESC", $module_id, time () - $period);
$string_type = 1;
if (isset ($_GET["tipo"]) && isset ($_GET["id"])) {
$id = get_parameter ("id");
$tipo= get_parameter ("tipo");
} else { } else {
echo "<h3 class='error'>".__('There was a problem locating the source of the graph')."</h3>"; $sql = sprintf ("SELECT * FROM tagente_datos WHERE id_agente_modulo = %d AND utimestamp > %d ORDER BY timestamp DESC", $module_id, time () - $period);
exit; $string_type = 0;
}
$result = get_db_all_rows_sql ($sql);
if ($result === false) {
$result = array ();
} }
if (isset($_GET["delete"])) { echo "<h2>".__('Received data from')." ".get_agentmodule_agent_name ($module_id)." / ".get_agentmodule_name ($module_id)." </h2>";
$delete = $_GET["delete"]; echo "<h3>".human_time_description ($period) ."</h3>";
$sql = "DELETE FROM tagente_datos WHERE id_agente_datos = $delete";
$result = process_sql ($sql); $table->cellpadding = 3;
$table->cellspacing = 3;
$table->width = 600;
$table->class = "databox";
$table->head = array ();
$table->data = array ();
$table->align = array ();
$table->head[0] = __('Delete');
$table->align[0] = 'center';
$table->head[1] = __('Timestamp');
$table->align[1] = 'center';
$table->head[2] = __('Data');
$table->align[2] = 'center';
foreach ($result as $row) {
$data = array ();
if (give_acl ($config['id_user'], $group, "AW") ==1) {
if ($string_type == 0) {
$data[0] = '<a href="index.php?sec=estado&sec2=operation/agentes/datos_agente&period='.$period.'&id='.$module_id.'&delete='.$row["id_agente_datos"].'"><img src="images/cross.png" border="0" /></a>';
} else {
$data[0] = '<a href="index.php?sec=estado&sec2=operation/agentes/datos_agente&period='.$period.'&id='.$module_id.'&delete_string='.$row["id_tagente_datos_string"].'"><img src="images/cross.png" border="0" /></a>';
}
} else {
$data[0] = '';
}
$data[1] = print_timestamp ($row["utimestamp"], "", "span", true);
if (is_numeric ($row["datos"])) {
$data[2] = format_for_graph ($row["datos"]);
} else {
$data[2] = safe_input ($row["datos"]);
}
array_push ($table->data, $data);
} }
if (isset($_GET["delete_text"])) { if (empty ($table->data)) {
$delete = $_GET["delete_text"]; echo '<h3 class="error">'.__('There was a problem locating the source of the graph').'</h3>';
$sql = "DELETE FROM tagente_datos_string WHERE id_tagente_datos_string = $delete"; } else {
$result = process_sql ($sql); print_table ($table);
unset ($table);
} }
datos_raw ($id, $tipo);
?> ?>

View File

@ -17,7 +17,7 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
// Load global vars // Load global vars
require ("include/config.php"); require_once ("include/config.php");
check_login (); check_login ();
if (! give_acl ($config['id_user'], 0, "AR")) { if (! give_acl ($config['id_user'], 0, "AR")) {
@ -30,12 +30,9 @@ if (! give_acl ($config['id_user'], 0, "AR")) {
// Take some parameters (GET) // Take some parameters (GET)
$offset = get_parameter ("offset", 0); $offset = get_parameter ("offset", 0);
$group_id = get_parameter ("group_id", 0); $group_id = get_parameter ("group_id", 0);
$ag_group = get_parameter ("ag_group", -1); $ag_group = get_parameter ("ag_group", $group_id);
if (($ag_group == -1) && ($group_id != 0)) $ag_group = get_parameter_get ("ag_group_refresh", $ag_group); //if it isn't set, defaults to prev. value
$ag_group = $group_id;
if (isset($_GET["ag_group_refresh"])){
$ag_group = $_GET["ag_group_refresh"];
}
$search = get_parameter ("search", ""); $search = get_parameter ("search", "");
echo "<h2>".__('Pandora Agents')." &gt; ".__('Summary')."</h2>"; echo "<h2>".__('Pandora Agents')." &gt; ".__('Summary')."</h2>";
@ -276,7 +273,7 @@ if ($agents !== false) {
echo '<td class="'.$tdcolor.'" align="center">'; echo '<td class="'.$tdcolor.'" align="center">';
echo "<a href='index.php?sec=estado&sec2=operation/agentes/estado_agente&refr=60&group_id=$id_grupo'>"; echo "<a href='index.php?sec=estado&sec2=operation/agentes/estado_agente&refr=60&group_id=$id_grupo'>";
echo '<img class="bot" src="images/groups_small/'.show_icon_group($id_grupo).'.png" title="'. dame_grupo($id_grupo).'"></A></td>'; echo '<img class="bot" src="images/groups_small/'.show_icon_group($id_grupo).'.png" title="'. get_group_name ($id_grupo).'"></A></td>';
echo "<td class='$tdcolor'> ". echo "<td class='$tdcolor'> ".
$numero_modulos." <b>/</b> ".$numero_monitor; $numero_modulos." <b>/</b> ".$numero_monitor;

View File

@ -85,7 +85,7 @@ echo '<td class="datos2" colspan="2">'.$agent["comentarios"].'</td></tr>';
// Group // Group
echo '<tr><td class="datos"><b>'.__('Group').'</b></td>'; echo '<tr><td class="datos"><b>'.__('Group').'</b></td>';
echo '<td class="datos" colspan="2">'; echo '<td class="datos" colspan="2">';
echo '<img class="bot" src="images/groups_small/'.show_icon_group ($agent["id_grupo"]).'.png" /> - <a href="index.php?sec=estado&sec2=operation/agentes/estado_agente&refr=60&group_id='.$agent["id_grupo"].'">'. dame_grupo ($agent["id_grupo"]).'</a></td></tr>'; echo '<img class="bot" src="images/groups_small/'.show_icon_group ($agent["id_grupo"]).'.png" /> - <a href="index.php?sec=estado&sec2=operation/agentes/estado_agente&refr=60&group_id='.$agent["id_grupo"].'">'. get_group_name ($agent["id_grupo"]).'</a></td></tr>';
// Agent version // Agent version
echo '<tr><td class="datos2"><b>'.__('Agent Version'). '</b></td>'; echo '<tr><td class="datos2"><b>'.__('Agent Version'). '</b></td>';

View File

@ -35,9 +35,14 @@ echo "<h2>".__('Pandora Agents')." &gt; ".__('Group view')."</h2>";
// Check for Network FLAG change request // Check for Network FLAG change request
// Made it a subquery, much faster on both the database and server side // Made it a subquery, much faster on both the database and server side
if (isset ($_GET["update_netgroup"])) { if (isset ($_GET["update_netgroup"])) {
if (give_acl ($config['id_user'], $_GET["update_netgroup"], "AW")) { $group = get_parameter_get ("update_netgroup", 0);
$sql = sprintf ("UPDATE tagente_modulo SET `flag` = 1 WHERE `id_agente` = ANY(SELECT id_agente FROM tagente WHERE `id_grupo` = %d)",$_GET["update_netgroup"]); if (give_acl ($config['id_user'], $group, "AW")) {
$sql = sprintf ("UPDATE tagente_modulo SET `flag` = 1 WHERE `id_agente` = ANY(SELECT id_agente FROM tagente WHERE `id_grupo` = %d)",$group);
process_sql ($sql); process_sql ($sql);
} else {
audit_db ($config['id_user'], $REMOTE_ADDR, "ACL Violation", "Trying to set flag for groups");
require ("general/noaccess.php");
exit;
} }
} }
@ -241,4 +246,4 @@ for ($table = 0; $table < $ancho; $table++) {
} }
echo "</table>"; echo "</table>";
?> ?>

View File

@ -105,7 +105,7 @@ if (mysql_num_rows ($result3)) {
<b>".$nombre_grupomodulo."</b></td>"; <b>".$nombre_grupomodulo."</b></td>";
} }
} }
$nombre_tipo_modulo = dame_nombre_tipo_modulo($row3["id_tipo_modulo"]); $nombre_tipo_modulo = get_moduletype_name ($row3["id_tipo_modulo"]);
echo "<td class='".$tdcolor."_id' title='".salida_limpia($row3["nombre"])."'>"; echo "<td class='".$tdcolor."_id' title='".salida_limpia($row3["nombre"])."'>";
echo salida_limpia(substr($row3["nombre"],0,15)); echo salida_limpia(substr($row3["nombre"],0,15));
echo "</td><td class='".$tdcolor."'>"; echo "</td><td class='".$tdcolor."'>";
@ -182,9 +182,9 @@ if (mysql_num_rows ($result3)) {
// RAW Table data // RAW Table data
echo "<td class=".$tdcolor." width=70>"; echo "<td class=".$tdcolor." width=70>";
echo "<a href='index.php?sec=estado&sec2=operation/agentes/datos_agente&tipo=mes&id=".$row3["id_agente_modulo"]."'><img border=0 src='images/data_m.png'></a>&nbsp;&nbsp;"; echo "<a href='index.php?sec=estado&sec2=operation/agentes/datos_agente&period=2592000&id=".$row3["id_agente_modulo"]."'><img border=0 src='images/data_m.png'></a>&nbsp;&nbsp;";
echo "<a href='index.php?sec=estado&sec2=operation/agentes/datos_agente&tipo=semana&id=".$row3["id_agente_modulo"]."'><img border=0 src='images/data_w.png'></a>&nbsp;&nbsp;"; echo "<a href='index.php?sec=estado&sec2=operation/agentes/datos_agente&period=604800&id=".$row3["id_agente_modulo"]."'><img border=0 src='images/data_w.png'></a>&nbsp;&nbsp;";
echo "<a href='index.php?sec=estado&sec2=operation/agentes/datos_agente&tipo=dia&id=".$row3["id_agente_modulo"]."'><img border=0 src='images/data_d.png'></a>"; echo "<a href='index.php?sec=estado&sec2=operation/agentes/datos_agente&period=86400&id=".$row3["id_agente_modulo"]."'><img border=0 src='images/data_d.png'></a>";
echo "<td class='".$tdcolor."f9'>"; echo "<td class='".$tdcolor."f9'>";

View File

@ -31,7 +31,7 @@ if (! give_acl ($config['id_user'], 0, "AR") && ! give_acl ($config['id_user'],
if (isset ($_GET["agentmodule"]) && isset ($_GET["agent"]) ){ if (isset ($_GET["agentmodule"]) && isset ($_GET["agent"]) ){
$id_agentmodule = $_GET["agentmodule"]; $id_agentmodule = $_GET["agentmodule"];
$id_agent = $_GET["agent"]; $id_agent = $_GET["agent"];
$agentmodule_name = dame_nombre_modulo_agentemodulo ($id_agentmodule); $agentmodule_name = get_agentmodule_name ($id_agentmodule);
if (! give_acl ($config['id_user'], dame_id_grupo ($id_agent), "AR")) { if (! give_acl ($config['id_user'], dame_id_grupo ($id_agent), "AR")) {
audit_db ($config['id_user'], $REMOTE_ADDR, "ACL Violation", audit_db ($config['id_user'], $REMOTE_ADDR, "ACL Violation",
"Trying to access Agent Export Data"); "Trying to access Agent Export Data");
@ -57,7 +57,7 @@ if (isset ($_GET["agentmodule"]) && isset ($_GET["agent"]) ){
// Make the query // Make the query
$sql1="SELECT * FROM tdatos WHERE id_agente = $id_agent AND id_agente_modulo = $id_agentmodule"; $sql1="SELECT * FROM tdatos WHERE id_agente = $id_agent AND id_agente_modulo = $id_agentmodule";
$tipo = dame_nombre_tipo_modulo(dame_id_tipo_modulo_agentemodulo($id_agentmodule)); $tipo = get_moduletype_name (get_agentmodule_type ($id_agentmodule));
if ($tipo == "generic_data_string") if ($tipo == "generic_data_string")
$sql1='SELECT * FROM tagente_datos_string WHERE timestamp > "'.$from_date.'" AND timestamp < "'.$to_date.'" AND id_agente_modulo ='.$id_agentmodule.' ORDER BY timestamp DESC'; $sql1='SELECT * FROM tagente_datos_string WHERE timestamp > "'.$from_date.'" AND timestamp < "'.$to_date.'" AND id_agente_modulo ='.$id_agentmodule.' ORDER BY timestamp DESC';
else else

View File

@ -52,7 +52,7 @@ function generate_average_table ($id_de_mi_agente, $id_agente_modulo, $fecha_ini
require ("include/config.php"); require ("include/config.php");
$dias_de_la_semana = array (__('Sunday'),__('Monday'), __('Tuesday'), __('Wednesday'), __('Thurdsday'), __('Friday'), __('Saturday')); $dias_de_la_semana = array (__('Sunday'),__('Monday'), __('Tuesday'), __('Wednesday'), __('Thurdsday'), __('Friday'), __('Saturday'));
$nombre_modulo = dame_nombre_modulo_agentemodulo($id_agente_modulo); $nombre_modulo = get_agentmodule_name ($id_agente_modulo);
// Table header // Table header
echo "<table border=0 cellpadding=4 cellspacing=4 width=600 class='databox'>"; echo "<table border=0 cellpadding=4 cellspacing=4 width=600 class='databox'>";
@ -114,8 +114,8 @@ if ((isset($_POST["export"])) AND (! isset($_POST["update_agent"]))){
$from_date = $start_date." ".$start_time; $from_date = $start_date." ".$start_time;
$to_date = $end_date." ".$end_time; $to_date = $end_date." ".$end_time;
$agentmodule_name = dame_nombre_modulo_agentemodulo($origen_modulo[0]); $agentmodule_name = get_agentmodule_name ($origen_modulo[0]);
echo __('Data from agent '). "<b>" . dame_nombre_agente($origen). "- $agentmodule_name</b> ". __('from'). " <b>". $from_date. "</b> ". __('to'). " <b>". $to_date. "</b><br>"; echo __('Data from agent '). "<b>" . get_agent_name($origen). "- $agentmodule_name</b> ". __('from'). " <b>". $from_date. "</b> ". __('to'). " <b>". $to_date. "</b><br>";
echo "<a href='operation/agentes/export_csv.php?from_date=$from_date&to_date=$to_date&agent=$origen&agentmodule=$id_agentemodulo'><img src='images/disk.png'> ".__('Download file')."</a> pandora_export_$agentmodule_name.txt"; echo "<a href='operation/agentes/export_csv.php?from_date=$from_date&to_date=$to_date&agent=$origen&agentmodule=$id_agentemodulo'><img src='images/disk.png'> ".__('Download file')."</a> pandora_export_$agentmodule_name.txt";
} else } else
@ -131,17 +131,17 @@ if ((isset($_POST["export"])) AND (! isset($_POST["update_agent"]))){
$start_time =$_POST["start_time"]; $start_time =$_POST["start_time"];
$end_time=$_POST["end_time"]; $end_time=$_POST["end_time"];
$agentmodule_name = dame_nombre_modulo_agentemodulo($origen_modulo[0]); $agentmodule_name = get_agentmodule_name ($origen_modulo[0]);
$from_date = $start_date." ".$start_time; $from_date = $start_date." ".$start_time;
$to_date = $end_date." ".$end_time; $to_date = $end_date." ".$end_time;
echo __('Data from agent '). "<b>" . dame_nombre_agente ($origen). "- $agentmodule_name</b> ". __('from'). " <b>". $from_date. "</b> ". __('to'). " <b>". $to_date. "</b><br>"; echo __('Data from agent '). "<b>" . get_agent_name ($origen). "- $agentmodule_name</b> ". __('from'). " <b>". $from_date. "</b> ". __('to'). " <b>". $to_date. "</b><br>";
echo "<br>"; echo "<br>";
// For each module // For each module
for ($a=0;$a <count($origen_modulo); $a++){ for ($a=0;$a <count($origen_modulo); $a++){
$id_modulo = $origen_modulo[$a]; $id_modulo = $origen_modulo[$a];
$tipo = dame_nombre_tipo_modulo(dame_id_tipo_modulo_agentemodulo($id_modulo)); $tipo = get_moduletype_name (get_agentmodule_type ($id_modulo));
if ($tipo != "generic_data_string") if ($tipo != "generic_data_string")
echo "<br>". generate_average_table ($origen,$id_modulo,$from_date,$to_date); echo "<br>". generate_average_table ($origen,$id_modulo,$from_date,$to_date);
@ -158,7 +158,7 @@ if ((isset($_POST["export"])) AND (! isset($_POST["update_agent"]))){
require ("general/noaccess.php"); require ("general/noaccess.php");
} }
$origen_modulo = $_POST["origen_modulo"]; $origen_modulo = $_POST["origen_modulo"];
$agentmodule_name = dame_nombre_modulo_agentemodulo($origen_modulo[0]); $agentmodule_name = get_agentmodule_name ($origen_modulo[0]);
$start_date =$_POST["start_date"]; $start_date =$_POST["start_date"];
$end_date=$_POST["end_date"]; $end_date=$_POST["end_date"];
$start_time =$_POST["start_time"]; $start_time =$_POST["start_time"];
@ -167,7 +167,7 @@ if ((isset($_POST["export"])) AND (! isset($_POST["update_agent"]))){
$from_date = $start_date." ".$start_time; $from_date = $start_date." ".$start_time;
$to_date = $end_date." ".$end_time; $to_date = $end_date." ".$end_time;
echo __('Data from agent '). "<b>" . dame_nombre_agente($origen). "- $agentmodule_name</b>". __(' from '). "<b>". $from_date. "</b>". __(' to '). "<b>". $to_date. "</b><br>"; echo __('Data from agent '). "<b>" . get_agent_name($origen). "- $agentmodule_name</b>". __(' from '). "<b>". $from_date. "</b>". __(' to '). "<b>". $to_date. "</b><br>";
echo "<br><table cellpadding='4' cellspacing='4' width='600' class='databox'>"; echo "<br><table cellpadding='4' cellspacing='4' width='600' class='databox'>";
echo "<tr> echo "<tr>
@ -179,7 +179,7 @@ if ((isset($_POST["export"])) AND (! isset($_POST["update_agent"]))){
for ($a=0; $a <count($origen_modulo); $a++){ // For each module (not used multiple modules yet!) for ($a=0; $a <count($origen_modulo); $a++){ // For each module (not used multiple modules yet!)
$id_modulo = $origen_modulo[$a]; $id_modulo = $origen_modulo[$a];
$sql1='SELECT * FROM tdatos WHERE id_agente = '.$origen; $sql1='SELECT * FROM tdatos WHERE id_agente = '.$origen;
$tipo = dame_nombre_tipo_modulo(dame_id_tipo_modulo_agentemodulo($id_modulo)); $tipo = get_moduletype_name (get_agentmodule_type ($id_modulo));
if ($tipo == "generic_data_string") if ($tipo == "generic_data_string")
$sql1 = 'SELECT * FROM tagente_datos_string WHERE timestamp > "'.$from_date.'" AND timestamp < "'.$to_date.'" AND id_agente_modulo ='.$id_modulo.' ORDER BY timestamp DESC'; $sql1 = 'SELECT * FROM tagente_datos_string WHERE timestamp > "'.$from_date.'" AND timestamp < "'.$to_date.'" AND id_agente_modulo ='.$id_modulo.' ORDER BY timestamp DESC';
else else
@ -245,7 +245,7 @@ if ((isset($_POST["export"])) AND (! isset($_POST["update_agent"]))){
// Show combo with agents // Show combo with agents
echo '<select name="origen" class="w130">'; echo '<select name="origen" class="w130">';
if ( (isset($_POST["update_agent"])) AND (isset($_POST["origen"])) ) { if ( (isset($_POST["update_agent"])) AND (isset($_POST["origen"])) ) {
echo "<option value=".$_POST["origen"].">".dame_nombre_agente($_POST["origen"])."</option>"; echo "<option value=".$_POST["origen"].">".get_agent_name($_POST["origen"])."</option>";
} }
$sql1='SELECT * FROM tagente'; $sql1='SELECT * FROM tagente';
$result=mysql_query($sql1); $result=mysql_query($sql1);

View File

@ -154,7 +154,7 @@ function create_pandora_node ($name, $font_size = 10) {
// Opens a group definition // Opens a group definition
function open_group ($id) { function open_group ($id) {
$img = 'images/' . dame_grupo_icono($id) . '.png'; $img = 'images/' . dame_grupo_icono($id) . '.png';
$name = dame_nombre_grupo($id); $name = get_group_name ($id);
$group = 'subgraph cluster_' . $id . $group = 'subgraph cluster_' . $id .
' { style=filled; color=darkolivegreen3; label=<<TABLE BORDER="0"> ' { style=filled; color=darkolivegreen3; label=<<TABLE BORDER="0">

View File

@ -18,7 +18,7 @@
// Load global vars // Load global vars
require("include/config.php"); require_once ("include/config.php");
check_login(); check_login();
@ -33,6 +33,7 @@ require ("include/functions_reporting.php");
echo "<h2>".__('SLA view')."</h2>"; echo "<h2>".__('SLA view')."</h2>";
$id_agent = get_parameter ("id_agente", "0"); $id_agent = get_parameter ("id_agente", "0");
$intervalo = get_agent_interval ($id_agent);
// Get all module from agent // Get all module from agent
$sql_t='SELECT * FROM tagente_estado, tagente_modulo WHERE tagente_modulo.disabled = 0 AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND tagente_modulo.id_agente='.$id_agent.' AND tagente_estado.estado != 100 AND tagente_estado.utimestamp != 0 ORDER BY tagente_modulo.nombre'; $sql_t='SELECT * FROM tagente_estado, tagente_modulo WHERE tagente_modulo.disabled = 0 AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND tagente_modulo.id_agente='.$id_agent.' AND tagente_estado.estado != 100 AND tagente_estado.utimestamp != 0 ORDER BY tagente_modulo.nombre';
@ -51,14 +52,14 @@ if (mysql_num_rows ($result_t)) {
while ($module_data=mysql_fetch_array($result_t)){ while ($module_data=mysql_fetch_array($result_t)){
# For evey module in the status table # For evey module in the status table
$est_modulo = substr($module_data["nombre"],0,25); $est_modulo = substr($module_data["nombre"],0,25);
$est_tipo = dame_nombre_tipo_modulo($module_data["id_tipo_modulo"]); $est_tipo = get_moduletype_name ($module_data["id_tipo_modulo"]);
$est_description = $module_data["descripcion"]; $est_description = $module_data["descripcion"];
$est_timestamp = $module_data["timestamp"]; $est_timestamp = $module_data["timestamp"];
$est_estado = $module_data["estado"]; $est_estado = $module_data["estado"];
$est_datos = $module_data["datos"]; $est_datos = $module_data["datos"];
$est_cambio = $module_data["cambio"]; $est_cambio = $module_data["cambio"];
$est_interval = $module_data["module_interval"]; $est_interval = $module_data["module_interval"];
if (($est_interval != $intervalo) && ($est_interval > 0)) { if ($intervalo != $est_interval && $est_interval > 0) {
$temp_interval = $est_interval; $temp_interval = $est_interval;
} else { } else {
$temp_interval = $intervalo; $temp_interval = $intervalo;
@ -165,7 +166,7 @@ if (mysql_num_rows ($result_t)) {
$id_tipo_modulo = $module_data[4]; $id_tipo_modulo = $module_data[4];
$name = $module_data[5]; $name = $module_data[5];
$description = $module_data[6]; $description = $module_data[6];
$est_tipo = dame_nombre_tipo_modulo ($id_tipo_modulo); $est_tipo = get_moduletype_name ($id_tipo_modulo);
echo "<tr>"; echo "<tr>";
echo "<td class='" . $tdcolor . "'>"; echo "<td class='" . $tdcolor . "'>";

View File

@ -204,7 +204,7 @@ echo '<div style="width: 450px; float:left;" id="rightcolumn">';
// Server information // Server information
$serverinfo = get_server_info (); $serverinfo = get_server_info ();
$total_modules = get_agentmodule_count (); $total_modules = get_agent_modules_count ();
$cells = array (); $cells = array ();
if ($serverinfo) { if ($serverinfo) {

View File

@ -52,7 +52,7 @@ if (defined ('AJAX')) {
echo '<strong>'.__('Main IP').':</strong> '.$agent['direccion'].'<br />'; echo '<strong>'.__('Main IP').':</strong> '.$agent['direccion'].'<br />';
echo '<strong>'.__('Group').':</strong> '; echo '<strong>'.__('Group').':</strong> ';
echo '<img src="images/groups_small/'.dame_grupo_icono ($agent['id_grupo']).'.png" /> '; echo '<img src="images/groups_small/'.dame_grupo_icono ($agent['id_grupo']).'.png" /> ';
echo dame_nombre_grupo ($agent['id_grupo']).'<br />'; echo get_group_name ($agent['id_grupo']).'<br />';
echo '<strong>'.__('Last contact').':</strong> '.human_time_comparation($agent['ultimo_contacto']).'<br />'; echo '<strong>'.__('Last contact').':</strong> '.human_time_comparation($agent['ultimo_contacto']).'<br />';
echo '<strong>'.__('Last remote contact').':</strong> '.human_time_comparation($agent['ultimo_contacto_remoto']).'<br />'; echo '<strong>'.__('Last remote contact').':</strong> '.human_time_comparation($agent['ultimo_contacto_remoto']).'<br />';
@ -136,7 +136,7 @@ if (! $id_agente) {
$id_grupo = get_db_value ('id_grupo', 'tagente', 'id_agente', $id_agente); $id_grupo = get_db_value ('id_grupo', 'tagente', 'id_agente', $id_agente);
if (! give_acl ($config['id_user'], $id_grupo, "AR")) { if (! give_acl ($config['id_user'], $id_grupo, "AR")) {
audit_db ($config['id_user'], $REMOTE_ADDR, "ACL Violation", audit_db ($config['id_user'], $REMOTE_ADDR, "ACL Violation",
"Trying to access (read) to agent ".dame_nombre_agente($id_agente)); "Trying to access (read) to agent ".get_agent_name($id_agente));
include ("general/noaccess.php"); include ("general/noaccess.php");
return; return;
} }
@ -183,7 +183,7 @@ if (isset($_GET["flag_agent"])){
echo "<div id='menu_tab_frame_view'>"; echo "<div id='menu_tab_frame_view'>";
echo "<div id='menu_tab_left'><ul class='mn'><li class='view'> echo "<div id='menu_tab_left'><ul class='mn'><li class='view'>
<a href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=$id_agente'><img src='images/bricks.png' class='top' border=0>&nbsp; ".substr(dame_nombre_agente($id_agente),0,15)." - ".__('View mode')."</a>"; <a href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=$id_agente'><img src='images/bricks.png' class='top' border=0>&nbsp; ".substr(get_agent_name($id_agente),0,15)." - ".__('View mode')."</a>";
echo "</li>"; echo "</li>";
echo "</ul></div>"; echo "</ul></div>";
$tab = get_parameter ("tab", "main"); $tab = get_parameter ("tab", "main");

View File

@ -320,7 +320,7 @@ foreach ($result as $row) {
$data[3] = __('System'); $data[3] = __('System');
} elseif ($row["id_agente"] > 0) { } elseif ($row["id_agente"] > 0) {
// Agent name // Agent name
$agent_name = dame_nombre_agente ($row["id_agente"]); $agent_name = get_agent_name ($row["id_agente"]);
$data[3] = '<a href='.$url.'&pure='.$config["pure"].'&id_agent='.$row["id_agente"].'" title="'.$agent_name.'" class="f9"><b>'; $data[3] = '<a href='.$url.'&pure='.$config["pure"].'&id_agent='.$row["id_agente"].'" title="'.$agent_name.'" class="f9"><b>';
if (strlen ($agent_name) > 16) { if (strlen ($agent_name) > 16) {
$data[3] .= substr ($agent_name, 0, 14)."..."; $data[3] .= substr ($agent_name, 0, 14)."...";
@ -341,7 +341,7 @@ foreach ($result as $row) {
} }
if (!empty ($row["id_grupo"])) { if (!empty ($row["id_grupo"])) {
$data[5] = '<img src="images/groups_small/'.show_icon_group ($row["id_grupo"]).'.png" title="'.dame_nombre_grupo ($row["id_grupo"]).'" class="bot" />'; $data[5] = '<img src="images/groups_small/'.show_icon_group ($row["id_grupo"]).'.png" title="'.get_group_name ($row["id_grupo"]).'" class="bot" />';
} else { } else {
$data[5] = ''; $data[5] = '';
} }

View File

@ -282,7 +282,7 @@ if ($count < 1) {
$data[3] = print_incidents_priority_img ($row["prioridad"], true); $data[3] = print_incidents_priority_img ($row["prioridad"], true);
$data[4] = '<img src="images/groups_small/'.show_icon_group ($row["id_grupo"]).'.png" title="'.dame_grupo ($row["id_grupo"]).'" />'; $data[4] = '<img src="images/groups_small/'.show_icon_group ($row["id_grupo"]).'.png" title="'.get_group_name ($row["id_grupo"]).'" />';
$data[5] = print_timestamp ($row["actualizacion"], "", "span", true); $data[5] = print_timestamp ($row["actualizacion"], "", "span", true);

View File

@ -119,7 +119,7 @@ if (isset ($_GET["nuevo"])) { //create message
$sql = sprintf ("SELECT DISTINCT(id_grupo) FROM tusuario_perfil WHERE %s",$group_id); $sql = sprintf ("SELECT DISTINCT(id_grupo) FROM tusuario_perfil WHERE %s",$group_id);
$result = get_db_all_rows_sql ($sql); $result = get_db_all_rows_sql ($sql);
foreach ($result as $row) { foreach ($result as $row) {
echo '<option value="'.$row["id_grupo"].'">'.dame_nombre_grupo($row["id_grupo"]).'</option>'; echo '<option value="'.$row["id_grupo"].'">'.get_group_name ($row["id_grupo"]).'</option>';
} }
echo '</select></td></tr> echo '</select></td></tr>
<tr><td class="datos">'.__('Subject').':</td><td class="datos"><input name="subject" size="60"></td></tr><tr> <tr><td class="datos">'.__('Subject').':</td><td class="datos"><input name="subject" size="60"></td></tr><tr>

View File

@ -125,7 +125,7 @@ $table->class = 'databox report_table';
$table->rowclass = array (); $table->rowclass = array ();
$table->rowclass[0] = 'datos3'; $table->rowclass[0] = 'datos3';
$group_name = dame_grupo ($report['id_group']); $group_name = get_group_name ($report['id_group']);
$contents = get_db_all_rows_field_filter ("treport_content", "id_report", $id_report, "`order`"); $contents = get_db_all_rows_field_filter ("treport_content", "id_report", $id_report, "`order`");
if ($contents === false) { if ($contents === false) {
return; return;
@ -138,7 +138,7 @@ foreach ($contents as $content) {
$table->rowstyle = array (); $table->rowstyle = array ();
$module_name = get_db_value ('nombre', 'tagente_modulo', 'id_agente_modulo', $content['id_agent_module']); $module_name = get_db_value ('nombre', 'tagente_modulo', 'id_agente_modulo', $content['id_agent_module']);
$agent_name = dame_nombre_agente_agentemodulo ($content['id_agent_module']); $agent_name = get_agentmodule_agent_name ($content['id_agent_module']);
switch ($content["type"]) { switch ($content["type"]) {
case 1: case 1:
@ -210,9 +210,9 @@ foreach ($contents as $content) {
$table->colspan[$n][0] = 2; $table->colspan[$n][0] = 2;
$data[0] = '<strong>'.__('Agent')."</strong> : "; $data[0] = '<strong>'.__('Agent')."</strong> : ";
$data[0] .= dame_nombre_agente_agentemodulo ($sla['id_agent_module'])."<br />"; $data[0] .= get_agentmodule_agent_name ($sla['id_agent_module'])."<br />";
$data[0] .= '<strong>'.__('Module')."</strong> : "; $data[0] .= '<strong>'.__('Module')."</strong> : ";
$data[0] .= dame_nombre_modulo_agentemodulo ($sla['id_agent_module'])."<br />"; $data[0] .= get_agentmodule_name ($sla['id_agent_module'])."<br />";
$data[0] .= '<strong>'.__('SLA Max. (value)')."</strong> : "; $data[0] .= '<strong>'.__('SLA Max. (value)')."</strong> : ";
$data[0] .= $sla['sla_max']."<br />"; $data[0] .= $sla['sla_max']."<br />";
$data[0] .= '<strong>'.__('SLA Min. (value)')."</strong> : "; $data[0] .= '<strong>'.__('SLA Min. (value)')."</strong> : ";

View File

@ -139,7 +139,7 @@ if ($datetime > time ()) {
exit; exit;
} }
$group_name = dame_grupo ($report['id_group']); $group_name = get_group_name ($report['id_group']);
$contents = get_db_all_rows_field_filter ('treport_content', 'id_report', $id_report, '`order`'); $contents = get_db_all_rows_field_filter ('treport_content', 'id_report', $id_report, '`order`');
@ -158,7 +158,7 @@ $xml["reports"] = array ();
foreach ($contents as $content) { foreach ($contents as $content) {
$data = array (); $data = array ();
$data["module"] = get_db_value ('nombre', 'tagente_modulo', 'id_agente_modulo', $content['id_agent_module']); $data["module"] = get_db_value ('nombre', 'tagente_modulo', 'id_agente_modulo', $content['id_agent_module']);
$data["agent"] = dame_nombre_agente_agentemodulo ($content['id_agent_module']); $data["agent"] = get_agentmodule_agent_name ($content['id_agent_module']);
$data["period"] = human_time_description ($content['period']); $data["period"] = human_time_description ($content['period']);
$data["uperiod"] = $content['period']; $data["uperiod"] = $content['period'];
$data["type"] = $content["type"]; $data["type"] = $content["type"];
@ -202,8 +202,8 @@ foreach ($contents as $content) {
$sla_failed = false; $sla_failed = false;
foreach ($slas as $sla) { foreach ($slas as $sla) {
$sla_data = array (); $sla_data = array ();
$sla_data["agent"] = dame_nombre_agente_agentemodulo ($sla['id_agent_module']); $sla_data["agent"] = get_agentmodule_agent_name ($sla['id_agent_module']);
$sla_data["module"] = dame_nombre_modulo_agentemodulo ($sla['id_agent_module']); $sla_data["module"] = get_agentmodule_name ($sla['id_agent_module']);
$sla_data["max"] = $sla['sla_max']; $sla_data["max"] = $sla['sla_max'];
$sla_data["min"] = $sla['sla_min']; $sla_data["min"] = $sla['sla_min'];

View File

@ -72,8 +72,8 @@ while ($rowdup=mysql_fetch_array($resq1)){
echo "<a href='#' class='$tip'>&nbsp;<span>"; echo "<a href='#' class='$tip'>&nbsp;<span>";
if (mysql_num_rows($result)){ if (mysql_num_rows($result)){
while ($row=mysql_fetch_array($result)){ while ($row=mysql_fetch_array($result)){
echo dame_perfil($row["id_perfil"])."/ "; echo dame_perfil ($row["id_perfil"])."/ ";
echo dame_grupo($row["id_grupo"])."<br>"; echo get_group_name ($row["id_grupo"])."<br>";
} }
} }
else { echo __('This user doesn\'t have any assigned profile/group'); } else { echo __('This user doesn\'t have any assigned profile/group'); }

View File

@ -154,7 +154,7 @@ if (mysql_num_rows ($result)) {
} }
echo '<td class="'.$tdcolor.'">'; echo '<td class="'.$tdcolor.'">';
echo "<b>".dame_perfil($row["id_perfil"])."</b> / "; echo "<b>".dame_perfil($row["id_perfil"])."</b> / ";
echo "<b>".dame_grupo($row["id_grupo"])."</b><tr>"; echo "<b>".get_group_name ($row["id_grupo"])."</b><tr>";
} }
} else { } else {
echo '<div class="nf">'.__('This user doesn\'t have any assigned profile/group').'</div>'; echo '<div class="nf">'.__('This user doesn\'t have any assigned profile/group').'</div>';

View File

@ -47,8 +47,8 @@ foreach ($layouts as $layout) {
$data[0] = '<a href="index.php?sec=visualc&sec2=operation/visual_console/render_view&id='. $data[0] = '<a href="index.php?sec=visualc&sec2=operation/visual_console/render_view&id='.
$layout['id'].'">'.$layout['name'].'</a>'; $layout['id'].'">'.$layout['name'].'</a>';
$data[1] = '<img src="images/'.dame_grupo_icono($layout["id_group"]).'.png" $data[1] = '<img src="images/'.dame_grupo_icono($layout["id_group"]).'.png"
title="'.dame_nombre_grupo ($layout["id_group"]).'"> '; title="'.get_group_name ($layout["id_group"]).'"> ';
$data[1] .= dame_nombre_grupo ($layout["id_group"]); $data[1] .= get_group_name ($layout["id_group"]);
$data[2] = get_db_value ('COUNT(*)', 'tlayout_data', 'id_layout', $layout['id']); $data[2] = get_db_value ('COUNT(*)', 'tlayout_data', 'id_layout', $layout['id']);
array_push ($table->data, $data); array_push ($table->data, $data);

View File

@ -123,9 +123,9 @@ function graphic_combined_module ($module_list, $weight_list, $periodo, $width,
// FOR EACH MODULE IN module_list.... // FOR EACH MODULE IN module_list....
for ($i = 0; $i < $module_number; $i++){ for ($i = 0; $i < $module_number; $i++){
$id_agente_modulo = $module_list[$i]; $id_agente_modulo = $module_list[$i];
$nombre_agente = dame_nombre_agente_agentemodulo($id_agente_modulo); $nombre_agente = get_agentmodule_agent_name($id_agente_modulo);
$id_agente = dame_agente_id($nombre_agente); $id_agente = dame_agente_id($nombre_agente);
$nombre_modulo = dame_nombre_modulo_agentemodulo($id_agente_modulo); $nombre_modulo = get_agentmodule_name ($id_agente_modulo);
$module_list_name[$i] = substr($nombre_agente,0,9)." / ".substr($nombre_modulo,0,20); $module_list_name[$i] = substr($nombre_agente,0,9)." / ".substr($nombre_modulo,0,20);
for ($j = 0; $j <= $resolution; $j++) { for ($j = 0; $j <= $resolution; $j++) {
$valores[$j][0] = 0; // SUM of all values for this interval $valores[$j][0] = 0; // SUM of all values for this interval
@ -407,9 +407,9 @@ function grafico_modulo_sparse ($id_agente_modulo, $periodo, $show_event,
$fechatope = $date - $periodo; $fechatope = $date - $periodo;
$horasint = $periodo / $resolution; // Each intervalo is $horasint seconds length $horasint = $periodo / $resolution; // Each intervalo is $horasint seconds length
$nombre_agente = dame_nombre_agente_agentemodulo ($id_agente_modulo); $nombre_agente = get_agentmodule_agent_name ($id_agente_modulo);
$id_agente = dame_agente_id ($nombre_agente); $id_agente = dame_agente_id ($nombre_agente);
$nombre_modulo = dame_nombre_modulo_agentemodulo ($id_agente_modulo); $nombre_modulo = get_agentmodule_name ($id_agente_modulo);
if ($show_event) { if ($show_event) {
// If we want to show events in graphs // If we want to show events in graphs
@ -930,9 +930,9 @@ function graphic_string_data ($id_agent_module, $periodo, $width, $height, $pure
return; return;
} }
$nombre_agente = dame_nombre_agente_agentemodulo ($id_agent_module); $nombre_agente = get_agentmodule_agent_name ($id_agent_module);
$id_agente = dame_agente_id ($nombre_agente); $id_agente = dame_agente_id ($nombre_agente);
$nombre_modulo = dame_nombre_modulo_agentemodulo ($id_agent_module); $nombre_modulo = get_agentmodule_name ($id_agent_module);
if ($pure == 0) { if ($pure == 0) {
$Graph =& Image_Graph::factory('graph', array($width, $height)); $Graph =& Image_Graph::factory('graph', array($width, $height));
@ -1056,7 +1056,7 @@ function graphic_incident_group () {
$result2=mysql_query ($sql); $result2=mysql_query ($sql);
$row2 = mysql_fetch_array($result2); $row2 = mysql_fetch_array($result2);
$data[] = $row2[0]; $data[] = $row2[0];
$legend[] = dame_nombre_grupo($row[0])."(".$row2[0].")"; $legend[] = get_group_name ($row[0])."(".$row2[0].")";
} }
// Sort array by bubble method (yes, I study more methods in university, but if you want more speed, please, submit a patch :) // Sort array by bubble method (yes, I study more methods in university, but if you want more speed, please, submit a patch :)
// or much better, pay me to do a special version for you, highly optimized :-)))) // or much better, pay me to do a special version for you, highly optimized :-))))
@ -1207,7 +1207,7 @@ function grafico_db_agentes_modulos($width, $height) {
$result = array(); $result = array();
foreach ($result as $row) { foreach ($result as $row) {
$data[] = get_agentmodule_count ($row["id_agente"]); $data[] = get_agent_modules_count ($row["id_agente"]);
$legend[] = get_agent_name ($row["id_agente"], "lower"); $legend[] = get_agent_name ($row["id_agente"], "lower");
} }
@ -1328,7 +1328,7 @@ function graph_event_module ($width = 300, $height = 200, $id_agent) {
$legend[] = "SYSTEM (".$row["count"].")"; $legend[] = "SYSTEM (".$row["count"].")";
} else { } else {
//Other events //Other events
$legend[] = substr (dame_nombre_modulo_agentemodulo ($row["id_agentmodule"]), 0, 15)." (".$row["count"].")"; $legend[] = substr (get_agentmodule_name ($row["id_agentmodule"]), 0, 15)." (".$row["count"].")";
} }
} }
} }
@ -1447,7 +1447,7 @@ function grafico_db_agentes_purge ($id_agent, $width, $height) {
$id_agent = -1; $id_agent = -1;
$query = ""; $query = "";
} else { } else {
$modules = get_agentmodules ($id_agent); $modules = get_agent_modules ($id_agent);
$query = sprintf (" AND id_agente_modulo IN (%s)", implode (",", array_keys ($modules))); $query = sprintf (" AND id_agente_modulo IN (%s)", implode (",", array_keys ($modules)));
} }
@ -1707,9 +1707,9 @@ function grafico_modulo_boolean ( $id_agente_modulo, $periodo, $show_event,
//$unix_timestamp = strtotime($mysql_timestamp) // Convert MYSQL format tio utime //$unix_timestamp = strtotime($mysql_timestamp) // Convert MYSQL format tio utime
$fechatope = time() - $periodo; // limit date $fechatope = time() - $periodo; // limit date
$horasint = $periodo / $resolution; // Each intervalo is $horasint seconds length $horasint = $periodo / $resolution; // Each intervalo is $horasint seconds length
$nombre_agente = dame_nombre_agente_agentemodulo($id_agente_modulo); $nombre_agente = get_agentmodule_agent_name($id_agente_modulo);
$id_agente = dame_agente_id($nombre_agente); $id_agente = dame_agente_id($nombre_agente);
$nombre_modulo = dame_nombre_modulo_agentemodulo($id_agente_modulo); $nombre_modulo = get_agentmodule_name ($id_agente_modulo);
if ($show_event == 1) if ($show_event == 1)
$real_event = array(); $real_event = array();