2012-06-12 Ramon Novoa <rnovoa@artica.es>
* include/functions_servers.php, godmode/servers/modificar_server.php: Merged from 4.0 branch. Added real-time export server stats. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6514 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
9fe36f3d39
commit
0dd35145cf
|
@ -1,3 +1,9 @@
|
|||
2012-06-12 Ramon Novoa <rnovoa@artica.es>
|
||||
|
||||
* include/functions_servers.php,
|
||||
godmode/servers/modificar_server.php: Merged from 4.0 branch. Added
|
||||
real-time export server stats.
|
||||
|
||||
2012-06-12 Miguel de Dios <miguel.dedios@artica.es>
|
||||
|
||||
* extras/pandoradb_migrate_v3.2_to_v4.0.sql: added the lost
|
||||
|
|
|
@ -145,10 +145,13 @@ else {
|
|||
$data[4] = 'N/A';
|
||||
$data[5] = 'N/A';
|
||||
break;
|
||||
case "export":
|
||||
$data[3] = progress_bar($server["load"], 60, 20, $server["lag_txt"], 0);
|
||||
$data[4] = $server["modules"] . " ".__('of')." ". $server["modules_total"];
|
||||
$data[5] = 'N/A';
|
||||
break;
|
||||
default:
|
||||
// Load
|
||||
$data[3] =
|
||||
progress_bar($server["load"], 60, 20, $server["lag_txt"], 0);
|
||||
$data[3] = progress_bar($server["load"], 60, 20, $server["lag_txt"], 0);
|
||||
$data[4] = $server["modules"] . " ".__('of')." ". $server["modules_total"];
|
||||
$data[5] = '<span style="white-space:nowrap;">'.$server["lag_txt"].'</span>';
|
||||
break;
|
||||
|
|
|
@ -256,8 +256,51 @@ function servers_get_info ($id_server = -1) {
|
|||
$server["module_lag"] = 0;
|
||||
$server["lag"] = 0;
|
||||
|
||||
// Export server
|
||||
if ($server["server_type"] == 7) {
|
||||
|
||||
# Get modules exported by this server
|
||||
$server["modules"] = db_get_sql ("SELECT COUNT(tagente_modulo.id_agente_modulo) FROM tagente, tagente_modulo, tserver_export WHERE tagente.disabled=0 AND tagente_modulo.id_agente = tagente.id_agente AND tagente_modulo.id_export = tserver_export.id AND tserver_export.id_export_server = " . $server["id_server"]);
|
||||
|
||||
# Get total exported modules
|
||||
$server["modules_total"] = db_get_sql ("SELECT COUNT(tagente_modulo.id_agente_modulo) FROM tagente, tagente_modulo WHERE tagente.disabled=0 AND tagente_modulo.id_agente = tagente.id_agente AND tagente_modulo.id_export != 0");
|
||||
|
||||
$server["lag"] = 0;
|
||||
$server["module_lag"] = 0;
|
||||
|
||||
if ($server["server_type"] != 3) {
|
||||
}
|
||||
// Recon server
|
||||
else if ($server["server_type"] == 3) {
|
||||
|
||||
$server["name"] = '<a href="index.php?sec=estado_server&sec2=operation/servers/recon_view&server_id='.$server["id_server"].'">'.$server["name"].'</a>';
|
||||
|
||||
//Total jobs running on this recon server
|
||||
$server["modules"] = db_get_sql ("SELECT COUNT(id_rt) FROM trecon_task WHERE id_recon_server = ".$server["id_server"]);
|
||||
|
||||
//Total recon jobs (all servers)
|
||||
$server["modules_total"] = db_get_sql ("SELECT COUNT(status) FROM trecon_task");
|
||||
|
||||
//Lag (take average active time of all active tasks)
|
||||
$server["module_lag"] = 0;
|
||||
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
$server["lag"] = db_get_sql ("SELECT UNIX_TIMESTAMP() - utimestamp from trecon_task WHERE UNIX_TIMESTAMP() > (utimestamp + interval_sweep) AND id_recon_server = ".$server["id_server"]);
|
||||
|
||||
$server["module_lag"] = db_get_sql ("SELECT COUNT(id_rt) FROM trecon_task WHERE UNIX_TIMESTAMP() > (utimestamp + interval_sweep) AND id_recon_server = ".$server["id_server"]);
|
||||
break;
|
||||
case "postgresql":
|
||||
$server["lag"] = db_get_sql ("SELECT ceil(date_part('epoch', CURRENT_TIMESTAMP)) - utimestamp from trecon_task WHERE ceil(date_part('epoch', CURRENT_TIMESTAMP)) > (utimestamp + interval_sweep) AND id_recon_server = ".$server["id_server"]);
|
||||
|
||||
$server["module_lag"] = db_get_sql ("SELECT COUNT(id_rt) FROM trecon_task WHERE ceil(date_part('epoch', CURRENT_TIMESTAMP)) > (utimestamp + interval_sweep) AND id_recon_server = ".$server["id_server"]);
|
||||
break;
|
||||
case "oracle":
|
||||
$server["lag"] = db_get_sql ("SELECT ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (86400)) - utimestamp from trecon_task WHERE ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (86400)) > (utimestamp + interval_sweep) AND id_recon_server = ".$server["id_server"]);
|
||||
|
||||
$server["module_lag"] = db_get_sql ("SELECT COUNT(id_rt) FROM trecon_task WHERE ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (86400)) > (utimestamp + interval_sweep) AND id_recon_server = ".$server["id_server"]);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// Data, Plugin, WMI, Network and Others
|
||||
|
@ -360,44 +403,8 @@ function servers_get_info ($id_server = -1) {
|
|||
|
||||
if (!empty ($result["module_lag"])) {
|
||||
$server["module_lag"] = $result["module_lag"];
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// Recon server only
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
}
|
||||
elseif ($server["server_type"] == 3) {
|
||||
|
||||
$server["name"] = '<a href="index.php?sec=estado_server&sec2=operation/servers/recon_view&server_id='.$server["id_server"].'">'.$server["name"].'</a>';
|
||||
|
||||
//Total jobs running on this recon server
|
||||
$server["modules"] = db_get_sql ("SELECT COUNT(id_rt) FROM trecon_task WHERE id_recon_server = ".$server["id_server"]);
|
||||
|
||||
//Total recon jobs (all servers)
|
||||
$server["modules_total"] = db_get_sql ("SELECT COUNT(status) FROM trecon_task");
|
||||
|
||||
//Lag (take average active time of all active tasks)
|
||||
$server["module_lag"] = 0;
|
||||
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
$server["lag"] = db_get_sql ("SELECT UNIX_TIMESTAMP() - utimestamp from trecon_task WHERE UNIX_TIMESTAMP() > (utimestamp + interval_sweep) AND id_recon_server = ".$server["id_server"]);
|
||||
|
||||
$server["module_lag"] = db_get_sql ("SELECT COUNT(id_rt) FROM trecon_task WHERE UNIX_TIMESTAMP() > (utimestamp + interval_sweep) AND id_recon_server = ".$server["id_server"]);
|
||||
break;
|
||||
case "postgresql":
|
||||
$server["lag"] = db_get_sql ("SELECT ceil(date_part('epoch', CURRENT_TIMESTAMP)) - utimestamp from trecon_task WHERE ceil(date_part('epoch', CURRENT_TIMESTAMP)) > (utimestamp + interval_sweep) AND id_recon_server = ".$server["id_server"]);
|
||||
|
||||
$server["module_lag"] = db_get_sql ("SELECT COUNT(id_rt) FROM trecon_task WHERE ceil(date_part('epoch', CURRENT_TIMESTAMP)) > (utimestamp + interval_sweep) AND id_recon_server = ".$server["id_server"]);
|
||||
break;
|
||||
case "oracle":
|
||||
$server["lag"] = db_get_sql ("SELECT ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (86400)) - utimestamp from trecon_task WHERE ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (86400)) > (utimestamp + interval_sweep) AND id_recon_server = ".$server["id_server"]);
|
||||
|
||||
$server["module_lag"] = db_get_sql ("SELECT COUNT(id_rt) FROM trecon_task WHERE ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (86400)) > (utimestamp + interval_sweep) AND id_recon_server = ".$server["id_server"]);
|
||||
break;
|
||||
}
|
||||
} // recon
|
||||
}
|
||||
} // Take data for realtime mode
|
||||
|
||||
if (isset($server["module_lag"]))
|
||||
|
|
Loading…
Reference in New Issue