'; echo ''; ui_print_error_message( __('There was a problem connecting with the node') ); echo ''; echo ''; exit; } } $user_language = get_user_language($config['id_user']); if (file_exists('../../include/languages/'.$user_language.'.mo')) { $l10n = new gettext_reader( new CachedFileReader('../../include/languages/'.$user_language.'.mo') ); $l10n->load_tables(); } global $config; echo ''; if ($config['style'] === 'pandora_black' && !is_metaconsole()) { echo ''; } $id = get_parameter('id'); $id_agent = db_get_value( 'id_agente', 'tagente_modulo', 'id_agente_modulo', $id ); $alias = db_get_value('alias', 'tagente', 'id_agente', $id_agent); $label = db_get_value( 'nombre', 'tagente_modulo', 'id_agente_modulo', $id ); ui_require_css_file('register', 'include/styles/', true); // Connection lost alert. $conn_title = __('Connection with server has been lost'); $conn_text = __('Connection to the server has been lost. Please check your internet connection or contact with administrator.'); ui_require_javascript_file('connection_check'); set_js_value('absolute_homeurl', ui_get_full_url(false, false, false, false)); ui_print_message_dialog( $conn_title, $conn_text, 'connection', '/images/error_1.png' ); ?> 0) { $query = ui_get_url_refresh(false); echo ''; } ?> <?php echo __('%s Graph', get_product_name()).' ('.$alias.' - '.$label; ?>) '; echo ''; ui_print_error_message( __('There was a problem connecting with the node') ); echo ''; echo ''; exit; } } $draw_alerts = get_parameter('draw_alerts', 0); $period = get_parameter('period'); $id = get_parameter('id', 0); $start_date = get_parameter('start_date', date('Y/m/d')); $start_time = get_parameter('start_time', date('H:i:s')); $draw_events = get_parameter('draw_events', 0); $graph_type = get_parameter('type', 'sparse'); $zoom = get_parameter('zoom', $config['zoom_graph']); $baseline = get_parameter('baseline', 0); $show_events_graph = get_parameter('show_events_graph', 0); $show_percentil = get_parameter('show_percentil', 0); $time_compare_separated = get_parameter('time_compare_separated', 0); $time_compare_overlapped = get_parameter('time_compare_overlapped', 0); $unknown_graph = get_parameter_checkbox('unknown_graph', 1); $histogram = (bool) get_parameter('histogram', 0); // FORM TABLE. $table = html_get_predefined_table('transparent', 2); $table->width = '100%'; $table->id = 'stat_win_form_div'; $table->style[0] = 'text-align:left;'; $table->style[1] = 'text-align:left;'; $table->style[2] = 'text-align:left;font-weight: bold;'; $table->style[3] = 'text-align:left;'; $table->class = 'table_modal_alternate'; $table->data = []; $time_compare = false; if ($time_compare_separated) { $time_compare = 'separated'; } else if ($time_compare_overlapped) { $time_compare = 'overlapped'; } if ($histogram === false) { $fullscale_sent = get_parameter('fullscale_sent', 0); if (!$fullscale_sent) { if (isset($config['full_scale_option']) === false || $config['full_scale_option'] == 0 ) { $fullscale = 0; } else if ($config['full_scale_option'] == 1) { $fullscale = 1; } else if ($config['full_scale_option'] == 2) { if ($graph_type == 'boolean') { $fullscale = 1; } else { $fullscale = 0; } } } else { $fullscale = get_parameter('fullscale', 0); } $type_mode_graph = get_parameter_checkbox( 'type_mode_graph', ($fullscale === 1) ? 0 : $config['type_mode_graph'] ); if ($zoom > 1) { $height = ($height * ($zoom / 2.1)); $width = ($width * ($zoom / 1.4)); } // Build date. $date = strtotime($start_date.' '.$start_time); $now = time(); if ($date > $now) { $date = $now; } $urlImage = ui_get_full_url(false, false, false, false); $unit = db_get_value( 'unit', 'tagente_modulo', 'id_agente_modulo', $id ); $table->data[0][0] = __('Refresh time'); $table->data[0][1] = html_print_extended_select_for_time( 'refresh', $refresh, '', '', 0, 7, true ); $table->data[0][2] = __('Show events'); $disabled = false; $table->data[0][3] = html_print_checkbox_switch( 'draw_events', 1, (bool) $draw_events, true, $disabled ); $table->data[1][0] = __('Begin date'); $table->data[1][1] = html_print_input_text( 'start_date', $start_date, '', 10, 20, true ); $table->data[1][2] = __('Show alerts'); $table->data[1][3] = html_print_checkbox_switch( 'draw_alerts', 1, (bool) $draw_alerts, true ); $table->data[2][0] = __('Begin time'); $table->data[2][1] = html_print_input_text( 'start_time', $start_time, '', 10, 10, true ); $table->data[2][2] = __('Show unknown graph'); $table->data[2][3] = html_print_checkbox_switch( 'unknown_graph', 1, (bool) $unknown_graph, true ); $table->data[3][0] = __('Time range'); $table->data[3][1] = html_print_extended_select_for_time( 'period', $period, '', '', 0, 7, true ); $table->data[3][2] = ''; $table->data[3][3] = ''; if (!modules_is_boolean($id)) { $table->data[4][0] = __('Zoom'); $options = []; $options[$zoom] = 'x'.$zoom; $options[1] = 'x1'; $options[2] = 'x2'; $options[3] = 'x3'; $options[4] = 'x4'; $options[5] = 'x5'; $table->data[4][1] = html_print_select( $options, 'zoom', $zoom, '', '', 0, true, false, false ); $table->data[4][2] = __('Show percentil'); $table->data[4][3] = html_print_checkbox_switch( 'show_percentil', 1, (bool) $show_percentil, true ); } $table->data[5][0] = __('Time compare (Overlapped)'); $table->data[5][1] = html_print_checkbox_switch( 'time_compare_overlapped', 1, (bool) $time_compare_overlapped, true ); $table->data[5][2] = __('Time compare (Separated)'); $table->data[5][3] = html_print_checkbox_switch( 'time_compare_separated', 1, (bool) $time_compare_separated, true ); $table->data[6][0] = __('Show AVG/MAX/MIN data series in graph'); $table->data[6][1] = html_print_checkbox_switch( 'type_mode_graph', 1, (bool) $type_mode_graph, true, false ); $table->data[6][2] = __('Show full scale graph (TIP)'); $table->data[6][2] .= ui_print_help_tip( __('TIP mode charts do not support average - maximum - minimum series, you can only enable TIP or average, maximum or minimum series'), true ); $table->data[6][3] = html_print_checkbox_switch( 'fullscale', 1, (bool) $fullscale, true, false ); } else { $table->data[0][0] = __('Begin date'); $table->data[0][1] = html_print_input_text( 'start_date', $start_date, '', 10, 20, true ); $table->data[0][2] = __('Begin time'); $table->data[0][3] = html_print_input_text( 'start_time', $start_time, '', 10, 10, true ); $table->data[1][0] = __('Time range'); $table->data[1][1] = html_print_extended_select_for_time( 'period', $period, '', '', 0, 7, true ); $table->data[1][2] = __('Time compare (Separated)'); $table->data[1][3] = html_print_checkbox_switch( 'time_compare_separated', 1, (bool) $time_compare_separated, true ); } $form_table = html_print_table($table, true); $form_table .= '
'; $form_table .= html_print_submit_button( __('Reload'), 'submit', false, 'class="sub upd"', true ); $form_table .= '
'; // Menu. $menu_form = "
"; $menu_form .= html_print_input_hidden('id', $id, true); $menu_form .= html_print_input_hidden('label', $label, true); if (empty($server_id) === false) { $menu_form .= html_print_input_hidden('server', $server_id, true); } $menu_form .= html_print_input_hidden('histogram', $histogram, true); if (isset($_GET['type']) === true) { $type = get_parameter_get('type'); $menu_form .= html_print_input_hidden('type', $type, true); } $menu_form .= '
'; $menu_form .= '
'; $menu_form .= html_print_image( 'images/arrow_down_green.png', true, [ 'class' => 'module_graph_menu_arrow', 'float' => 'left', ], false, false, true ); $menu_form .= ''; $menu_form .= ''.__('Graph configuration menu').''; $menu_form .= ui_print_help_tip( __('In Pandora FMS, data is stored compressed. The data visualization in database, charts or CSV exported data won\'t match, because is interpreted at runtime. Please check \'Pandora FMS Engineering\' chapter from documentation.'), true ); $menu_form .= ''; $menu_form .= '
'; $class = 'module_graph_menu_content'; if ($histogram === false) { $class .= ' module_graph_menu_content_closed invisible'; } $menu_form .= '
'; $menu_form .= $form_table; $menu_form .= '
'; $menu_form .= '
'; $menu_form .= '
'; echo $menu_form; // Hidden div to forced title. html_print_div( [ 'id' => 'forced_title_layer', 'class' => 'forced_title_layer', 'hidden' => true, ] ); $params = [ 'agent_module_id' => $id, 'period' => $period, 'show_events' => $draw_events, 'title' => $label, 'unit_name' => $unit, 'show_alerts' => $draw_alerts, 'date' => $date, 'unit' => $unit, 'baseline' => $baseline, 'homeurl' => $urlImage, 'adapt_key' => 'adapter_'.$graph_type, 'compare' => $time_compare, 'show_unknown' => $unknown_graph, 'percentil' => (($show_percentil) ? $config['percentil'] : null), 'type_graph' => $config['type_module_charts'], 'fullscale' => $fullscale, 'zoom' => $zoom, 'height' => 300, 'type_mode_graph' => $type_mode_graph, 'histogram' => $histogram, 'begin_date' => strtotime($start_date.' '.$start_time), ]; // Graph. $output = '
'; $output .= '
'; $output .= html_print_image('images/spinner_charts.gif', true); $output .= '
'; $output .= '
'; echo $output; if (is_metaconsole() === true && empty($server_id) === false) { metaconsole_restore_db(); } ?>