From 9994477c06556692ce72706441f9b679ca48983c Mon Sep 17 00:00:00 2001 From: Shinichi Matsumoto Date: Fri, 3 Feb 2023 08:00:44 +0000 Subject: [PATCH 001/458] Change return value of function agents_get_agent_id_by_alias when alias is '' --- pandora_console/include/functions_agents.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pandora_console/include/functions_agents.php b/pandora_console/include/functions_agents.php index 6e37a1e991..3b3bac283b 100644 --- a/pandora_console/include/functions_agents.php +++ b/pandora_console/include/functions_agents.php @@ -165,9 +165,9 @@ function agents_locate_agent(string $field) function agents_get_agent_id_by_alias($alias, $is_metaconsole=false) { if ($is_metaconsole === true) { - return db_get_all_rows_sql("SELECT id_tagente FROM tmetaconsole_agent WHERE upper(alias) LIKE upper('%$alias%')"); + return db_get_all_rows_sql("SELECT id_tagente FROM tmetaconsole_agent WHERE '$alias' != '' and upper(alias) LIKE upper('%$alias%')"); } else { - return db_get_all_rows_sql("SELECT id_agente FROM tagente WHERE upper(alias) LIKE upper('%$alias%')"); + return db_get_all_rows_sql("SELECT id_agente FROM tagente WHERE '$alias' != '' and upper(alias) LIKE upper('%$alias%')"); } } From eb6422495b53bdbf120ec04657e3fb934c1690aa Mon Sep 17 00:00:00 2001 From: rafael Date: Mon, 13 Mar 2023 13:52:41 +0100 Subject: [PATCH 002/458] 9735 adding inventory_solaris.pl to plugin path on unix agent and adding reference commented to conf file --- pandora_agents/unix/SunOS/pandora_agent.conf | 4 +- .../unix/plugins/inventory_solaris.pl | 121 ++++++++++++++++++ 2 files changed, 123 insertions(+), 2 deletions(-) create mode 100644 pandora_agents/unix/plugins/inventory_solaris.pl diff --git a/pandora_agents/unix/SunOS/pandora_agent.conf b/pandora_agents/unix/SunOS/pandora_agent.conf index 96f76389d2..ad4e9df6c7 100644 --- a/pandora_agents/unix/SunOS/pandora_agent.conf +++ b/pandora_agents/unix/SunOS/pandora_agent.conf @@ -213,5 +213,5 @@ module_end module_plugin grep_log /var/adm/syslog Syslog . - - +#Inventory plugin +#module_plugin /usr/share/pandora_agent/plugins/inventory_solaris.pl diff --git a/pandora_agents/unix/plugins/inventory_solaris.pl b/pandora_agents/unix/plugins/inventory_solaris.pl new file mode 100644 index 0000000000..fa07650e39 --- /dev/null +++ b/pandora_agents/unix/plugins/inventory_solaris.pl @@ -0,0 +1,121 @@ +#!/usr/bin/perl -w +# + +use strict; +use Data::Dumper; + +#print header +print "\n"; + +#get pakahes +my @pkg_list = `/usr/bin/pkginfo -l 2> /dev/null`; + +print " \n"; +print " \n"; +print " \n"; + +my $pkg; +foreach my $line (@pkg_list) { + + chomp $line; + + my $match = ( $line =~ /PKGINST:/ .. $line =~ /^$/ ); + + if ( $match && $match !~ /E0/ ) { + + if ( $line =~ /^\s+([A-Z]+):\s+(.*)$/ ) { + my ($key, $val) = ($1, $2); + if ( $key eq 'FILES' ) { + if ( $val =~ /^(\d+) (.*)$/ ) { + $pkg->{FILES}->{$2} = $1; + } + } + else { + $pkg->{$1} = $2; + } + } + elsif ( $line =~ /^\s+([0-9]+) (.*)$/ ) { + $pkg->{FILES}->{$2} = $1; + } + else { + print "Unrecognized output: [$line]\n"; + } + + } + else { + + # + # Blank line between packages + # + print "{PKGINST} . ';'; + print $pkg->{VERSION} . ';'; + print $pkg->{NAME} . ';'; + print "]]>\n"; + + } +} +print " \n"; +print " \n"; +#close software module + + +#CPU module +print " \n"; +print " \n"; +print " \n"; + +my $cpu_model =`kstat cpu_info 2> /dev/null | grep brand | uniq | sed 's/.*brand//g' | tr -d ' '`; +my $cpu_clock = `kstat cpu_info 2> /dev/null | grep clock_MHz | uniq | awk '{print \$NF " Mhz"}'`; +my $cpu_brand = `kstat cpu_info 2> /dev/null | grep vendor_id | uniq | awk '{print \$NF}'`; + +chomp $cpu_brand; +chomp $cpu_clock; +chomp $cpu_model; + +print "\n"; + +print " \n"; +print " \n"; +#close cpu module + + +#RAM module +print " \n"; +print " \n"; +print " \n"; + +my $memory_size =`prtconf 2> /dev/null | grep Memory | cut -d ':' -f 2`; + +chomp $memory_size; + +print "\n"; + +print " \n"; +print " \n"; +#close RAM module + +#NIC module +print " \n"; +print " \n"; +print " \n"; + +my @nic =`dladm show-link 2> /dev/null| grep -v STATE | awk '{print \$1}'`; + +foreach my $nic (@nic){ + chomp $nic; + + my $nic_mac = `dladm show-linkprop $nic -p mac-address 2> /dev/null |grep -v LINK| awk '{print \$4}'`; + my $nic_speed = `dladm show-linkprop $nic -p speed 2> /dev/null |grep -v LINK| awk '{print \$4}'`; + + chomp $nic_mac; + chomp $nic_speed; + print "\n"; +} + +print " \n"; +print " \n"; +#close NIC module + +#close inventory +print "\n"; \ No newline at end of file From b78f63385386095fe71558d80cb701f89dc8cc40 Mon Sep 17 00:00:00 2001 From: Daniel Cebrian Date: Thu, 30 Mar 2023 18:27:03 +0200 Subject: [PATCH 003/458] #9771 new function for draw tree and fixed bugs --- pandora_console/include/functions_ui.php | 119 +++++++++++++++++++++++ 1 file changed, 119 insertions(+) diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php index da2c86f941..da9b7e6c8e 100755 --- a/pandora_console/include/functions_ui.php +++ b/pandora_console/include/functions_ui.php @@ -7858,5 +7858,124 @@ function ui_print_fav_menu($id_element, $url, $label, $section) $output .= '

'.__('Title').'

'; $output .= html_print_input_text('label_fav_menu', '', '', 25, 255, true, false, true); $output .= ''; + return $output; +} + + +function ui_print_tree( + $tree, + $id=0, + $depth=0, + $last=0, + $last_array=[], + $sufix=false, + $descriptive_ids=false, + $previous_id='' +) { + static $url = false; + $output = ''; + + // Get the base URL for images. + if ($url === false) { + $url = ui_get_full_url('operation/tree', false, false, false); + } + + // Leaf. + if (empty($tree['__LEAVES__'])) { + return ''; + } + + $count = 0; + $total = (count(array_keys($tree['__LEAVES__'])) - 1); + $last_array[$depth] = $last; + $class = 'item_'.$depth; + + if ($depth > 0) { + $output .= '