From 4ab2ec22f21896335702c08cac26a0769a6383e6 Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Mon, 13 Sep 2010 10:26:33 +0000 Subject: [PATCH] 2010-09-13 Miguel de Dios * operation/agentes/ver_agente.php: added the tab to show all graphs in a one page about modules in the agent. * operation/agentes/graphs.php: the page to show all graphs of agent modules. * operation/agentes/stat_win.php: cleaned html and closed some open html tags. Pending task: #3060349 git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3242 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 13 ++ pandora_console/operation/agentes/graphs.php | 151 ++++++++++++++++++ .../operation/agentes/stat_win.php | 5 +- .../operation/agentes/ver_agente.php | 14 +- 4 files changed, 181 insertions(+), 2 deletions(-) create mode 100644 pandora_console/operation/agentes/graphs.php diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 41076a2c84..1d4c7dfa59 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,16 @@ +2010-09-13 Miguel de Dios + + * operation/agentes/ver_agente.php: added the tab to show all graphs in a + one page about modules in the agent. + + * operation/agentes/graphs.php: the page to show all graphs of agent + modules. + + * operation/agentes/stat_win.php: cleaned html and closed some open html + tags. + + Pending task: #3060349 + 2010-09-13 Sergio Martin * include/languages/cs.po diff --git a/pandora_console/operation/agentes/graphs.php b/pandora_console/operation/agentes/graphs.php new file mode 100644 index 0000000000..e2b27e1165 --- /dev/null +++ b/pandora_console/operation/agentes/graphs.php @@ -0,0 +1,151 @@ + $module) { + $modulesChecked[$id] = 1; + } +} + + +$table = null; +$table->width = '90%'; + +$table->size = array(); +$table->size[0] = '20%'; +$table->size[1] = '80%'; + +$table->style[0] = 'font-weight: bolder; text-align: right;'; +$table->style[1] = ''; + +$table->data[0][0] = __('Modules'); +$listModules = array(); +foreach ($modules as $id => $module) { + $checked = false; + if (isset($modulesChecked[$id])) + $checked = (bool) $modulesChecked[$id]; + $listModules[] = '' . print_checkbox('modules[' . $id . ']', 1, $checked, true) . ' ' . $module . ''; +} +$table->data[0][1] = implode(' ', $listModules); + +$table->data[1][0] = __('Begin date'); +$table->data[1][1] = print_input_text ("start_date", substr ($start_date, 0, 10),'', 10, 40, true); +$table->data[1][1] .= print_image ("images/calendar_view_day.png", true, array ("onclick" => "scwShow(scwID('text-start_date'),this);")); + +$table->data[2][0] = __('Zoom factor'); +$options = array (); +$options[$zoom] = 'x'.$zoom; +$options[1] = 'x1'; +$options[2] = 'x2'; +$options[3] = 'x3'; +$options[4] = 'x4'; +$table->data[2][1] = print_select ($options, "zoom", $zoom, '', '', 0, true); + +$table->data[3][0] = __('Time range'); +$options = array (); +$options[3600] = human_time_description_raw (3600); +$options[7200] = human_time_description_raw (7200); +$options[21600] = human_time_description_raw (21600); +$options[43200] = human_time_description_raw (43200); +$options[86400] = human_time_description_raw (86400); +$options[172800] = human_time_description_raw (172800); +$options[432000] = human_time_description_raw (432000); +$options[604800] = human_time_description_raw (604800); +$options[1296000] = human_time_description_raw (1296000); +$options[2592000] = human_time_description_raw (2592000); +$options[5184000] = human_time_description_raw (5184000); +$options[15552000] = human_time_description_raw (15552000); +$table->data[3][1] = print_extended_select_for_time($options, 'period', $period, '', '', 0, 7, true) . ' ' . __('secs'); + +$table->data[4][0] = __('Show events'); +$table->data[4][1] = print_checkbox ("draw_events", 1, (bool) $draw_events, true); +$table->data[5][0] = __('Show alerts'); +$table->data[5][1] = print_checkbox ("draw_alerts", 1, (bool) $draw_alerts, true); + +$htmlForm = '
'; +$htmlForm .= print_table($table, true); +$htmlForm .= print_input_hidden('filter', 1, true); +$htmlForm .= '
'; +$htmlForm .= print_submit_button (__('Filter'), 'filter_button', false, 'class="sub upd"', true); +$htmlForm .= '
'; +$htmlForm .= '
'; + +toggle($htmlForm,__('Filter graphs'), __('Toggle filter(s)')); + +$utime = get_system_time (); +$current = date("Y-m-d", $utime); + +if ($start_date != $current) + $date = strtotime($start_date); +else + $date = $utime; + +foreach ($modulesChecked as $idModuleShowGraph => $value) { + echo '
'; + echo "

" . $modules[$idModuleShowGraph] . '

'; + if ($config['flash_charts']) { + echo grafico_modulo_sparse ($idModuleShowGraph, $period, $draw_events, $width, $height, + $modules[$idModuleShowGraph], $unit_name, $draw_alerts, $avg_only, $pure, $date); + } + else { + $image = 'include/fgraph.php?' . + 'tipo=sparse' . + '&draw_alerts=' . $draw_alerts . + '&draw_events=' . $draw_events . + '&id=' . $idModuleShowGraph . + '&zoom=' . $zoom . + '&label=' . $modules[$idModuleShowGraph] . + '&height=' . $height . + '&width=' . $width . + '&period=' . $period . + '&avg_only=' . $avg_only . + '&date=' . $date; + + print_image ($image, false, array ("border" => 0)); + } + echo '
'; +} + +echo "
"; +?> \ No newline at end of file diff --git a/pandora_console/operation/agentes/stat_win.php b/pandora_console/operation/agentes/stat_win.php index 5025bc8e9c..97a7e4fdba 100644 --- a/pandora_console/operation/agentes/stat_win.php +++ b/pandora_console/operation/agentes/stat_win.php @@ -94,7 +94,8 @@ function getTermEle(ele) { } //--> - + + '; ?> + + diff --git a/pandora_console/operation/agentes/ver_agente.php b/pandora_console/operation/agentes/ver_agente.php index 01bb766e43..88f4c86bd4 100644 --- a/pandora_console/operation/agentes/ver_agente.php +++ b/pandora_console/operation/agentes/ver_agente.php @@ -393,10 +393,19 @@ if ($tab == 'custom_fields') { $custom_fields['active'] = false; } +$graphs['text'] = '' + . print_image("images/chart_curve.png", true, array("title" => __('Graphs'))) + . ''; +if ($tab == 'graphs') { + $graphs['active'] = true; +} else { + $graphs['active'] = false; +} + $onheader = array('manage' => $managetab, 'separator' => "", 'main' => $maintab, 'data' => $datatab, 'alert' => $alerttab, 'sla' => $slatab, 'inventory' => $inventorytab, 'collection' => $collectiontab, - 'group' => $grouptab, 'gis' => $gistab, 'custom' => $custom_fields); + 'group' => $grouptab, 'gis' => $gistab, 'custom' => $custom_fields, 'graphs' => $graphs); print_page_header (__('Agent').' - '.mb_substr(get_agent_name($id_agente),0,25), $icon, false, "", false, $onheader); @@ -435,6 +444,9 @@ switch ($tab) { case "collection": enterprise_include ('operation/agentes/collection_view.php'); break; + case "graphs"; + require("operation/agentes/graphs.php"); + break; } ?>