'; $onheader .= print_image ("images/normalscreen.png", true, array ('title' => __('Normal screen'), 'alt' => __('Normal screen'))); $onheader .= ''; } else { $onheader = ''; $onheader .= print_image ("images/fullscreen.png", true, array ('title' => __('Full screen'), 'alt' => __('Normal screen'))); $onheader .= ''; } print_page_header (__('Network map'), "images/bricks.png", false, "", false, $onheader); // Layout selection $layout_array = array ( 'circular' => 'circular', 'radial' => 'radial', 'spring1' => 'spring 1', 'spring2' => 'spring 2', 'flat' => 'flat'); echo '
'; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; if ($pure == "1") { // Zoom $zoom_array = array ( '1' => 'x1', '1.2' => 'x2', '1.6' => 'x3', '2' => 'x4', '2.5' => 'x5', '5' => 'x10', ); echo ''; } if ($nooverlap == 1){ echo ""; } echo ""; //echo ' Display groups '; echo ''; echo '
' . __('Group') . '
'; print_select_from_sql ('SELECT id_grupo, nombre FROM tgrupo WHERE id_grupo > 0 ORDER BY nombre', 'group', $group, '', 'All', 0, false); echo '
' . __('Layout') . '
'; print_select ($layout_array, 'layout', $layout, '', '', ''); echo '
' . __('No Overlap') . '
'; print_checkbox ('nooverlap', '1', $nooverlap); echo '
' . __('Simple') . '
'; print_checkbox ('simple', '1', $simple); echo '
' . __('Regenerate') . '
'; print_checkbox ('regen', '1', $regen); echo '
' . __('Zoom') . '
'; print_select ($zoom_array, 'zoom', $zoom, '', '', ''); echo '
"; echo __('Distance between nodes') . '
'; print_input_text ('ranksep', $ranksep, $alt = 'Separation between elements in the map (in Non-overlap mode)', 3, 4, 0); echo "
"; echo __('Font') . '
'; print_input_text ('font_size', $font_size, $alt = 'Font size (in pt)', 2, 4, 0); echo "
'; print_submit_button (__('Update'), "updbutton", false, 'class="sub upd"'); echo '
'; // Set filter $filter = get_filter ($layout); // Generate dot file $graph = generate_dot (__('Pandora FMS'), $group, $simple, $font_size, $layout, $nooverlap, $zoom, $ranksep, $center, $regen, $pure); if ($graph === false) { print_error_message (__('Map could not be generated')); echo '
' . __('No agents found') . '
'; return; } // Generate image and map // 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_img = "attachment/networkmap_".$layout."_".$font_size; $filename_dot = $config["attachment_store"]."/networkmap_".$layout; if ($simple) { $filename_map .= "_simple"; $filename_img .= "_simple"; $filename_dot .= "_simple"; } if ($nooverlap) { $filename_map .= "_nooverlap"; $filename_img .= "_nooverlap"; $filename_dot .= "_nooverlap"; } $filename_map .= ".map"; $filename_img .= ".png"; $filename_dot .= ".dot"; if ($regen != 1 && file_exists ($filename_img) && filemtime ($filename_img) > get_system_time () - 300) { $result = true; } else { $fh = @fopen ($filename_dot, 'w'); if ($fh === false) { $result = false; } else { fwrite ($fh, $graph); $cmd = "$filter -Tcmapx -o".$filename_map." -Tpng -o".$filename_img." ".$filename_dot; $result = system ($cmd); fclose ($fh); unlink ($filename_dot); } } if ($result !== false) { if (! file_exists ($filename_map)) { print_error_message (__('Map could not be generated')); echo $result; echo "
Apparently something went wrong reading the output.
"; echo "
Is ".$config["attachment_store"]." readable by the webserver process?"; return; } print_image ($filename_img, false, array ("alt" => __('Network map'), "usemap" => "#networkmap")); require ($filename_map); } else { print_error_message (__('Map could not be generated')); echo $result; echo "
Apparently something went wrong executing the command or writing the output."; echo "

Is ".$filter." (usually part of GraphViz) and echo installed and able to be executed by the webserver process?"; echo "

Is your webserver restricted from executing command line tools through the system() call (PHP Safe Mode or SELinux)"; echo "

Is ".$config["attachment_store"]." writeable by the webserver process? To change this do the following (POSIX-based systems): chown <apache user> ".$config["attachment_store"]; return; } ?>