diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index c43d4b02e2..13c46629c4 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 6.1dev-160926 +Version: 6.1dev-160928 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 01decab2ff..7daca84d92 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="6.1dev-160926" +pandora_version="6.1dev-160928" 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 35b40c36e6..fde3ba6770 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 => '6.1dev'; -use constant AGENT_BUILD => '160926'; +use constant AGENT_BUILD => '160928'; # Agent log default file size maximum and instances use constant DEFAULT_MAX_LOG_SIZE => 600000; diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index abaca5a6e7..393b03787f 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 6.1dev -%define release 160926 +%define release 160928 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 b4703701d1..9956ee7bff 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 6.1dev -%define release 160926 +%define release 160928 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent_installer b/pandora_agents/unix/pandora_agent_installer index 8f2c83b0d9..ee20c148cd 100644 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="6.1dev" -PI_BUILD="160926" +PI_BUILD="160928" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/unix/plugins/grep_log b/pandora_agents/unix/plugins/grep_log index 7661a2951d..6f606bf4b9 100755 --- a/pandora_agents/unix/plugins/grep_log +++ b/pandora_agents/unix/plugins/grep_log @@ -19,7 +19,6 @@ # GNU General Public License for more details. # ############################################################################### - use strict; use File::Basename; @@ -188,7 +187,10 @@ sub parse_log (;$$) { seek(LOGFILE, $Idx_pos, 0); # Parse log file - my @data; + my %data; + + # Matched line id + my $matched_line = 0; if ( (defined($up_lines)) || (defined($bot_lines)) ){ # Detailed workmode @@ -210,8 +212,9 @@ sub parse_log (;$$) { $flag = 1; # Push upper lines for (my $i = ($curr_line-$up_lines); $i<=$curr_line; $i++){ + if ($i < 0) {next;} if (defined ($lines[$i])) { - push (@data, $lines[$i]); + push (@{$data{$matched_line}}, $lines[$i]); } } @@ -220,16 +223,17 @@ sub parse_log (;$$) { # Push bottom lines for (my $i = ($curr_line+$flag); $i<=($curr_line+$bot_lines); $i++){ if (defined ($lines[$i])) { - push (@data, $lines[$i]); + push (@{$data{$matched_line}}, $lines[$i]); } } } + $matched_line++; } } else { # Standar workmode while ($line = ) { if ($line =~ m/$Reg_exp/i) { - push @data, $line; + push (@{$data{$matched_line++}}, $line); } } } @@ -240,7 +244,7 @@ sub parse_log (;$$) { # Save the index file save_idx(); - return @data; + return \%data; } ############################################################################### @@ -262,11 +266,12 @@ sub print_summary() { # SUB parse_log # Print log data to stdout. ############################################################################### -sub print_log (@) { - my @data = @_; +sub print_log ($) { + my $data = shift; # No data - if ($#data < 0) { + my @kdata = keys (%{$data}); + if ($#kdata < 0) { print_summary() if ($summary_flag == 1); return; } @@ -276,8 +281,8 @@ sub print_log (@) { my $output = "\n"; $output .= "\n"; $output .= "{$line}; } $output .= "]]>"; $output .= "\n"; @@ -292,8 +297,12 @@ sub print_log (@) { $output .= "\n"; $output .= "\n"; $output .= "\n"; - foreach my $line (@data) { - $output .= "\n"; + foreach my $line (@kdata) { + $output .= "{$line}}) { + $output .= $content; + } + $output .= "]]>\n"; } $output .= "\n"; $output .= "\n"; @@ -348,9 +357,9 @@ if (! -e $Idx_file) { load_idx(); # Parse log file -my @data = parse_log($up_lines,$bot_lines); +my $data = parse_log($up_lines,$bot_lines); # Print output to stdout -print_log (@data); +print_log ($data); exit 0; diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 6b4bc25cef..c29cbc5c8a 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{160926} +{160928} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index b7061f3637..4b6e1f1d92 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 ("6.1dev(Build 160926)") +#define PANDORA_VERSION ("6.1dev(Build 160928)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 32c16b6f83..993851e1a9 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", "(6.1dev(Build 160926))" + VALUE "ProductVersion", "(6.1dev(Build 160928))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 71438091a5..dce60aeaa1 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 6.1dev-160926 +Version: 6.1dev-160928 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 596b38cb56..4e87429197 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="6.1dev-160926" +pandora_version="6.1dev-160928" package_pear=0 package_pandora=1 diff --git a/pandora_console/Dockerfile b/pandora_console/Dockerfile index add7d4e380..3f46b9c25b 100644 --- a/pandora_console/Dockerfile +++ b/pandora_console/Dockerfile @@ -45,6 +45,7 @@ RUN yum install -y \ php-common \ php-zip \ nmap \ + net-snmp-utils \ xprobe2 #Clone the repo diff --git a/pandora_console/godmode/modules/manage_network_components.php b/pandora_console/godmode/modules/manage_network_components.php index 1d47b6a560..8ca2ed9f57 100644 --- a/pandora_console/godmode/modules/manage_network_components.php +++ b/pandora_console/godmode/modules/manage_network_components.php @@ -79,7 +79,7 @@ if (!empty($macros)) { $macros[$k]['value'] = get_parameter($m['macro'], ''); } - $macros = json_encode($macros); + $macros = io_json_mb_encode($macros); } $max_timeout = (int) get_parameter ('max_timeout'); diff --git a/pandora_console/godmode/reporting/visual_console_builder.editor.js b/pandora_console/godmode/reporting/visual_console_builder.editor.js index e580afd8d5..b4a777d5d6 100755 --- a/pandora_console/godmode/reporting/visual_console_builder.editor.js +++ b/pandora_console/godmode/reporting/visual_console_builder.editor.js @@ -1239,8 +1239,8 @@ function setModuleGraph(id_data) { id_agente_modulo = data['id_agente_modulo']; id_custom_graph = data['id_custom_graph']; label = data['label']; - height = data['height']; - width = data['width']; + height = (data['height'] + 60); + width = (data['width'] + 60); period = data['period']; background_color = data['image']; diff --git a/pandora_console/include/ajax/visual_console_builder.ajax.php b/pandora_console/include/ajax/visual_console_builder.ajax.php index 5ba5a4e059..9631063b6d 100755 --- a/pandora_console/include/ajax/visual_console_builder.ajax.php +++ b/pandora_console/include/ajax/visual_console_builder.ajax.php @@ -153,7 +153,7 @@ switch ($action) { if ($id_custom_graph != 0) { $img = custom_graphs_print( $id_custom_graph, $height, $width, $period, - true, true, 0, true, $background_color); + null, true, 0, true, $background_color); } else { $img = grafico_modulo_sparse($id_agent_module, @@ -189,7 +189,8 @@ switch ($action) { case 'get_layout_data': $layoutData = db_get_row_filter('tlayout_data', array('id' => $id_element)); - + $layoutData['height'] = $layoutData['height'] + 60; + $layoutData['width'] = $layoutData['width'] + 60; echo json_encode($layoutData); break; diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 197688cd6d..68cbb1c93e 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 = 'PC160926'; +$build_version = 'PC160928'; $pandora_version = 'v6.1dev'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index efb4e20d0d..40232fd4d2 100644 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -2631,8 +2631,8 @@ function reporting_alert_report_group($report, $content) { $data_row['fired'] = array(); $firedTimes = get_module_alert_fired( - $content['id_agent_module'], - $alert['id_alert_template'], + $alert['id_agent_module'], + $alert['id'], (int) $content['period'], (int) $report["datetime"]); @@ -2739,7 +2739,7 @@ function reporting_alert_report_agent($report, $content) { $data_row['fired'] = array(); $firedTimes = get_module_alert_fired( $alert['id_agent_module'], - $alert['id_alert_template'], + $alert['id'], (int) $content['period'], (int) $report["datetime"]); diff --git a/pandora_console/include/functions_visual_map.php b/pandora_console/include/functions_visual_map.php index f9686953e7..6bdc617829 100755 --- a/pandora_console/include/functions_visual_map.php +++ b/pandora_console/include/functions_visual_map.php @@ -94,8 +94,10 @@ function visual_map_print_item($mode = "read", $layoutData, require_once ($config["homedir"] . '/include/functions_graph.php'); require_once ($config["homedir"] . '/include/functions_custom_graphs.php'); - $width = $layoutData['width']; - $height = $max_percentile = $layoutData['height']; + //add 60 px for visual console map + $width = $layoutData['width'] + 60; + $height = $layoutData['height'] + 60; + $max_percentile = $layoutData['height']; $top = $layoutData['pos_y']; $left = $layoutData['pos_x']; $id = $layoutData['id']; diff --git a/pandora_console/include/graphs/functions_pchart.php b/pandora_console/include/graphs/functions_pchart.php index 655f51d047..e54fbafc05 100644 --- a/pandora_console/include/graphs/functions_pchart.php +++ b/pandora_console/include/graphs/functions_pchart.php @@ -691,7 +691,7 @@ function pch_bar_graph ($graph_type, $index, $data, $width, $height, $font, "Mode"=>SCALE_MODE_START0, "LabelRotation" => 60); $margin_left = 40; $margin_top = 10; - $margin_bottom = 10 * $max_chars; + $margin_bottom = 3 * $max_chars; break; case "hbar": $scaleSettings = array("GridR"=>200,"GridG"=>200,"GridB"=>200,"DrawSubTicks"=>TRUE, @@ -718,13 +718,13 @@ function pch_bar_graph ($graph_type, $index, $data, $width, $height, $font, $myPicture->setGraphArea($margin_left,$margin_top,$width - $water_mark_width,$height-$margin_bottom); $myPicture->drawScale($scaleSettings); - + /* if (isset($legend)) { - /* Write the chart legend */ + /* Write the chart legend $size = $myPicture->getLegendSize(array("Style"=>LEGEND_NOBORDER,"Mode"=>LEGEND_HORIZONTAL)); $myPicture->drawLegend($width-$size['Width'],0,array("Style"=>LEGEND_NOBORDER,"Mode"=>LEGEND_HORIZONTAL, "BoxWidth"=>10, "BoxHeight"=>10)); } - + */ /* Turn on shadow computing */ $myPicture->setShadow(TRUE,array("X"=>0,"Y"=>1,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>10)); @@ -1137,8 +1137,9 @@ function pch_bullet_chart($graph_type, $data, $legend, $MyData->setSerieDescription("Labels", __("Agents/Modules")); $height_t = ($height * count($data) ) + 40; - $width_t = ($width + ( 200 + $max_chars)); - $max_chars = graph_get_max_index($legend_values); + $height_t = $height; + $max_chars = graph_get_max_index($legend); + $width_t = ($width + ( 100 + $max_chars)); /* Create the pChart object */ $myPicture = new pImage($width_t, $height_t,$MyData); @@ -1151,7 +1152,7 @@ function pch_bullet_chart($graph_type, $data, $legend, $height_t - 10; /* Draw the scale and chart */ - $myPicture->setGraphArea(220,20,($width + 80), $height_t); + $myPicture->setGraphArea(250,20,($width + 100), $height_t); $myPicture->drawScale(array("Pos"=>SCALE_POS_TOPBOTTOM, "Mode"=>SCALE_MODE_ADDALL_START0, "LabelingMethod"=>LABELING_DIFFERENT, "GridR"=>255, "GridG"=>255, "GridB"=>255, "GridAlpha"=>50, "TickR"=>0,"TickG"=>0, "TickB"=>0, diff --git a/pandora_console/install.php b/pandora_console/install.php index 3e8ccc8708..5b051b4fb8 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -71,7 +71,7 @@
Remote ICMP network agent (latency) or Remote TCP network agent, numeric data @@ -19,6 +18,8 @@ def create_network_component_tcp(driver,name,type_component,group,module_group,m driver.find_element_by_id("id_component_type").click() Select(driver.find_element_by_id("id_component_type")).select_by_visible_text("Create a new network component") + + driver.find_element_by_id("submit-crt").click() driver.find_element_by_id("text-name").click() driver.find_element_by_id("text-name").clear() @@ -27,8 +28,7 @@ def create_network_component_tcp(driver,name,type_component,group,module_group,m driver.find_element_by_id("type").click() Select(driver.find_element_by_id("type")).select_by_visible_text(type_component) - driver.find_element_by_id("id_group").click() - Select(driver.find_element_by_id("id_group")).select_by_visible_text(group) + driver.find_element_by_xpath('//option[contains(.,"'+group+'")]').click() driver.find_element_by_id("id_module_group").click() Select(driver.find_element_by_id("id_module_group")).select_by_visible_text(module_group) @@ -57,6 +57,7 @@ def create_network_component_tcp(driver,name,type_component,group,module_group,m driver.find_element_by_id("text-max_critical").clear() driver.find_element_by_id("text-max_critical").send_keys(max_critical) + # str_warning and str_critical if type_component supports this type if str_warning != None: driver.find_element_by_id("text-str_warning").click() @@ -77,3 +78,139 @@ def create_network_component_tcp(driver,name,type_component,group,module_group,m driver.find_element_by_id("submit-crt").click() +def create_plugin_component(driver,name,type_component,group,module_group,min_warning=None,max_warning=None,min_critical=None,max_critical=None,str_warning=None,str_critical=None,description=None): + + # type_component is for example -> Generic boolean or Generic numeric incremental (absolute) + + click_menu_element(driver,"Network components") + + driver.find_element_by_xpath('//*[@id="id_component_type"]/option[2]').click() + + driver.find_element_by_id("submit-crt").click() + + driver.find_element_by_id("text-name").click() + driver.find_element_by_id("text-name").clear() + driver.find_element_by_id("text-name").send_keys(name) + + driver.find_element_by_id("type").click() + Select(driver.find_element_by_id("type")).select_by_visible_text(type_component) + + driver.find_element_by_xpath('//option[contains(.,"'+group+'")]').click() + + driver.find_element_by_id("id_module_group").click() + Select(driver.find_element_by_id("id_module_group")).select_by_visible_text(module_group) + + if min_warning != None: + + driver.find_element_by_id("text-min_warning").click() + driver.find_element_by_id("text-min_warning").clear() + driver.find_element_by_id("text-min_warning").send_keys(min_warning) + + if max_warning != None: + + driver.find_element_by_id("text-max_warning").click() + driver.find_element_by_id("text-max_warning").clear() + driver.find_element_by_id("text-max_warning").send_keys(max_warning) + + if min_critical != None: + + driver.find_element_by_id("text-min_critical").click() + driver.find_element_by_id("text-min_critical").clear() + driver.find_element_by_id("text-min_critical").send_keys(min_critical) + + + if max_critical != None: + + driver.find_element_by_id("text-max_critical").click() + driver.find_element_by_id("text-max_critical").clear() + driver.find_element_by_id("text-max_critical").send_keys(max_critical) + + # str_warning and str_critical for Generic string type: + if str_warning != None: + + driver.find_element_by_id("text-str_warning").click() + driver.find_element_by_id("text-str_warning").clear() + driver.find_element_by_id("text-str_warning").send_keys(str_warning) + + if str_critical != None: + + driver.find_element_by_id("text-str_critical").click() + driver.find_element_by_id("text-str_critical").clear() + driver.find_element_by_id("text-str_critical").send_keys(str_critical) + + if description != None: + + driver.find_element_by_id("textarea_description").click() + driver.find_element_by_id("textarea_description").clear() + driver.find_element_by_id("textarea_description").send_keys(description) + + driver.find_element_by_id("submit-crt").click() + +def create_wmi_component(driver,name,type_component,group,module_group,min_warning=None,max_warning=None,min_critical=None,max_critical=None,str_warning=None,str_critical=None,description=None): + + # type_component is for example -> Generic boolean or Generic numeric incremental (absolute) + + click_menu_element(driver,"Network components") + + driver.find_element_by_xpath('//*[@id="id_component_type"]/option[3]').click() + + driver.find_element_by_id("submit-crt").click() + + driver.find_element_by_id("text-name").click() + driver.find_element_by_id("text-name").clear() + driver.find_element_by_id("text-name").send_keys(name) + + driver.find_element_by_id("type").click() + Select(driver.find_element_by_id("type")).select_by_visible_text(type_component) + + driver.find_element_by_xpath('//option[contains(.,"'+group+'")]').click() + + driver.find_element_by_id("id_module_group").click() + Select(driver.find_element_by_id("id_module_group")).select_by_visible_text(module_group) + + if min_warning != None: + + driver.find_element_by_id("text-min_warning").click() + driver.find_element_by_id("text-min_warning").clear() + driver.find_element_by_id("text-min_warning").send_keys(min_warning) + + if max_warning != None: + + driver.find_element_by_id("text-max_warning").click() + driver.find_element_by_id("text-max_warning").clear() + driver.find_element_by_id("text-max_warning").send_keys(max_warning) + + if min_critical != None: + + driver.find_element_by_id("text-min_critical").click() + driver.find_element_by_id("text-min_critical").clear() + driver.find_element_by_id("text-min_critical").send_keys(min_critical) + + + if max_critical != None: + + driver.find_element_by_id("text-max_critical").click() + driver.find_element_by_id("text-max_critical").clear() + driver.find_element_by_id("text-max_critical").send_keys(max_critical) + + # str_warning and str_critical if type_component is Generic boolean + if str_warning != None: + + driver.find_element_by_id("text-str_warning").click() + driver.find_element_by_id("text-str_warning").clear() + driver.find_element_by_id("text-str_warning").send_keys(str_warning) + + if str_critical != None: + + driver.find_element_by_id("text-str_critical").click() + driver.find_element_by_id("text-str_critical").clear() + driver.find_element_by_id("text-str_critical").send_keys(str_critical) + + if description != None: + + driver.find_element_by_id("textarea_description").click() + driver.find_element_by_id("textarea_description").clear() + driver.find_element_by_id("textarea_description").send_keys(description) + + driver.find_element_by_id("submit-crt").click() +