diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index 1fc12dbbeb..2d346ee065 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 5.1-140923 +Version: 5.1-140924 Architecture: all Priority: optional Section: admin diff --git a/pandora_agents/unix/DEBIAN/make_deb_package.sh b/pandora_agents/unix/DEBIAN/make_deb_package.sh index 64a50ba914..8868aa37a4 100644 --- a/pandora_agents/unix/DEBIAN/make_deb_package.sh +++ b/pandora_agents/unix/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="5.1-140923" +pandora_version="5.1-140924" echo "Test if you has the tools for to make the packages." whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index 531c28dd69..689b535368 100644 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -41,7 +41,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '5.1'; -use constant AGENT_BUILD => '140923'; +use constant AGENT_BUILD => '140924'; # Commands to retrieve total memory information in kB use constant TOTALMEMORY_CMDS => { diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index 3e3d7f70f3..cb41b7908f 100644 --- a/pandora_agents/unix/pandora_agent.redhat.spec +++ b/pandora_agents/unix/pandora_agent.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 5.1 -%define release 140923 +%define release 140924 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec index d0f95de33e..bda25cf396 100644 --- a/pandora_agents/unix/pandora_agent.spec +++ b/pandora_agents/unix/pandora_agent.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 5.1 -%define release 140923 +%define release 140924 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 0eaf9ad0d0..5330716913 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{140923} +{140924} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 68885f4e44..053807a3e3 100644 --- a/pandora_agents/win32/pandora.cc +++ b/pandora_agents/win32/pandora.cc @@ -30,7 +30,7 @@ using namespace Pandora; using namespace Pandora_Strutils; #define PATH_SIZE _MAX_PATH+1 -#define PANDORA_VERSION ("5.1(Build 140923)") +#define PANDORA_VERSION ("5.1(Build 140924)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 1bac33f9e0..dd1ead41a2 100644 --- a/pandora_agents/win32/versioninfo.rc +++ b/pandora_agents/win32/versioninfo.rc @@ -11,7 +11,7 @@ BEGIN VALUE "LegalCopyright", "Artica ST" VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "ProductName", "Pandora FMS Windows Agent" - VALUE "ProductVersion", "(5.1(Build 140923))" + VALUE "ProductVersion", "(5.1(Build 140924))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index f0f1531a97..ef372dc642 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 5.1-140923 +Version: 5.1-140924 Architecture: all Priority: optional Section: admin diff --git a/pandora_console/DEBIAN/make_deb_package.sh b/pandora_console/DEBIAN/make_deb_package.sh index d48b1cdaf6..0684bdc8eb 100644 --- a/pandora_console/DEBIAN/make_deb_package.sh +++ b/pandora_console/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="5.1-140923" +pandora_version="5.1-140924" package_pear=0 package_pandora=1 diff --git a/pandora_console/godmode/setup/setup_visuals.php b/pandora_console/godmode/setup/setup_visuals.php index 8419d7cc33..831417c13b 100644 --- a/pandora_console/godmode/setup/setup_visuals.php +++ b/pandora_console/godmode/setup/setup_visuals.php @@ -400,12 +400,33 @@ $table->data[$row][1] = html_print_input_text ('networkmap_max_width', $config[" $row++; $table->data[$row][0] = __('Fixed header'); -$table->data[$row][1] = html_print_checkbox('fixed_header', 1, $config['fixed_header'], true); +$table->data[$row][1] = __('Yes') . ' ' . + html_print_radio_button ('fixed_header', 1, '', $config["fixed_header"], true) . + ' '; +$table->data[$row][1] .= __('No') . ' ' . + html_print_radio_button ('fixed_header', 0, '', $config["fixed_header"], true); $row++; $table->data[$row][0] = __('Fixed menu'); -$table->data[$row][1] = html_print_checkbox('fixed_menu', 1, $config['fixed_menu'], true); +$table->data[$row][1] = __('Yes') . ' ' . + html_print_radio_button ('fixed_menu', 1, '', $config["fixed_menu"], true) . + ' '; +$table->data[$row][1] .= __('No') . ' ' . + html_print_radio_button ('fixed_menu', 0, '', $config["fixed_menu"], true); + +$row++; + +if (!isset($config["short_module_graph_data"])) + $config["short_module_graph_data"] = true; + +$table->data[$row][0] = __('Shortened module graph data'); +$table->data[$row][0] .= ui_print_help_tip(__('The data number of the module graphs will be rounded and shortened'), true); +$table->data[$row][1] = __('Yes') . ' ' . + html_print_radio_button ('short_module_graph_data', 1, '', $config["short_module_graph_data"], true) . + ' '; +$table->data[$row][1] .= __('No') . ' ' . + html_print_radio_button ('short_module_graph_data', 0, '', $config["short_module_graph_data"], true); $row++; diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index c45b61696e..ef090cad67 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -22,7 +22,7 @@ /** * Pandora build version and version */ -$build_version = 'PC140923'; +$build_version = 'PC140924'; $pandora_version = 'v5.1'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php index eceb41f5ea..8cc9d1864b 100644 --- a/pandora_console/include/functions_config.php +++ b/pandora_console/include/functions_config.php @@ -447,6 +447,8 @@ function config_update_config () { $error_update[] = __('Custom graphviz directory'); if (!config_update_value ('networkmap_max_width', get_parameter('networkmap_max_width'))) $error_update[] = __('Networkmap max width'); + if (!config_update_value ('short_module_graph_data', get_parameter('short_module_graph_data'))) + $error_update[] = __('Shortened module graph data'); $interval_values = get_parameter ('interval_values'); diff --git a/pandora_console/include/functions_custom_graphs.php b/pandora_console/include/functions_custom_graphs.php index 4b1c12acf0..f0e03d935a 100644 --- a/pandora_console/include/functions_custom_graphs.php +++ b/pandora_console/include/functions_custom_graphs.php @@ -145,14 +145,25 @@ function custom_graphs_get_user ($id_user = 0, $only_names = false, $returnAllGr * @param $height Height of the returning image. * @param $width Width of the returning image. * @param $period Period of time to get data in seconds. - * @param $stacked Wheter the graph is stacked or not. + * @param $stacked Whether the graph is stacked or not. * @param $return Whether to return an output string or echo now (optional, echo by default). * @param $date Date to start printing the graph + * @param bool Wether to show an image instead a interactive chart or not + * @param string Background color + * @param array List of names for the items. Should have the same size as the module list. + * @param bool Show the last value of the item on the list. + * @param bool Show the max value of the item on the list. + * @param bool Show the min value of the item on the list. + * @param bool Show the average value of the item on the list. + * + * @return Mixed */ function custom_graphs_print($id_graph, $height, $width, $period, $stacked = null, $return = false, $date = 0, $only_image = false, - $background_color = 'white', $modules_param = array(), $homeurl = '') { + $background_color = 'white', $modules_param = array(), $homeurl = '', + $name_list = array(), $unit_list = array(), $show_last = true, + $show_max = true, $show_min = true, $show_avg = true) { global $config; @@ -214,7 +225,13 @@ function custom_graphs_print($id_graph, $height, $width, $period, 1, false, false, - $background_color); + $background_color, + $name_list, + $unit_list, + $show_last, + $show_max, + $show_min, + $show_avg); if ($return) return $output; diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index 3813ae71f5..7d54e946cf 100755 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -854,6 +854,12 @@ function graph_get_formatted_date($timestamp, $format1, $format2) { * @param int Date to start of getting info. * @param mixed If is a projection graph this parameter will be module data with prediction data (the projection) * or false in other case. + * @param array List of names for the items. Should have the same size as the module list. + * @param array List of units for the items. Should have the same size as the module list. + * @param bool Show the last value of the item on the list. + * @param bool Show the max value of the item on the list. + * @param bool Show the min value of the item on the list. + * @param bool Show the average value of the item on the list. * * @return Mixed */ @@ -861,7 +867,9 @@ function graphic_combined_module ($module_list, $weight_list, $period, $width, $height, $title, $unit_name, $show_events = 0, $show_alerts = 0, $pure = 0, $stacked = 0, $date = 0, $only_image = false, $homeurl = '', $ttl = 1, $projection = false, - $prediction_period = false, $background_color = 'white') { + $prediction_period = false, $background_color = 'white', + $name_list = array(), $unit_list = array(), $show_last = true, $show_max = true, + $show_min = true, $show_avg = true) { global $config; global $graphic_type; @@ -928,6 +936,9 @@ function graphic_combined_module ($module_list, $weight_list, $period, else { $module_number = count ($module_list); } + + $names_number = count($name_list); + $units_number = count($unit_list); // interval - This is the number of "rows" we are divided the time to fill data. // more interval, more resolution, and slower. @@ -971,23 +982,28 @@ function graphic_combined_module ($module_list, $weight_list, $period, if ($projection != false && $i != 0) { $agent_module_id = $module_list[0]; - //Get and process agent name - $agent_name = io_safe_output( - modules_get_agentmodule_agent_name ($agent_module_id)); - $agent_name = ui_print_truncate_text($agent_name, 'agent_small', false, true, false, '...', false); + if (!empty($name_list) && $names_number == $module_number && isset($name_list[$i])) { + $module_name_list[$i] = $name_list[$i]; + } + else { + //Get and process agent name + $agent_name = io_safe_output( + modules_get_agentmodule_agent_name ($agent_module_id)); + $agent_name = ui_print_truncate_text($agent_name, 'agent_small', false, true, false, '...', false); + + + $agent_id = agents_get_agent_id ($agent_name); + + + //Get and process module name + $module_name = io_safe_output( + modules_get_agentmodule_name ($agent_module_id)); + $module_name = sprintf(__("projection for %s"), $module_name); + $module_name = ui_print_truncate_text($module_name, 'module_small', false, true, false, '...', false); + + $module_name_list[$i] = $agent_name ." / ". $module_name; + } - - $agent_id = agents_get_agent_id ($agent_name); - - - //Get and process module name - $module_name = io_safe_output( - modules_get_agentmodule_name ($agent_module_id)); - $module_name = sprintf(__("projection for %s"), $module_name); - $module_name = ui_print_truncate_text($module_name, 'module_small', false, true, false, '...', false); - - - $module_name_list[$i] = $agent_name ." / ". $module_name; $id_module_type = modules_get_agentmodule_type ($agent_module_id); $module_type = modules_get_moduletype_name ($id_module_type); $uncompressed_module = is_module_uncompressed ($module_type); @@ -995,20 +1011,26 @@ function graphic_combined_module ($module_list, $weight_list, $period, else { $agent_module_id = $module_list[$i]; - //Get and process agent name - $agent_name = io_safe_output( - modules_get_agentmodule_agent_name ($agent_module_id)); - $agent_name = ui_print_truncate_text($agent_name, 'agent_small', false, true, false, '...', false); - - - $agent_id = agents_get_agent_id ($agent_name); - - //Get and process module name - $module_name = io_safe_output( - modules_get_agentmodule_name ($agent_module_id)); - $module_name = ui_print_truncate_text($module_name, 'module_small', false, true, false, '...', false); - - $module_name_list[$i] = $agent_name . " / " . $module_name; + if (!empty($name_list) && $names_number == $module_number && isset($name_list[$i])) { + $module_name_list[$i] = $name_list[$i]; + } + else { + //Get and process agent name + $agent_name = io_safe_output( + modules_get_agentmodule_agent_name ($agent_module_id)); + $agent_name = ui_print_truncate_text($agent_name, 'agent_small', false, true, false, '...', false); + + + $agent_id = agents_get_agent_id ($agent_name); + + //Get and process module name + $module_name = io_safe_output( + modules_get_agentmodule_name ($agent_module_id)); + $module_name = ui_print_truncate_text($module_name, 'module_small', false, true, false, '...', false); + + $module_name_list[$i] = $agent_name . " / " . $module_name; + } + $id_module_type = modules_get_agentmodule_type ($agent_module_id); $module_type = modules_get_moduletype_name ($id_module_type); $uncompressed_module = is_module_uncompressed ($module_type); @@ -1198,19 +1220,61 @@ function graphic_combined_module ($module_list, $weight_list, $period, $avg = round($avg / $countAvg, 1); $graph_stats = get_graph_statistics($graph_values[$i]); + + if (!isset($config["short_module_graph_data"])) + $config["short_module_graph_data"] = true; - $min = $graph_stats['min']; - $max = $graph_stats['max']; - $avg = $graph_stats['avg']; - $last = $graph_stats['last']; - $units = modules_get_unit($agent_module_id); + if ($config["short_module_graph_data"]) { + $min = $graph_stats['min']; + $max = $graph_stats['max']; + $avg = $graph_stats['avg']; + $last = $graph_stats['last']; + + if ($min > 1000000) + $min = sprintf("%sM", number_format($min / 1000000, 2)); + else if ($min > 1000) + $min = sprintf("%sK", number_format($min / 1000, 2)); + + if ($max > 1000000) + $max = sprintf("%sM", number_format($max / 1000000, 2)); + else if ($max > 1000) + $max = sprintf("%sK", number_format($max / 1000, 2)); + + if ($avg > 1000000) + $avg = sprintf("%sM", number_format($avg / 1000000, 2)); + else if ($avg > 1000) + $avg = sprintf("%sK", number_format($avg / 1000, 2)); + + if ($last > 1000000) + $last = sprintf("%sM", number_format($last / 1000000, 2)); + else if ($last > 1000) + $last = sprintf("%sK", number_format($last / 1000, 2)); + } + else { + $min = number_format($graph_stats['min'], 2); + $max = number_format($graph_stats['max'], 2); + $avg = number_format($graph_stats['avg'], 2); + $last = number_format($graph_stats['last'], 2); + } + + + if (!empty($unit_list) && $units_number == $module_number && isset($unit_list[$i])) { + $unit = $unit_list[$i]; + } + else { + $unit = modules_get_unit($agent_module_id); + } if ($projection == false or ($projection != false and $i == 0)) { - $module_name_list[$i] .= ": " . - __('Last') . ": $last $units; " . - __("Max") . ": $max $units; " . - __("Min") . ": $min $units; " . - __("Avg") . ": $avg"; + $module_name_list[$i] .= ": "; + if ($show_last) + $module_name_list[$i] .= __('Last') . ": $last $unit; "; + if ($show_max) + $module_name_list[$i] .= __("Max") . ": $max $unit; "; + if ($show_min) + $module_name_list[$i] .= __("Min") . ": $min $unit; "; + if ($show_avg) + $module_name_list[$i] .= __("Avg") . ": $avg $unit"; } if ($weight_list[$i] != 1) { diff --git a/pandora_console/include/functions_groups.php b/pandora_console/include/functions_groups.php index ca3e9b4e4f..78aa6df80d 100644 --- a/pandora_console/include/functions_groups.php +++ b/pandora_console/include/functions_groups.php @@ -250,7 +250,7 @@ function groups_get_childrens($parent, $groups = null, $onlyPropagate = false) { if ($group['propagate'] || $onlyPropagate) { if ($group['parent'] == $parent) { - $return = $return + array($group['id_grupo'] => $group) + groups_get_childrens($group['id_grupo'], $groups); + $return = $return + array($group['id_grupo'] => $group) + groups_get_childrens($group['id_grupo'], $groups, $onlyPropagate); } } @@ -869,8 +869,19 @@ function groups_get_group_row($id_group, $group_all, $group, &$printed_groups) { // Get stats for this group $data = reporting_get_group_stats($id_group); - if ($data["total_agents"] == 0) - return; // Skip empty groups + if ($data["total_agents"] == 0) { + if (!empty($group['childs'])) { + $group_childrens = groups_get_childrens($id_group, null, true); + $group_childrens_agents = groups_total_agents(array_keys($group_childrens)); + + if (empty($group_childrens_agents)) { + return; // Skip empty groups + } + } + else { + return; // Skip empty groups + } + } // Calculate entire row color if ($data["monitor_alerts_fired"] > 0) { diff --git a/pandora_console/install.php b/pandora_console/install.php index 2d454e5eaf..4091bcf851 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -63,7 +63,7 @@