pandorafms/pandora_console/operation/agentes/networkmap.groups.php

99 lines
3.7 KiB
PHP
Raw Normal View History

<?php
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2010 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation for version 2.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Load global vars
global $config;
check_login ();
if (! give_acl ($config['id_user'], 0, "AR")) {
2010-10-27 Miguel de Dios <miguel.dedios@artica.es> * godmode/admin_access_logs.php: added hooks to enterprise code, and added new filter with more options. * include/functions_db.php: erase the deprecated function "audit_db", and added in function "pandora_audit" two new parameters $user_id, $ip for pass this values when it are differents to the default values. Finally replaced the depecrated "audit_db" for "pandora_audit". * include/functions_events.php, include/functions_filemanager.php, include/ajax/reporting.ajax.php, include/ajax/visual_console_builder.ajax.php, include/ajax/alert_list.ajax.php, include/help/es/modu_group_list.php, include/functions_incidents.php, index.php, extensions/agents_modules.php, extensions/insert_data.php, extensions/system_info.php, extensions/dbmanager.php, extensions/update_manager/settings.php, extensions/pandora_logs.php, extensions/plugin_registration.php, operation/incidents/incident.php, operation/incidents/incident_detail.php, operation/incidents/incident_statistics.php, operation/extensions.php, operation/visual_console/render_view.php, operation/agentes/status_monitor.php, operation/agentes/export_csv.php, operation/agentes/datos_agente.php, operation/agentes/alerts_status.php, operation/agentes/estado_generalagente.php, operation/agentes/custom_fields.php, operation/agentes/estado_agente.php, operation/agentes/networkmap.topology.php, operation/agentes/networkmap.groups.php, operation/agentes/sla_view.php, operation/agentes/gis_view.php, operation/agentes/estado_monitores.php, operation/agentes/ver_agente.php, operation/agentes/graphs.php, operation/agentes/agent_fields.php, operation/agentes/tactical.php, operation/agentes/group_view.php, operation/agentes/networkmap.php, operation/servers/view_server.php,operation/servers/view_server_detail.php, operation/snmpconsole/snmp_view.php, operation/users/user_edit.php, operation/gis_maps/render_view.php, operation/events/event_statistics.php, operation/events/sound_events.php, operation/events/events_validate.php, operation/events/events_list.php, operation/events/events_marquee.php, operation/events/events.php, operation/reporting/reporting_xml.php, operation/reporting/reporting_viewer.php, operation/reporting/graph_viewer.php, mobile/operation/agents/view_agents.php, mobile/index.php, godmode/groups/modu_group_list.php, godmode/groups/configure_group.php, godmode/groups/configure_modu_group.php, godmode/groups/group_list.php, godmode/extensions.php, godmode/db/db_main.php, godmode/db/db_audit.php, godmode/db/db_sanity.php, godmode/db/db_refine.php, godmode/db/db_info.php, godmode/db/db_event.php, godmode/db/db_purge.php, godmode/agentes/fields_manager.php, godmode/agentes/module_manager.php, godmode/agentes/modificar_agente.php, godmode/agentes/configurar_agente.php, godmode/agentes/configure_field.php, godmode/agentes/planned_downtime.php, godmode/agentes/manage_config_remote.php, godmode/agentes/agent_manager.php, godmode/servers/manage_export.php, godmode/servers/recon_script.php, godmode/servers/manage_export_form.php, godmode/servers/plugin.php, godmode/servers/manage_recontask.php, godmode/servers/modificar_server.php, godmode/servers/manage_recontask_form.php, godmode/alerts/alert_list.list.php, godmode/alerts/configure_alert_compound.php, godmode/alerts/alert_compounds.php, godmode/alerts/alert_list.php, godmode/alerts/configure_alert_template.php, godmode/alerts/alert_templates.php, godmode/alerts/configure_alert_action.php, godmode/alerts/configure_alert_command.php, godmode/alerts/alert_actions.php, godmode/alerts/alert_list.builder.php, godmode/alerts/alert_commands.php, godmode/snmpconsole/snmp_alert.php, godmode/snmpconsole/snmp_filters.php, godmode/setup/file_manager.php, godmode/setup/os.list.php, godmode/setup/news.php, godmode/setup/gis_step_2.php, godmode/setup/links.php, godmode/setup/setup.php, godmode/setup/os.php, godmode/setup/performance.php, godmode/setup/setup_auth.php, godmode/setup/gis.php, godmode/setup/os.builder.php, godmode/setup/setup_visuals.php, godmode/users/user_list.php, godmode/users/configure_user.php, godmode/users/configure_profile.php, godmode/gis_maps/configure_gis_map.php, godmode/gis_maps/index.php, godmode/massive/massive_add_alerts.php, godmode/massive/massive_copy_modules.php, godmode/massive/massive_delete_agents.php, godmode/massive/massive_enable_disable_alerts.php, godmode/massive/massive_operations.php, godmode/massive/massive_delete_profiles.php, godmode/massive/massive_edit_agents.php, godmode/massive/massive_delete_action_alerts.php, godmode/massive/massive_delete_modules.php, godmode/massive/massive_add_profiles.php, godmode/massive/massive_delete_alerts.php, godmode/massive/massive_edit_modules.php, godmode/massive/massive_standby_alerts.php, godmode/massive/massive_add_action_alerts.php, godmode/modules/manage_network_components_form.php, godmode/modules/manage_nc_groups_form.php, godmode/modules/manage_network_templates.php, godmode/modules/module_list.php, godmode/modules/manage_network_components_form_common.php, godmode/modules/manage_network_components_form_network.php, godmode/modules/manage_network_templates_form.php, godmode/modules/manage_network_components_form_wmi.php, godmode/modules/manage_network_components.php, godmode/modules/manage_nc_groups.php, godmode/reporting/reporting_builder.list_items.php, godmode/reporting/graph_builder.main.php, godmode/reporting/visual_console_builder.wizard.php, godmode/reporting/visual_console_builder.php, godmode/reporting/reporting_builder.preview.php, godmode/reporting/reporting_builder.main.php, godmode/reporting/visual_console_builder.data.php, godmode/reporting/map_builder_wizard.php, godmode/reporting/visual_console_builder.elements.php, godmode/reporting/graph_builder.php, godmode/reporting/visual_console_builder.preview.php, godmode/reporting/graph_builder.graph_editor.php, godmode/reporting/reporting_builder.php, godmode/reporting/visual_console_builder.editor.php, godmode/reporting/reporting_builder.item_editor.php, godmode/reporting/graphs.php, godmode/reporting/graph_builder.preview.php: Replaced the depecrated "audit_db" for "pandora_audit". git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3467 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2010-10-27 12:47:07 +02:00
pandora_audit("ACL Violation",
"Trying to access node graph builder");
include ("general/noaccess.php");
exit;
}
require_once ('include/functions_networkmap.php');
// Set filter
$filter = get_filter ($layout);
// Generate dot file
$graph = generate_dot_groups (__('Pandora FMS'), $group, $simple, $font_size, $layout, $nooverlap, $zoom, $ranksep, $center, $regen, $pure, $modwithalerts, $module_group, $hidepolicymodules, $depth, $id_networkmap);
if ($graph === false) {
print_error_message (__('Map could not be generated'));
echo '<div class="nf">' . __('No agents found') . '</div>';
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 = safe_url_extraclean ($config["attachment_store"])."/networkmap_".$filter;
$filename_img = "attachment/networkmap_".$filter."_".$font_size;
$filename_dot = safe_url_extraclean ($config["attachment_store"])."/networkmap_".$filter;
if ($simple) {
$filename_map .= "_simple";
$filename_img .= "_simple";
$filename_dot .= "_simple";
}
if ($nooverlap) {
$filename_map .= "_nooverlap";
$filename_img .= "_nooverlap";
$filename_dot .= "_nooverlap";
}
$filename_map .= "_".$id_networkmap.".map";
$filename_img .= "_".$id_networkmap.".png";
$filename_dot .= "_".$id_networkmap.".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 "<div class='warn'>Apparently something went wrong reading the output.</div>";
echo "<br />Is ".$config["attachment_store"]." readable by the webserver process?";
echo "<br /><br /> Is ".$filter." (usually part of GraphViz) and echo installed and able to be executed 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 "<div class='warn'>Apparently something went wrong executing the command or writing the output.</div>";
echo "<br />Is ".$filter." (usually part of GraphViz) and echo installed and able to be executed by the webserver process?";
echo "<br /><br /> Is your webserver restricted from executing command line tools through the <code>system()</code> call (PHP Safe Mode or SELinux)";
echo "<br /><br /> Is ".$config["attachment_store"]." writeable by the webserver process? To change this do the following (POSIX-based systems): chown &lt;apache user&gt; ".$config["attachment_store"];
return;
}
?>