diff --git a/pandora_console/include/ajax/graph.ajax.php b/pandora_console/include/ajax/graph.ajax.php index 60ed82cc5c..992c12262e 100644 --- a/pandora_console/include/ajax/graph.ajax.php +++ b/pandora_console/include/ajax/graph.ajax.php @@ -12,9 +12,12 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. -require_once ("include/functions_custom_graphs.php"); +require_once('include/functions_custom_graphs.php'); +require_once('include/functions_graph.php'); -$save_custom_graph = (bool)get_parameter('save_custom_graph', 0); +$save_custom_graph = (bool) get_parameter('save_custom_graph'); +$print_custom_graph = (bool) get_parameter('print_custom_graph'); +$print_sparse_graph = (bool) get_parameter('print_sparse_graph'); if ($save_custom_graph) { $return = array(); @@ -38,4 +41,74 @@ if ($save_custom_graph) { return; } +if ($print_custom_graph) { + ob_clean(); + + $id_graph = (int) get_parameter('id_graph'); + $height = (int) get_parameter('height', CHART_DEFAULT_HEIGHT); + $width = (int) get_parameter('width', CHART_DEFAULT_WIDTH); + $period = (int) get_parameter('period', SECONDS_5MINUTES); + $stacked = (int) get_parameter('stacked', CUSTOM_GRAPH_LINE); + $date = (int) get_parameter('date', time()); + $only_image = (bool) get_parameter('only_image'); + $background_color = (string) get_parameter('background_color', 'white'); + $modules_param = get_parameter('modules_param', array()); + $homeurl = (string) get_parameter('homeurl'); + $name_list = get_parameter('name_list', array()); + $unit_list = get_parameter('unit_list', array()); + $show_last = (bool) get_parameter('show_last', true); + $show_max = (bool) get_parameter('show_max', true); + $show_min = (bool) get_parameter('show_min', true); + $show_avg = (bool) get_parameter('show_avg', true); + $ttl = (int) get_parameter('ttl', 1); + $dashboard = (bool) get_parameter('dashboard'); + $vconsole = (bool) get_parameter('vconsole'); + + echo custom_graphs_print($id_graph, $height, $width, $period, $stacked, + true, $date, $only_image, $background_color, $modules_param, + $homeurl, $name_list, $unit_list, $show_last, $show_max, + $show_min, $show_avg, $ttl, $dashboard, $vconsole); + return; +} + +if ($print_sparse_graph) { + ob_clean(); + + $agent_module_id = (int) get_parameter('agent_module_id'); + $period = (int) get_parameter('period', SECONDS_5MINUTES); + $show_events = (bool) get_parameter('show_events'); + $width = (int) get_parameter('width', CHART_DEFAULT_WIDTH); + $height = (int) get_parameter('height', CHART_DEFAULT_HEIGHT); + $title = (string) get_parameter('title'); + $unit_name = (string) get_parameter('unit_name'); + $show_alerts = (bool) get_parameter('show_alerts'); + $avg_only = (int) get_parameter('avg_only'); + $pure = (bool) get_parameter('pure'); + $date = (int) get_parameter('date', time()); + $unit = (string) get_parameter('unit'); + $baseline = (int) get_parameter('baseline'); + $return_data = (int) get_parameter('return_data'); + $show_title = (bool) get_parameter('show_title', true); + $only_image = (bool) get_parameter('only_image'); + $homeurl = (string) get_parameter('homeurl'); + $ttl = (int) get_parameter('ttl', 1); + $projection = (bool) get_parameter('projection'); + $adapt_key = (string) get_parameter('adapt_key'); + $compare = (bool) get_parameter('compare'); + $show_unknown = (bool) get_parameter('show_unknown'); + $menu = (bool) get_parameter('menu', true); + $background_color = (string) get_parameter('background_color', 'white'); + $percentil = get_parameter('percentil', null); + $dashboard = (bool) get_parameter('dashboard'); + $vconsole = (bool) get_parameter('vconsole'); + + echo grafico_modulo_sparse($agent_module_id, $period, $show_events, + $width, $height , $title, $unit_name, $show_alerts, $avg_only, + $pure, $date, $unit, $baseline, $return_data, $show_title, + $only_image, $homeurl, $ttl, $projection, $adapt_key, $compare, + $show_unknown, $menu, $backgroundColor, $percentil, + $dashboard, $vconsole); + return; +} + ?>