diff --git a/pandora_agents/unix/ChangeLog b/pandora_agents/unix/ChangeLog index b4fa2d14c3..365f35fe07 100644 --- a/pandora_agents/unix/ChangeLog +++ b/pandora_agents/unix/ChangeLog @@ -1,3 +1,13 @@ +2012-12-17 Sancho Lerena + + * pandora_agent: Updated version + + * plugins/who.sh, + plugins/top.sh: New plugins for command snapshots. + + * plugins/inventory: Merged with fixes and new kernel module from + 4.0.3 branch. Tested on Redhat and SUSE. + 2012-11-15 Sergio Martin * pandora_agent: Added support to the new fields of the diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index 7088cbd60d..bade52ecf5 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -12,7 +12,7 @@ pandora_agent - Pandora FMS Agent =head1 VERSION -Version 4.0 +Version 5.0 =head1 USAGE @@ -41,7 +41,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '5.0dev'; -use constant AGENT_BUILD => '120621'; +use constant AGENT_BUILD => '121217'; # Commands to retrieve total memory information in kB use constant TOTALMEMORY_CMDS => { diff --git a/pandora_agents/unix/plugins/inventory b/pandora_agents/unix/plugins/inventory index 18f675869c..a121632f07 100755 --- a/pandora_agents/unix/plugins/inventory +++ b/pandora_agents/unix/plugins/inventory @@ -152,6 +152,18 @@ sub get_users ($$) { } } +# Show Kernel Information +sub get_kernel_info ($$) { + my ($name, $modules) = @_; + my $script = `uname -a | tr -d \";\"`; + my %module; + + $module{'Kernel'} = $script; + $module{'_keys'} = ['Kernel']; + push (@{$modules->{$name}}, \%module); +} + + # Get a list of installed programs sub get_software_module_data ($$) { my ($name, $modules) = @_; @@ -160,21 +172,20 @@ sub get_software_module_data ($$) { my $distrib_id = ""; if ( -e "/etc/SuSE-release"){ - $distrib_id = "SUSE"; + $distrib_id = "SUSE"; + } elsif ( -e "/etc/redhat-release"){ + $distrib_id = "REDHAT"; } else { - open (RELEASE_FILE, '< /etc/lsb-release') or return; - $distrib_id = ; - last unless ($distrib_id =~ m/DISTRIB_ID\s*=\s*(\S+)/); - $distrib_id = $1; + $distrib_id = "DEBIAN"; } # List installed programs my @soft; - if ($distrib_id eq 'Ubuntu') { + if ($distrib_id eq 'DEBIAN') { @soft = `dpkg -l | grep ii`; } else { - @soft = `rpm -q -a --qf "ii\t%{NAME}\t%{VERSION}\t%{SUMMARY}\n"`; + @soft = `rpm -q -a --qf "ii %{NAME} %{VERSION} %{SUMMARY}\n"`; } @@ -285,7 +296,7 @@ sub print_module ($$) { # Check command line parameters if ($#ARGV < 0) { - print "Usage: $0 [cpu] [ram] [video] [nic] [hd] [cdrom] [software] [init_services] [filesystem] [users] [process] [ip] [route]\n\n"; + print "Usage: $0 [cpu] [ram] [video] [nic] [hd] [cdrom] [software] [init_services] [filesystem] [users] [process] [ip] [route] [kernel] \n\n"; exit 1; } @@ -425,6 +436,11 @@ if ($enable_all == 1 || $enabled{'route'} == 1) { get_route_table('Routes', \%modules); } +#kernel +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/unix/plugins/top.sh b/pandora_agents/unix/plugins/top.sh new file mode 100755 index 0000000000..35e1b5161b --- /dev/null +++ b/pandora_agents/unix/plugins/top.sh @@ -0,0 +1,8 @@ +echo ""; +echo "top"; +echo "generic_data_string"; +echo "" +echo "" + diff --git a/pandora_agents/unix/plugins/who.sh b/pandora_agents/unix/plugins/who.sh new file mode 100755 index 0000000000..5df4b2e581 --- /dev/null +++ b/pandora_agents/unix/plugins/who.sh @@ -0,0 +1,8 @@ +echo ""; +echo "who"; +echo "generic_data_string"; +echo "" +echo "" +