diff --git a/extras/docker/build_and_push.sh b/extras/docker/build_and_push.sh index 980087cfe5..91e6fa15e5 100755 --- a/extras/docker/build_and_push.sh +++ b/extras/docker/build_and_push.sh @@ -1,3 +1,3 @@ #!/bin/bash -docker build --rm=true --build-arg BRANCH="develop" --build-arg DB_PASS="pandora" -t pandorafms/pandorafms:7 . && \ +docker build --rm=true --pull --no-cache --build-arg BRANCH="develop" --build-arg DB_PASS="pandora" -t pandorafms/pandorafms:7 . && \ docker push pandorafms/pandorafms:7 diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index 0e78b20d8d..e5ce7197b1 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.734-190506 +Version: 7.0NG.734-190510 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 12256d0c1a..d6937b6849 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="7.0NG.734-190506" +pandora_version="7.0NG.734-190510" 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 be46abf7d5..cbb9a72d25 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -42,7 +42,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.734'; -use constant AGENT_BUILD => '190506'; +use constant AGENT_BUILD => '190510'; # 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 8375b3efeb..a473681428 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 7.0NG.734 -%define release 190506 +%define release 190510 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 89aba3aefe..8f4c593eab 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 7.0NG.734 -%define release 190506 +%define release 190510 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 b94a0914d6..92c4545bab 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.734" -PI_BUILD="190506" +PI_BUILD="190510" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/unix/plugins/inventory b/pandora_agents/unix/plugins/inventory index a6d9a8bc83..6ef6233d23 100755 --- a/pandora_agents/unix/plugins/inventory +++ b/pandora_agents/unix/plugins/inventory @@ -4,23 +4,44 @@ # Copyright (c) 2009 Artica Soluciones Tecnologicas S.L. # # inventory Generate a hardware/software inventory. -# +# # Sample usage: ./inventory [cpu] [ram] [video] [nic] [hd] [cdrom] [software] [init_services] [filesystem] [process] [users] # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; version 2 of the License. -# +# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. +# GNU General Public License for more details. # ############################################################################### use strict; use constant TSTAMP_FILE => '/tmp/pandora_inventory.tstamp'; +use Scalar::Util qw(looks_like_number); +use Data::Dumper; +# Set environment language to English +$ENV{"LANG"} = "en_US"; + +# Check AIX system +my $AIX=0; +my $system = `uname -a | awk '{print $1}'`; +if ($system =~ 'AIX') { + $AIX=1; +} + +sub is_enabled { + my $value = shift; + if ((defined ($value)) && looks_like_number($value) && ($value > 0)){ + # return true + return 1; + } + #return false + return 0; +} # Operation mode (LSHW or HWINFO) my $Mode; @@ -31,12 +52,12 @@ my $Separator; sub get_module_data ($$$$) { my ($name, $hwinfo, $keys, $modules) = @_; my %module; - - # Store keys + $Separator='\s+\*\-'; + # Store keys foreach my $key (@{$keys}) { push (@{$module{'_keys'}}, $key); } - + # Parse module data while (my $line = shift (@{$hwinfo})) { if ($line =~ /$Separator/) { @@ -46,7 +67,7 @@ sub get_module_data ($$$$) { foreach my $key (@{$keys}) { if ($line =~ /$key:\s+(.+)/) { $module{$key} = $1; - # Replace semicolon by comma to avoid parse errors + # Replace semicolon by comma to avoid parse errors $module{$key} =~ s/;/,/g; } } @@ -58,12 +79,65 @@ sub get_module_data ($$$$) { push (@{$modules->{$name}}, \%module); } +sub test_contain ($$) { + my ($value, $array)=@_; + if ( grep( /$value/, @{$array} ) ) { + return 1; + } +} +sub get_module_data_aix_ram_cpu ($$$$) { + my ($name, $hwinfo, $keys, $modules) = @_; + my %module; + # Store keys + foreach my $key (@{$keys}) { + push (@{$module{'_keys'}}, $key); + } + # Parse module data + foreach my $line (@{$hwinfo}) { + foreach my $key (@{$keys}) { + if ($line =~ /$key:\s+(.+)/) { + $module{$key} = $1; + $module{$key} =~ s/,/ /g; + } + } + } + + # No data found + #my @data = keys (%module); + #return unless ($#data >= 0); + + push (@{$modules->{$name}}, \%module); +} +sub get_module_data_aix ($$$$) { + my ($name,$hwinfo,$regex,$modules) = @_; + my %module; + foreach my $line (@{$hwinfo}) { + $line =~ s/\s{2,}/;/g; + $line =~ s/\+ //g; + $line =~ s/\* //g; + } + foreach my $line (@{$hwinfo}) { + if ($line =~ /$regex/){ + my ($var1, $var2, $var3) = split /;/, $line; + my %module; + $module{'device'} = $var1; + $module{'serial'} = $var2; + $module{'description'}=$var3; + $module{'_keys'} = ['device','serial','description']; + push (@{$modules->{$name}}, \%module); + } + } +} # Get a list of information file system in machine sub get_file_system($$) { my ($name, $modules) = @_; - - my @fileSystems = `df -hP | tail -n +2`; #remove the titles of columns + my @fileSystems; + if (is_enabled $AIX){ + @fileSystems = `df -gP | tail -n +2`; + } else { + @fileSystems = `df -hP | tail -n +2`; #remove the titles of columns + } foreach my $row (@fileSystems) { next unless ($row =~ /^(\S+)\s+\S+\s+(\S+)\s+(\S+)\s+\S+\s+(\S+)/); @@ -73,94 +147,110 @@ sub get_file_system($$) { $module{'used'} = $2; $module{'avail'} = $3; $module{'mount'} = $4; - $module{'_keys'} = ['filesystem', 'used','avail', 'mount']; - push (@{$modules->{$name}}, \%module); - } + $module{'_keys'} = ['filesystem', 'used','avail', 'mount']; + push (@{$modules->{$name}}, \%module); + } } # Get a list of services init in machine sub get_servicies_init_machine($$) { my ($name, $modules) = @_; - my $runlevel = `who -r | awk '{print \$2}'`; + my $runlevel; + if (is_enabled $AIX) { + $runlevel = `who -r | awk '{print \$3}'`; + } else { + $runlevel = `who -r | awk '{print \$2}'`; + } #ini trim($runlevel) $runlevel =~ s/^\s*//; #ltrim $runlevel =~ s/\s*$//; #rtrim #end trim($runlevel) - my $script = ""; - + my $script; + if (-e "/etc/rc" . $runlevel .".d/") { - $script = "ls /etc/rc" . $runlevel .".d/ -l | grep \"^l.*\" | awk \"{print \\\$NF}\" | sed -e \"s/\\.\\.\\///g\" | sed -e \"s/.*init\\.d\\///g\""; + $script = "ls -l /etc/rc" . $runlevel .".d/ | grep \"^l.*\" | awk \"{print \\\$NF}\" | sed -e \"s/\\.\\.\\///g\" | sed -e \"s/.*init\\.d\\///g\""; } else { - $script = "ls /etc/rc.d/rc" . $runlevel .".d/ -l | grep \"^l.*\" | grep \" S.* \" | awk \"{print \\\$NF}\" | sed -e \"s/\\.\\.\\///g\" | sed -e \"s/.*init\\.d\\///g\""; - + $script = "ls -l /etc/rc.d/rc" . $runlevel .".d/ | grep \"^l.*\" | grep \" S.* \" | awk \"{print \\\$NF}\" | sed -e \"s/\\.\\.\\///g\" | sed -e \"s/.*init\\.d\\///g\""; } - + my @services = `$script`; foreach my $row (@services) { - my %module; - $row =~ s/\n//; - $module{'service'} = $row; - $module{'_keys'} = ['service']; - push (@{$modules->{$name}}, \%module); + $row =~ s/\n//; + $module{'service'} = $row; + $module{'_keys'} = ['service']; + push (@{$modules->{$name}}, \%module); } } # Get a list of running processes sub get_processes ($$) { my ($name, $modules) = @_; + my $script; + if (is_enabled $AIX) { + $script = "ps -eo args | tail -n +2"; + } else { + $script = "ps -eo command | tail -n +2"; + } - my $script = "ps -eo command"; - - my @services = `$script`; - foreach my $row (@services) { - my %module; - # Remove carriage returns - $row =~ s/[\n\l\f]//g; - # Replace semicolon by comma to avoid parse errors - $row =~ s/;/,/g; - $module{'service'} = $row; - $module{'_keys'} = ['service']; - push (@{$modules->{$name}}, \%module); - } + my @services = `$script`; + foreach my $row (@services) { + my %module; + # Remove carriage returns + $row =~ s/[\n\l\f]//g; + # Replace semicolon by comma to avoid parse errors + $row =~ s/;/,/g; + $module{'service'} = $row; + $module{'_keys'} = ['service']; + push (@{$modules->{$name}}, \%module); + } } # Get a list of valid users in the system sub get_users ($$) { - my ($name, $modules) = @_; - - my $script = "cat /etc/passwd"; + my ($name, $modules) = @_; + my $script = "cat /etc/passwd"; my $user = ""; my $estado = ""; - my @services = `$script`; - foreach my $row (@services) { - my %module; + my @services = `$script`; + foreach my $row (@services) { + my %module; - next unless ($row =~ /^([A-Za-z0-9\-\_]*)/); - - $user = $1; - $script = `passwd -S $user`; - if ( $script =~ /^(\S+)\sP./){ - $module{'user'} = $user; - $module{'_keys'} = ['user']; - push (@{$modules->{$name}}, \%module); + next unless ($row =~ /^([A-Za-z0-9\-\_]*)/); + if (is_enabled $AIX) { + $user = $1; + $script = `lsuser $user`; + if ( $script =~ /^(\S+)\sid./){ + $module{'user'} = $user; + $module{'_keys'} = ['user']; + push (@{$modules->{$name}}, \%module); + } + } else { + $user = $1; + $script = `passwd -S $user`; + if ( $script =~ /^(\S+)\sP./){ + $module{'user'} = $user; + $module{'_keys'} = ['user']; + push (@{$modules->{$name}}, \%module); } } + + } } # Show Kernel Information sub get_kernel_info ($$) { - my ($name, $modules) = @_; - my $script = `uname -a | tr -d \";\"`; - my %module; + my ($name, $modules) = @_; + my $script = `uname -a | tr -d \";\"`; + my %module; - $module{'Kernel'} = $script; - $module{'_keys'} = ['Kernel']; - push (@{$modules->{$name}}, \%module); + $module{'Kernel'} = $script; + $module{'_keys'} = ['Kernel']; + push (@{$modules->{$name}}, \%module); } @@ -171,11 +261,13 @@ sub get_software_module_data ($$) { # Guess the current distribution my $distrib_id = ""; - if ( -e "/etc/SuSE-release"){ + if (is_enabled $AIX) { + $distrib_id = "AIX"; + }elsif ( -e "/etc/SuSE-release"){ $distrib_id = "SUSE"; - } elsif ( -e "/etc/redhat-release"){ + }elsif ( -e "/etc/redhat-release"){ $distrib_id = "REDHAT"; - } else { + }else { $distrib_id = "DEBIAN"; } @@ -183,7 +275,9 @@ sub get_software_module_data ($$) { my @soft; if ($distrib_id eq 'DEBIAN') { @soft = `dpkg -l | grep ii`; - } else { + }elsif ($distrib_id eq 'AIX') { + @soft = `lslpp -Lcq | awk -F: '{print "ii "\$1" "\$3" "\$8}'`; + }else { # Sometimes rpm return data splitted in two lines, and with dupes. Thats bad for our inventory system @soft = `rpm -q -a --qf "ii %{NAME} %{VERSION} %{SUMMARY}\n" | grep "^ii" | sort -u`; } @@ -197,7 +291,7 @@ sub get_software_module_data ($$) { $module{'program'} = $1; $module{'version'} = $2; $module{'description'} = $3; - # Replace semicolon by comma to avoid parse errors + # Replace semicolon by comma to avoid parse errors $module{'program'} =~ s/;/,/g; $module{'version'} =~ s/;/,/g; $module{'description'} =~ s/;/,/g; @@ -211,67 +305,95 @@ sub get_software_module_data ($$) { #Get the list of interfaces with the ip assigned sub get_ips ($$) { my ($name, $modules) = @_; + my @interfaces; + my $ifconfig; + if (is_enabled $AIX) { + $ifconfig = `ifconfig -a`; + } else { + $ifconfig = `ifconfig`; + } - my $ifconfig = `ifconfig`; - - my @ifconfig_array = split("\n", $ifconfig); - - for(my $i = 0; $i<$#ifconfig_array; $i++) { - - #Check for an interface - if ($ifconfig_array[$i] =~ /Link/) { - my %info; - - my @line_split = split(" ", $ifconfig_array[$i]); - - #Get interface name - $info{'interface'} = $line_split[0]; - #Get IP address - my $line = $ifconfig_array[$i+1]; - - $line =~ s/\s+//g; + my @ifconfig_array = split("\n", $ifconfig); - @line_split = split(":", $line); - - if($line_split[1] =~ /(\d+\.\d+\.\d+\.\d+).+/) { - $info{'ip'} = $1; - } - - $info{'_keys'} = ['interface', 'ip']; - push (@{$modules->{$name}}, \%info); - - } + foreach (@ifconfig_array){ + if ($_=~/(.*)flags/){ + my $match; + ($match)=$_=~/^(.*?)\: flags/; + $match=~s/://; + push @interfaces,$match; + } + } + foreach (@interfaces) { + my $ifconfig_item=`ifconfig $_`; + my $interface=$_; + my @ip_array = split("\n", $ifconfig_item); + foreach (@ip_array) { + if ($_=~/(?<=inet )(.*)(?= netmask)/){ + my $ip; + ($ip)=$_=~/inet (.*) netmask/; + my %info; + $info{'interface'} = $interface; + $info{'ip'} = $ip; + $info{'_keys'} = ['interface','ip']; + push (@{$modules->{$name}}, \%info); + } + } } } #Get route table sub get_route_table ($$) { - my ($name, $modules) = @_; - - my $route_table = `route`; - - my @table_split = split("\n", $route_table); - - for (my $i=2; $i<=$#table_split; $i++) { - - my @split = split(" ", $table_split[$i]); - - my %info; - - $info{'destination'} = $split[0]; - $info{'gateway'} = $split[1]; - $info{'mask'} = $split[2]; - $info{'flags'} = $split[3]; - $info{'metric'} = $split[4]; - $info{'ref'} = $split[5]; - $info{'use'} = $split[6]; - $info{'interface'} = $split[7]; - - $info{'_keys'} = ['destination', 'gateway', 'mask', 'flags', 'metric', 'use', 'interface']; - - push (@{$modules->{$name}}, \%info); - } + my ($name, $modules) = @_; + my $route_table; + my @table_split; + if (is_enabled $AIX) { + $route_table = `netstat -rn`; + @table_split = split("\n", $route_table); + my $length=scalar @table_split; + for (my $i=4; $i<=$length-4; $i++) { + + my @split = split(" ", $table_split[$i]); + + my %info; + + $info{'destination'} = $split[0]; + $info{'gateway'} = $split[1]; + $info{'mask'} = $split[2]; + $info{'flags'} = $split[3]; + $info{'metric'} = $split[4]; + $info{'ref'} = $split[5]; + $info{'use'} = $split[6]; + $info{'interface'} = $split[7]; + + $info{'_keys'} = ['destination', 'gateway', 'mask', 'flags', 'metric', 'use', 'interface']; + + push (@{$modules->{$name}}, \%info); + } + } else { + $route_table = `route`; + my @table_split = split("\n", $route_table); + + for (my $i=2; $i<=$#table_split; $i++) { + + my @split = split(" ", $table_split[$i]); + + my %info; + + $info{'destination'} = $split[0]; + $info{'gateway'} = $split[1]; + $info{'mask'} = $split[2]; + $info{'flags'} = $split[3]; + $info{'metric'} = $split[4]; + $info{'ref'} = $split[5]; + $info{'use'} = $split[6]; + $info{'interface'} = $split[7]; + + $info{'_keys'} = ['destination', 'gateway', 'mask', 'flags', 'metric', 'use', 'interface']; + + push (@{$modules->{$name}}, \%info); + } + } } # Print module data sub print_module ($$) { @@ -309,14 +431,18 @@ my $enable_all = 0; $interval = $ARGV[0]; if ($#ARGV == 0){ - $enable_all = 1; + $enable_all = 1; +} +if ($interval!=/[:alpha:]/){ + splice @ARGV,0,1; } -foreach my $module (@ARGV) { +foreach my $module (@ARGV) { if ($module eq "all"){ - $enable_all = 1; - } - $enabled{$module} = 1; + $enable_all = 1; + }else { + $enabled{$module} = 1; + } } # Check execution interval @@ -333,76 +459,107 @@ close (FILE); # Retrieve hardware information $Mode = 'LSHW'; $Separator = '\s+\*\-'; -my @hwinfo = `lshw 2>/dev/null`; -if ($? != 0) { - $Mode = 'HWINFO'; - $Separator = 'Hardware Class:'; - @hwinfo = `hwinfo --cpu --memory --gfxcard --netcard --cdrom --disk 2>/dev/null`; +my @hwinfo; +if (is_enabled $AIX) { + $Separator = '^\s*$'; + @hwinfo=`prtconf 2>/dev/null`; +} else { + @hwinfo = `lshw 2>/dev/null`; + if ($? != 0) { + $Mode = 'HWINFO'; + $Separator = 'Hardware Class:'; + @hwinfo = `hwinfo --cpu --memory --gfxcard --netcard --cdrom --disk 2>/dev/null`; + } } -# Parse hardware information my %modules; -while (my $line = shift (@hwinfo)) { + + if (is_enabled $AIX) { + #CPU + # VIDEO + ### Not avilable in AIX ### + # NIC + ### Not relevant in AIX ### + if ((test_contain('ent',\@hwinfo)) && ($enable_all == 1 || $enabled{'nic'} == 1)) { + get_module_data_aix ('NIC',\@hwinfo,'^ent',\%modules); + } + if ((test_contain('hdisk',\@hwinfo)) && ($enable_all == 1 || $enabled{'hd'} == 1)) { + get_module_data_aix ('HD',\@hwinfo,'^hdisk',\%modules); + } + + foreach my $line (@hwinfo) { + chomp ($line); + #CPU + if (($line =~ /^Memory Size:/) && ($enable_all == 1 || $enabled{'ram'} == 1)) { + get_module_data_aix_ram_cpu ('RAM', \@hwinfo, ['Memory Size','Good Memory Size'], \%modules); + } + + if (($line =~ /^System Model/) && ($enable_all == 1 || $enabled{'cpu'} == 1)) { + get_module_data_aix_ram_cpu ('CPU', \@hwinfo, ['System Model', 'Processor Implementation Mode', 'Number Of Processors'], \%modules); + } + } +} else { + # Parse hardware information + while (my $line= shift (@hwinfo)) { chomp ($line); + # CPU + if (($line =~ /\*\-cpu/ || $line =~ /Hardware Class: cpu/) && ($enable_all == 1 || $enabled{'cpu'} == 1)) { + if ($Mode eq 'LSHW') { + get_module_data ('CPU', \@hwinfo, ['product', 'vendor', 'capacity'], \%modules); + } else { + get_module_data ('CPU', \@hwinfo, ['Model', 'Vendor', 'Clock'], \%modules); + } + } - # CPU - if (($line =~ /\*\-cpu/ || $line =~ /Hardware Class: cpu/) && ($enable_all == 1 || $enabled{'cpu'} == 1)) { - if ($Mode eq 'LSHW') { - get_module_data ('CPU', \@hwinfo, ['product', 'vendor', 'capacity'], \%modules); - } else { - get_module_data ('CPU', \@hwinfo, ['Model', 'Vendor', 'Clock'], \%modules); - } - } + # RAM + if (($line =~ /\*\-bank/ || $line =~ /\*\-memory/ || $line =~ /Hardware Class: memory/) && ($enable_all == 1 || $enabled{'ram'} == 1)) { + if ($Mode eq 'LSHW') { + get_module_data ('RAM', \@hwinfo, ['description', 'size'], \%modules); + } else { + get_module_data ('RAM', \@hwinfo, ['Model', 'Memory Size'], \%modules); + } + } - # RAM - if (($line =~ /\*\-bank/ || $line =~ /Hardware Class: memory/) && ($enable_all == 1 || $enabled{'ram'} == 1)) { - if ($Mode eq 'LSHW') { - get_module_data ('RAM', \@hwinfo, ['description', 'size'], \%modules); - } else { - get_module_data ('RAM', \@hwinfo, ['Model', 'Memory Size'], \%modules); - } - } + # VIDEO + if (($line =~ /\*\-display/ || $line =~ /Hardware Class: graphics card/) && ($enable_all == 1 || $enabled{'video'} == 1)) { + if ($Mode eq 'LSHW') { + get_module_data ('VIDEO', \@hwinfo, ['product', 'description', 'vendor'], \%modules); + } else { + # Spaces before Device and Vendor are intentional to avoid matching SubDevice and SubVendor + get_module_data ('VIDEO', \@hwinfo, ['Model', ' Device', ' Vendor'], \%modules); + } + } - # VIDEO - if (($line =~ /\*\-display/ || $line =~ /Hardware Class: graphics card/) && ($enable_all == 1 || $enabled{'video'} == 1)) { - if ($Mode eq 'LSHW') { - get_module_data ('VIDEO', \@hwinfo, ['product', 'description', 'vendor'], \%modules); - } else { - # Spaces before Device and Vendor are intentional to avoid matching SubDevice and SubVendor - get_module_data ('VIDEO', \@hwinfo, ['Model', ' Device', ' Vendor'], \%modules); - } - } + # NIC + if (($line =~ /\*\-network/ || $line =~ /Hardware Class: network/) && ($enable_all == 1 || $enabled{'nic'} == 1)) { + if ($Mode eq 'LSHW') { + get_module_data ('NIC', \@hwinfo, ['product', 'description', 'vendor', 'serial'], \%modules); + } else { + # Spaces before Device and Vendor are intentional to avoid matching SubDevice and SubVendor + get_module_data ('NIC', \@hwinfo, ['Model', ' Device', ' Vendor', 'HW Address'], \%modules); + } + } - # NIC - if (($line =~ /\*\-network/ || $line =~ /Hardware Class: network/) && ($enable_all == 1 || $enabled{'nic'} == 1)) { - if ($Mode eq 'LSHW') { - get_module_data ('NIC', \@hwinfo, ['product', 'description', 'vendor', 'serial'], \%modules); - } else { - # Spaces before Device and Vendor are intentional to avoid matching SubDevice and SubVendor - get_module_data ('NIC', \@hwinfo, ['Model', ' Device', ' Vendor', 'HW Address'], \%modules); - } - } - - # CDROM - if (($line =~ /\*\-cdrom/ || $line =~ /Hardware Class: cdrom/) && ($enable_all == 1 || $enabled{'cdrom'} == 1)) { - if ($Mode eq 'LSHW') { - get_module_data ('CDROM', \@hwinfo, ['product', 'description', 'vendor'], \%modules); - } else { - # Spaces before Device and Vendor are intentional to avoid matching SubDevice and SubVendor - get_module_data ('CDROM', \@hwinfo, ['Model', ' Device', ' Vendor'], \%modules); - } - } + # CDROM + if (($line =~ /\*\-cdrom/ || $line =~ /Hardware Class: cdrom/) && ($enable_all == 1 || $enabled{'cdrom'} == 1)) { + if ($Mode eq 'LSHW') { + get_module_data ('CDROM', \@hwinfo, ['product', 'description', 'vendor'], \%modules); + } else { + # Spaces before Device and Vendor are intentional to avoid matching SubDevice and SubVendor + get_module_data ('CDROM', \@hwinfo, ['Model', ' Device', ' Vendor'], \%modules); + } + } - # HD - if (($line =~ /\*\-disk/ || $line =~ /Hardware Class: disk/) && ($enable_all == 1 || $enabled{'hd'} == 1)) { - if ($Mode eq 'LSHW') { - get_module_data ('HD', \@hwinfo, ['product', 'description', 'size'], \%modules); - } else { - get_module_data ('HD', \@hwinfo, ['Model', 'Serial ID', 'Size'], \%modules); - } - } + # HD + if (($line =~ /\*\-disk/ || $line =~ /Hardware Class: disk/) && ($enable_all == 1 || $enabled{'hd'} == 1)) { + if ($Mode eq 'LSHW') { + get_module_data ('HD', \@hwinfo, ['product', 'description', 'size'], \%modules); + } else { + get_module_data ('HD', \@hwinfo, ['Model', 'Serial ID', 'Size'], \%modules); + } + } + } } - # Software if ($enable_all == 1 || $enabled{'software'} == 1) { get_software_module_data ('Software', \%modules); @@ -410,12 +567,12 @@ if ($enable_all == 1 || $enabled{'software'} == 1) { #init_services if ($enable_all == 1 || $enabled{'init_services'} == 1) { - get_servicies_init_machine ('Init services', \%modules); + get_servicies_init_machine ('Init_services', \%modules); } #filesystem if ($enable_all == 1 || $enabled{'filesystem'} == 1) { - get_file_system('File system', \%modules); + get_file_system('Filesystem', \%modules); } #processes @@ -442,7 +599,6 @@ if ($enable_all == 1 || $enabled{'route'} == 1) { if ($enable_all == 1 || $enabled{'kernel'} == 1){ get_kernel_info ('Kernel', \%modules); } - # Print module data print "\n"; while (my ($name, $module) = each (%modules)) { diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index fde60f636c..a964fdec1e 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{190506} +{190510} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index bab5b469e0..ff4e0beb79 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 ("7.0NG.734(Build 190506)") +#define PANDORA_VERSION ("7.0NG.734(Build 190510)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index ba6b3b086f..88eb352bc8 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", "(7.0NG.734(Build 190506))" + VALUE "ProductVersion", "(7.0NG.734(Build 190510))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index cf89c4c8d6..6b3a3f7da5 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.734-190506 +Version: 7.0NG.734-190510 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 460c63c392..04b9f9bf47 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="7.0NG.734-190506" +pandora_version="7.0NG.734-190510" package_pear=0 package_pandora=1 diff --git a/pandora_console/extras/mr/28.sql b/pandora_console/extras/mr/28.sql new file mode 100644 index 0000000000..e4dfe8fe9b --- /dev/null +++ b/pandora_console/extras/mr/28.sql @@ -0,0 +1,5 @@ +START TRANSACTION; + +DELETE FROM `tevent_response` WHERE `name` LIKE 'Create Integria IMS incident from event'; + +COMMIT; diff --git a/pandora_console/extras/pandora_diag.php b/pandora_console/extras/pandora_diag.php index 10e9fbfd42..34cfac8ea4 100644 --- a/pandora_console/extras/pandora_diag.php +++ b/pandora_console/extras/pandora_diag.php @@ -122,7 +122,7 @@ function execution_time() if ($times[0]['datos'] > ($times[1]['datos'] * 1.2)) { return "Warning Status   The execution time could be degrading. For a more extensive information of this data consult the Execution Time graph"; } else { - return "Normal Status   The execution time is correct. For a more extensive information of this data consult the Execution Time graph"; + return "Normal Status   The execution time is correct. For more information about this data, check the Execution Time graph"; } } @@ -173,9 +173,9 @@ function license_capacity() $status_license_capacity = ''; $current_count = db_get_value_sql('SELECT count(*) FROM tagente'); if ($current_count > ($license_limit * 90 / 100)) { - $status_license_capacity = "Warning Status   The license capacity is more than 90 percent"; + $status_license_capacity = "Warning Status   License capacity exceeds 90 percent"; } else { - $status_license_capacity = "Normal Status   The license capacity is less than 90 percent"; + $status_license_capacity = "Normal Status   License capacity is less than 90 percent"; } return $status_license_capacity; @@ -202,9 +202,9 @@ function interval_average_of_network_modules() $average_time = ((int) $total_module_interval_time / $total_network_modules); if ($average_time < 180) { - $status_average_modules = "Warning Status   The system has a lot of load (average time $average_time) and a very fine configuration is required"; + $status_average_modules = "Warning Status   The system is overloaded (average time $average_time) and a very fine configuration is required"; } else { - $status_average_modules = "Normal Status   The system has an acceptable charge (average time $average_time) "; + $status_average_modules = "Normal Status   The system is not overloaded (average time $average_time) "; } if ($average_time == 0) { @@ -221,9 +221,9 @@ $attachment_total_files = count(glob($config['homedir'].'/attachment/{*.*}', GLO function files_attachment_folder($total_files) { if ($total_files <= 700) { - $status_total_files = "Normal Status   The attachment folder has less than 700 files."; + $status_total_files = "Normal Status   The attached folder contains less than 700 files."; } else { - $status_total_files = "Warning Status   The attachment folder has more than 700 files."; + $status_total_files = "Warning Status   The attached folder contains more than 700 files."; } return $status_total_files; @@ -236,9 +236,9 @@ $tagente_datos_size = db_get_value_sql('SELECT COUNT(*) FROM tagente_datos'); function status_tagente_datos($tagente_datos_size) { if ($tagente_datos_size <= 3000000) { - $tagente_datos_size = "Normal Status   The tagente_datos table has an acceptable amount of data."; + $tagente_datos_size = "Normal Status   The tagente_datos table contains an acceptable amount of data."; } else { - $tagente_datos_size = "Warning Status   The tagente_datos table has too much data. A historical database is recommended."; + $tagente_datos_size = "Warning Status   The tagente_datos table contains too much data. A historical database is recommended."; } return $tagente_datos_size; @@ -302,9 +302,9 @@ function status_fragmentation_tables($tables_fragmentation_max_rec_value, $table { $status_tables_frag = ''; if ($tables_fragmentation > $tables_fragmentation_max_rec_value) { - $status_tables_frag = "Warning Status   The fragmentation tables is higher than recommended. You should defragment them."; + $status_tables_frag = "Warning Status   Table fragmentation is higher than recommended. They should be defragmented."; } else { - $status_tables_frag = "Normal Status   The fragmentation tables is correct."; + $status_tables_frag = "Normal Status   Table fragmentation is correct."; } return $status_tables_frag; @@ -320,9 +320,9 @@ if ($console_mode == 1) { echo "\nPandora FMS PHP diagnostic tool v3.2 (c) Artica ST 2009-2010 \n"; if ($argc == 1 || in_array($argv[1], ['--help', '-help', '-h', '-?'])) { - echo "\nThis command line script gives information about Pandora FMS database. -This program only can be executed from console, and need a parameter, the -full path to Pandora FMS 'config.php' file. + echo "\nThis command line script contains information about Pandora FMS database. + This program can only be executed from the console, and it needs a parameter, the + full path to Pandora FMS 'config.php' file. Usage: php pandora_diag.php path_to_pandora_console @@ -705,7 +705,7 @@ render_info_data( render_row($tables_fragmentation_max_rec_value.'%', 'Tables fragmentation (maximum recommended value)'); render_row(number_format($tables_fragmentation, 2).'%', 'Tables fragmentation (current value)'); - render_row(status_fragmentation_tables($tables_fragmentation_max_rec_value, $tables_fragmentation), 'Status fragmentation tables'); + render_row(status_fragmentation_tables($tables_fragmentation_max_rec_value, $tables_fragmentation), 'Table fragmentation status'); echo "".__(' Pandora FMS logs dates').''; @@ -734,14 +734,14 @@ render_info_data( echo "".__(' Status of the attachment folder').''; - render_row($attachment_total_files, 'Total files in the attachment folder'); + render_row($attachment_total_files, 'Total files in the attached folder'); render_row(files_attachment_folder($attachment_total_files), 'Status of the attachment folder'); echo "".__(' Information from the tagente_datos table').''; - render_row($tagente_datos_size, 'Total data in the tagente_datos table'); - render_row(status_tagente_datos($tagente_datos_size), 'Status of the tagente_datos table'); - render_row(execution_time(), 'Degradation of the execution time when executing a count'); + render_row($tagente_datos_size, 'Total data in tagente_datos table'); + render_row(status_tagente_datos($tagente_datos_size), 'Tangente_datos table status'); + render_row(execution_time(), 'Execution time degradation when executing a count'); echo "".__(' Pandora FMS server threads').''; @@ -784,6 +784,6 @@ render_info_data( echo "
"; echo ''.__( - '(*) Please check your Pandora Server setup and be sure that database maintenance daemon is running. It\' very important to -keep up-to-date database to get the best performance and results in Pandora' + '(*) Please check your Pandora Server setup and make sure that the database maintenance daemon is running. It\' is very important to + keep the database up-to-date to get the best performance and results in Pandora' ).'


'; diff --git a/pandora_console/godmode/agentes/configurar_agente.php b/pandora_console/godmode/agentes/configurar_agente.php index 22839d9fb5..35674550b3 100644 --- a/pandora_console/godmode/agentes/configurar_agente.php +++ b/pandora_console/godmode/agentes/configurar_agente.php @@ -1080,7 +1080,7 @@ if ($id_agente) { exit; } - $agent = db_get_row('tagente', 'id_agente', $id_agente); + $agent = db_get_row('tagente', 'id_agente', $id_agente, false, false); if (empty($agent)) { // Close out the page. ui_print_error_message(__('There was a problem loading the agent')); diff --git a/pandora_console/godmode/agentes/module_manager_editor_common.php b/pandora_console/godmode/agentes/module_manager_editor_common.php index 1724ee6622..85114161b6 100644 --- a/pandora_console/godmode/agentes/module_manager_editor_common.php +++ b/pandora_console/godmode/agentes/module_manager_editor_common.php @@ -1170,6 +1170,7 @@ html_print_input_hidden('module_relations_count', $relations_count); ui_require_jquery_file('json'); + ?> '; - } } diff --git a/pandora_console/godmode/wizards/Wizard.main.php b/pandora_console/godmode/wizards/Wizard.main.php index 9bdee3b001..dab50570f9 100644 --- a/pandora_console/godmode/wizards/Wizard.main.php +++ b/pandora_console/godmode/wizards/Wizard.main.php @@ -661,22 +661,25 @@ class Wizard $output_submit = ''; $output = ''; - if ($print_white_box === true) + if ($print_white_box === true) { $output .= '
'; + } $output .= '
    '; foreach ($inputs as $input) { - if ($input['arguments']['type']!='submit') + if ($input['arguments']['type'] != 'submit') { $output .= $this->printBlock($input, true); - else + } else { $output_submit .= $this->printBlock($input, true); + } } $output .= '
'; - if ($print_white_box === true) + if ($print_white_box === true) { $output .= '
'; + } $output .= ''; $output .= ''; diff --git a/pandora_console/images/icon_error_db.png b/pandora_console/images/icon_error_db.png new file mode 100644 index 0000000000..1aad380c2f Binary files /dev/null and b/pandora_console/images/icon_error_db.png differ diff --git a/pandora_console/images/icon_error_mr.png b/pandora_console/images/icon_error_mr.png new file mode 100644 index 0000000000..d1e33eed42 Binary files /dev/null and b/pandora_console/images/icon_error_mr.png differ diff --git a/pandora_console/images/icon_info_mr.png b/pandora_console/images/icon_info_mr.png new file mode 100644 index 0000000000..4c0abb0585 Binary files /dev/null and b/pandora_console/images/icon_info_mr.png differ diff --git a/pandora_console/images/icon_success_db.png b/pandora_console/images/icon_success_db.png new file mode 100644 index 0000000000..38511ca06e Binary files /dev/null and b/pandora_console/images/icon_success_db.png differ diff --git a/pandora_console/images/icon_success_mr.png b/pandora_console/images/icon_success_mr.png new file mode 100644 index 0000000000..39c72ea9a1 Binary files /dev/null and b/pandora_console/images/icon_success_mr.png differ diff --git a/pandora_console/images/icon_warning_db.png b/pandora_console/images/icon_warning_db.png new file mode 100644 index 0000000000..f89a7f51b0 Binary files /dev/null and b/pandora_console/images/icon_warning_db.png differ diff --git a/pandora_console/images/update_manager_background.jpg b/pandora_console/images/update_manager_background.jpg new file mode 100644 index 0000000000..121e476860 Binary files /dev/null and b/pandora_console/images/update_manager_background.jpg differ diff --git a/pandora_console/images/update_manager_button.png b/pandora_console/images/update_manager_button.png new file mode 100644 index 0000000000..b18b218d78 Binary files /dev/null and b/pandora_console/images/update_manager_button.png differ diff --git a/pandora_console/include/ajax/events.php b/pandora_console/include/ajax/events.php index 6b7be8eb28..6ba163c7ed 100644 --- a/pandora_console/include/ajax/events.php +++ b/pandora_console/include/ajax/events.php @@ -418,15 +418,15 @@ if ($get_extended_event) { } // Tabs. - $tabs = "