2009-01-14 Ramon Novoa <rnovoa@artica.es>

* operation/agentes/networkmap.php: .dot files are written to disk to
          avoid problems with huge graphs.

        * godmode/agentes/agent_template.php: Fixed, column
          tagente_estado.cambio does not exist anymore.




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1340 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
ramonn 2009-01-14 14:30:13 +00:00
parent b934a2612a
commit 068d7d4f54
3 changed files with 26 additions and 5 deletions

View File

@ -1,3 +1,11 @@
2009-01-14 Ramon Novoa <rnovoa@artica.es>
* operation/agentes/networkmap.php: .dot files are written to disk to
avoid problems with huge graphs.
* godmode/agentes/agent_template.php: Fixed, column
tagente_estado.cambio does not exist anymore.
2009-01-12 Esteban Sanchez <estebans@artica.es> 2009-01-12 Esteban Sanchez <estebans@artica.es>
* godmode/alerts/configure_alert_template.php: Fixed a bug when going * godmode/alerts/configure_alert_template.php: Fixed a bug when going

View File

@ -68,12 +68,12 @@ if (isset ($_POST["template_id"])) {
// Create with different estado if proc type or data type // Create with different estado if proc type or data type
if ($id_agente_modulo !== false && ($row2["type"] == 2) || ($row2["type"] == 6) || ($row2["type"] == 9) || ($row2["type"] == 12) || ($row2["type"] == 18)) { if ($id_agente_modulo !== false && ($row2["type"] == 2) || ($row2["type"] == 6) || ($row2["type"] == 9) || ($row2["type"] == 12) || ($row2["type"] == 18)) {
$sql = sprintf ("INSERT INTO tagente_estado (id_agente_modulo,datos,timestamp,cambio,estado,id_agente, utimestamp) $sql = sprintf ("INSERT INTO tagente_estado (id_agente_modulo,datos,timestamp,estado,id_agente, utimestamp)
VALUES (%d, 0,'0000-00-00 00:00:00',0,0, %d, 0)", $id_agente_modulo, $id_agente); VALUES (%d, 0,'0000-00-00 00:00:00',0, %d, 0)", $id_agente_modulo, $id_agente);
process_sql ($sql); process_sql ($sql);
} elseif ($id_agente_modulo !== false) { } elseif ($id_agente_modulo !== false) {
$sql = sprintf ("INSERT INTO tagente_estado (id_agente_modulo,datos,timestamp,cambio,estado,id_agente, utimestamp) $sql = sprintf ("INSERT INTO tagente_estado (id_agente_modulo,datos,timestamp,estado,id_agente, utimestamp)
VALUES (%d, 0,'0000-00-00 00:00:00',0,100, %d, 0)", $id_agente_modulo, $id_agente); VALUES (%d, 0,'0000-00-00 00:00:00',100, %d, 0)", $id_agente_modulo, $id_agente);
process_sql ($sql); process_sql ($sql);
} else { } else {
echo '<h3 class="error">'.__('Error adding module').'</h3>'; echo '<h3 class="error">'.__('Error adding module').'</h3>';

View File

@ -327,22 +327,35 @@ $graph = generate_dot ($simple, $font_size);
// If image was generated just a few minutes ago, then don't regenerate (it takes long) unless regen checkbox is set // If image was generated just a few minutes ago, then don't regenerate (it takes long) unless regen checkbox is set
$filename_map = $config["attachment_store"]."/networkmap_".$layout; $filename_map = $config["attachment_store"]."/networkmap_".$layout;
$filename_img = "attachment/networkmap_".$layout."_".$font_size; $filename_img = "attachment/networkmap_".$layout."_".$font_size;
$filename_dot = $config["attachment_store"]."/networkmap_".$layout;
if($simple) { if($simple) {
$filename_map .= "_simple"; $filename_map .= "_simple";
$filename_img .= "_simple"; $filename_img .= "_simple";
$filename_dot .= "_simple";
} }
if($nooverlap) { if($nooverlap) {
$filename_map .= "_nooverlap"; $filename_map .= "_nooverlap";
$filename_img .= "_nooverlap"; $filename_img .= "_nooverlap";
$filename_dot .= "_nooverlap";
} }
$filename_map .= ".map"; $filename_map .= ".map";
$filename_img .= ".png"; $filename_img .= ".png";
$filename_dot .= ".dot";
if ($regen != 1 && file_exists ($filename_img) && filemtime ($filename_img) > get_system_time () - 300) { if ($regen != 1 && file_exists ($filename_img) && filemtime ($filename_img) > get_system_time () - 300) {
$result = true; $result = true;
} else { } else {
$cmd = "echo " . escapeshellarg($graph) . " | $filter -Tcmapx -o".$filename_map." -Tpng -o".$filename_img; $fh = fopen($filename_dot, 'w');
if ($fh === false) {
$result = false;
break;
}
fwrite ($fh, $graph);
$cmd = "$filter -Tcmapx -o".$filename_map." -Tpng -o".$filename_img." ".$filename_dot;
$result = system ($cmd); $result = system ($cmd);
fclose ($fh);
unlink ($filename_dot);
} }
if ($result !== false) { if ($result !== false) {