2009-03-24 Evi Vanoost <vanooste@rcbi.rochester.edu>
* include/functions_db.php: Made get_server_info more accurate as far as exact module types etc. * operation/servers/view_server.php: Return dash in case there is no lag * operation/servers/view_server_detail.php: Style fixes git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1558 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
2a1db6c08c
commit
f36371c329
|
@ -1,3 +1,12 @@
|
||||||
|
2009-03-24 Evi Vanoost <vanooste@rcbi.rochester.edu>
|
||||||
|
|
||||||
|
* include/functions_db.php: Made get_server_info more accurate as far as
|
||||||
|
exact module types etc.
|
||||||
|
|
||||||
|
* operation/servers/view_server.php: Return dash in case there is no lag
|
||||||
|
|
||||||
|
* operation/servers/view_server_detail.php: Style fixes
|
||||||
|
|
||||||
2009-03-24 Esteban Sanchez <estebans@artica.es>
|
2009-03-24 Esteban Sanchez <estebans@artica.es>
|
||||||
|
|
||||||
* general/pandora_help.php: Added support for enterprise help files.
|
* general/pandora_help.php: Added support for enterprise help files.
|
||||||
|
|
|
@ -2619,8 +2619,8 @@ function get_server_info ($id_server = -1) {
|
||||||
}
|
}
|
||||||
|
|
||||||
$modules_info = array ();
|
$modules_info = array ();
|
||||||
$modules_total = 0;
|
$modules_total = array ();
|
||||||
$result = get_db_all_rows_sql ("SELECT DISTINCT(tagente_estado.running_by) , COUNT(*) AS modules
|
$result = get_db_all_rows_sql ("SELECT DISTINCT(tagente_estado.running_by), COUNT(*) AS modules, id_modulo
|
||||||
FROM tagente_estado, tagente_modulo
|
FROM tagente_estado, tagente_modulo
|
||||||
WHERE tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo
|
WHERE tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo
|
||||||
AND tagente_modulo.disabled = 0
|
AND tagente_modulo.disabled = 0
|
||||||
|
@ -2631,9 +2631,14 @@ function get_server_info ($id_server = -1) {
|
||||||
|
|
||||||
foreach ($result as $row) {
|
foreach ($result as $row) {
|
||||||
$modules_info[$row["running_by"]] = $row["modules"];
|
$modules_info[$row["running_by"]] = $row["modules"];
|
||||||
$modules_total += $row["modules"];
|
if (!isset ($modules_total[$row["id_modulo"]])) {
|
||||||
|
$modules_total[$row["id_modulo"]] = $row["modules"];
|
||||||
|
} else {
|
||||||
|
$modules_total[$row["id_modulo"]] += $row["modules"];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$recon_total = get_db_sql ("SELECT COUNT(*) FROM trecon_task");
|
||||||
|
|
||||||
$sql = "SELECT * FROM tserver".$select_id;
|
$sql = "SELECT * FROM tserver".$select_id;
|
||||||
$result = get_db_all_rows_sql ($sql);
|
$result = get_db_all_rows_sql ($sql);
|
||||||
|
@ -2647,20 +2652,28 @@ function get_server_info ($id_server = -1) {
|
||||||
foreach ($result as $server) {
|
foreach ($result as $server) {
|
||||||
if ($server["network_server"] == 1) {
|
if ($server["network_server"] == 1) {
|
||||||
$server["type"] = "network";
|
$server["type"] = "network";
|
||||||
|
$id_modulo = 2;
|
||||||
} elseif ($server["data_server"] == 1) {
|
} elseif ($server["data_server"] == 1) {
|
||||||
$server["type"] = "data";
|
$server["type"] = "data";
|
||||||
|
$id_modulo = 1;
|
||||||
} elseif ($server["plugin_server"] == 1) {
|
} elseif ($server["plugin_server"] == 1) {
|
||||||
$server["type"] = "plugin";
|
$server["type"] = "plugin";
|
||||||
|
$id_modulo = 4;
|
||||||
} elseif ($server["wmi_server"] == 1) {
|
} elseif ($server["wmi_server"] == 1) {
|
||||||
$server["type"] = "wmi";
|
$server["type"] = "wmi";
|
||||||
|
$id_modulo = 6;
|
||||||
} elseif ($server["recon_server"] == 1) {
|
} elseif ($server["recon_server"] == 1) {
|
||||||
$server["type"] = "recon";
|
$server["type"] = "recon";
|
||||||
|
$id_modulo = 0;
|
||||||
} elseif ($server["snmp_server"] == 1) {
|
} elseif ($server["snmp_server"] == 1) {
|
||||||
$server["type"] = "snmp";
|
$server["type"] = "snmp";
|
||||||
|
$id_modulo = 0;
|
||||||
} elseif ($server["prediction_server"] == 1) {
|
} elseif ($server["prediction_server"] == 1) {
|
||||||
$server["type"] = "prediction";
|
$server["type"] = "prediction";
|
||||||
|
$id_modulo = 5;
|
||||||
} else {
|
} else {
|
||||||
$server["type"] = "unknown";
|
$server["type"] = "unknown";
|
||||||
|
$id_modulo = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty ($modules_info[$server["id_server"]])) {
|
if (empty ($modules_info[$server["id_server"]])) {
|
||||||
|
@ -2671,10 +2684,15 @@ function get_server_info ($id_server = -1) {
|
||||||
$server["module_lag"] = 0;
|
$server["module_lag"] = 0;
|
||||||
$server["lag"] = 0;
|
$server["lag"] = 0;
|
||||||
$server["load"] = 0;
|
$server["load"] = 0;
|
||||||
$server["modules_total"] = $modules_total;
|
|
||||||
|
|
||||||
if ($server["modules"] > 0) {
|
if (!isset ($modules_total[$id_modulo])) {
|
||||||
//If the server doesn't have modules, it doesn't have lag
|
$server["modules_total"] = 0;
|
||||||
|
} else {
|
||||||
|
$server["modules_total"] = $modules_total[$id_modulo];
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($id_modulo > 0 && $server["modules"] > 0) {
|
||||||
|
//If the server doesn't have modules, it doesn't have lag so nothing to calculate. If it's not a module server, don't go here either
|
||||||
$result = get_db_row_sql ("SELECT COUNT(*) AS module_lag, MAX(last_execution_try - current_interval) AS lag FROM tagente_estado
|
$result = get_db_row_sql ("SELECT COUNT(*) AS module_lag, MAX(last_execution_try - current_interval) AS lag FROM tagente_estado
|
||||||
WHERE last_execution_try > 0
|
WHERE last_execution_try > 0
|
||||||
AND current_interval > 0
|
AND current_interval > 0
|
||||||
|
@ -2691,7 +2709,33 @@ function get_server_info ($id_server = -1) {
|
||||||
$server["module_lag"] = $result["module_lag"];
|
$server["module_lag"] = $result["module_lag"];
|
||||||
}
|
}
|
||||||
|
|
||||||
$server["load"] = (int) $server["modules"] / $modules_total * 100;
|
$server["load"] = round ($server["modules"] / $server["modules_total"] * 100);
|
||||||
|
} else {
|
||||||
|
switch ($server["type"]) {
|
||||||
|
case "recon":
|
||||||
|
$tasks = get_db_all_rows_sql ("SELECT status, utimestamp FROM trecon_task WHERE id_recon_server = ".$server["id_server"]);
|
||||||
|
if (empty ($tasks)) {
|
||||||
|
$tasks = array ();
|
||||||
|
}
|
||||||
|
//Jobs running on this recon server
|
||||||
|
$server["modules"] = count ($tasks);
|
||||||
|
//Total recon jobs (all servers)
|
||||||
|
$server["modules_total"] = $recon_total;
|
||||||
|
$server["load"] = round ($server["modules"] / $server["modules_total"] * 100);
|
||||||
|
//Lag (take average active time of all active tasks)
|
||||||
|
$lags = array ();
|
||||||
|
foreach ($tasks as $task) {
|
||||||
|
if ($task["status"] > 0 && $task["status"] <= 100) {
|
||||||
|
$lags[] = $time - $task["utimestamp"];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (count ($lags) > 0) {
|
||||||
|
$server["lag"] = (int) array_sum ($lags) / count ($lags);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Push the raw data on the return stack
|
//Push the raw data on the return stack
|
||||||
|
|
|
@ -77,7 +77,7 @@ foreach ($servers as $server) {
|
||||||
// Load
|
// Load
|
||||||
$data[2] = print_image ("reporting/fgraph.php?tipo=progress&percent=".$server["load"]."&height=20&width=80", true);
|
$data[2] = print_image ("reporting/fgraph.php?tipo=progress&percent=".$server["load"]."&height=20&width=80", true);
|
||||||
$data[3] = $server["modules"] . " ".__('of')." ". $server["modules_total"];
|
$data[3] = $server["modules"] . " ".__('of')." ". $server["modules_total"];
|
||||||
$data[4] = '<span style="white-space:nowrap;">'.human_time_description_raw ($server["lag"]) . " / ". $server["module_lag"].'</span>';
|
$data[4] = '<span style="white-space:nowrap;">'.($server["lag"] == 0 ? '-' : human_time_description_raw ($server["lag"])) . " / ". $server["module_lag"].'</span>';
|
||||||
$data[5] = '<span style="white-space:nowrap;">';
|
$data[5] = '<span style="white-space:nowrap;">';
|
||||||
if ($server['network_server'] == 1) {
|
if ($server['network_server'] == 1) {
|
||||||
$data[5] .= print_image ("images/network.png", true, array ("title" => __('Network Server')));
|
$data[5] .= print_image ("images/network.png", true, array ("title" => __('Network Server')));
|
||||||
|
|
|
@ -48,16 +48,17 @@ $id_server = (int) get_parameter ("server_id", -1);
|
||||||
$server_name = get_server_name ($id_server);
|
$server_name = get_server_name ($id_server);
|
||||||
$recon_tasks = get_db_all_rows_field_filter ("trecon_task", "id_recon_server", $id_server);
|
$recon_tasks = get_db_all_rows_field_filter ("trecon_task", "id_recon_server", $id_server);
|
||||||
|
|
||||||
echo "<h2>". __('Configuration detail') . " - ".$server_name;
|
echo "<h2>". __('Configuration detail') . " - ".safe_input ($server_name);
|
||||||
echo ' <a href="index.php?sec=estado_server&sec2=operation/servers/view_server_detail&server_id='.$id_server.'"><img src="images/refresh.png" /></a>';
|
echo ' <a href="index.php?sec=estado_server&sec2=operation/servers/view_server_detail&server_id='.$id_server.'">';
|
||||||
echo "</h2>";
|
print_image ("images/refresh.png");
|
||||||
|
echo "</a></h2>";
|
||||||
|
|
||||||
|
|
||||||
// Show network tasks for Recon Server
|
// Show network tasks for Recon Server
|
||||||
if ($recon_tasks === false) {
|
if ($recon_tasks === false) {
|
||||||
$recon_tasks = array ();
|
$recon_tasks = array ();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$table->cellpadding = 4;
|
$table->cellpadding = 4;
|
||||||
$table->cellspacing = 4;
|
$table->cellspacing = 4;
|
||||||
$table->width = 725;
|
$table->width = 725;
|
||||||
|
@ -102,15 +103,17 @@ $table->align[10] = "center";
|
||||||
foreach ($recon_tasks as $task) {
|
foreach ($recon_tasks as $task) {
|
||||||
$data = array ();
|
$data = array ();
|
||||||
|
|
||||||
$data[0] = '<a href="index.php?sec=estado_server&sec2=operation/servers/view_server_detail&server_id='.$id_server.'&force='.$task["id_rt"].'"><img src="images/target.png" border="0" alt="'.__('Force').'" title="'.__('Force').'" /></a>';
|
$data[0] = '<a href="index.php?sec=estado_server&sec2=operation/servers/view_server_detail&server_id='.$id_server.'&force='.$task["id_rt"].'">';
|
||||||
|
$data[0] .= print_image ("images/target.png", true, array ("title" => __('Force')));
|
||||||
|
$data[0] .= '</a>';
|
||||||
|
|
||||||
$data[1] = '<b>'.$task["name"].'</b>';
|
$data[1] = '<b>'.safe_input ($task["name"]).'</b>';
|
||||||
|
|
||||||
$data[2] = human_time_description ($task["interval_sweep"]);
|
$data[2] = human_time_description ($task["interval_sweep"]);
|
||||||
|
|
||||||
$data[3] = $task["subnet"];
|
$data[3] = $task["subnet"];
|
||||||
|
|
||||||
if ($task["status"] == -1) {
|
if ($task["status"] <= 0) {
|
||||||
$data[4] = __('Done');
|
$data[4] = __('Done');
|
||||||
} else {
|
} else {
|
||||||
$data[4] = __('Pending');
|
$data[4] = __('Pending');
|
||||||
|
@ -122,16 +125,16 @@ foreach ($recon_tasks as $task) {
|
||||||
|
|
||||||
$data[7] = print_os_icon ($task["id_os"], false, true);
|
$data[7] = print_os_icon ($task["id_os"], false, true);
|
||||||
|
|
||||||
if ($task["status"] < 0 || $task["status"] > 100) {
|
if ($task["status"] <= 0 || $task["status"] > 100) {
|
||||||
$data[8] = "-";
|
$data[8] = "-";
|
||||||
} else {
|
} else {
|
||||||
$data[8] = '<img src="reporting/fgraph.php?tipo=progress&percent='.$task["status"].'&height=20&width=100" />';
|
$data[8] = print_image ("reporting/fgraph.php?tipo=progress&percent=".$task['status']."&height=20&width=100", true, array ("title" => __('Progress').':'.$task["status"].'%'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$data[9] = print_timestamp ($task["utimestamp"], true);
|
$data[9] = print_timestamp ($task["utimestamp"], true);
|
||||||
|
|
||||||
if (give_acl ($config["id_user"], $task["id_group"], "PM")) {
|
if (give_acl ($config["id_user"], $task["id_group"], "PM")) {
|
||||||
$data[10] = '<a href="index.php?sec=gservers&sec2=godmode/servers/manage_recontask_form&update='.$task["id_rt"].'"><img src="images/wrench_orange.png" /></a>';
|
$data[10] = '<a href="index.php?sec=gservers&sec2=godmode/servers/manage_recontask_form&update='.$task["id_rt"].'">'.print_image ("images/wrench_orange.png", true).'</a>';
|
||||||
} else {
|
} else {
|
||||||
$data[10] = '';
|
$data[10] = '';
|
||||||
}
|
}
|
||||||
|
@ -145,4 +148,4 @@ if (empty ($table->data)) {
|
||||||
print_table ($table);
|
print_table ($table);
|
||||||
}
|
}
|
||||||
unset ($table);
|
unset ($table);
|
||||||
?>
|
?>
|
Loading…
Reference in New Issue