2012-12-17 Sancho Lerena <slerena@artica.es>

* 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.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7290 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
slerena 2012-12-17 16:33:15 +00:00
parent eaee64f417
commit 9c8d0c052e
5 changed files with 52 additions and 10 deletions

View File

@ -1,3 +1,13 @@
2012-12-17 Sancho Lerena <slerena@artica.es>
* 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 <sergio.martin@artica.es> 2012-11-15 Sergio Martin <sergio.martin@artica.es>
* pandora_agent: Added support to the new fields of the * pandora_agent: Added support to the new fields of the

View File

@ -12,7 +12,7 @@ pandora_agent - Pandora FMS Agent
=head1 VERSION =head1 VERSION
Version 4.0 Version 5.0
=head1 USAGE =head1 USAGE
@ -41,7 +41,7 @@ my $Sem = undef;
my $ThreadSem = undef; my $ThreadSem = undef;
use constant AGENT_VERSION => '5.0dev'; use constant AGENT_VERSION => '5.0dev';
use constant AGENT_BUILD => '120621'; use constant AGENT_BUILD => '121217';
# Commands to retrieve total memory information in kB # Commands to retrieve total memory information in kB
use constant TOTALMEMORY_CMDS => { use constant TOTALMEMORY_CMDS => {

View File

@ -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 # Get a list of installed programs
sub get_software_module_data ($$) { sub get_software_module_data ($$) {
my ($name, $modules) = @_; my ($name, $modules) = @_;
@ -160,21 +172,20 @@ sub get_software_module_data ($$) {
my $distrib_id = ""; my $distrib_id = "";
if ( -e "/etc/SuSE-release"){ if ( -e "/etc/SuSE-release"){
$distrib_id = "SUSE"; $distrib_id = "SUSE";
} elsif ( -e "/etc/redhat-release"){
$distrib_id = "REDHAT";
} else { } else {
open (RELEASE_FILE, '< /etc/lsb-release') or return; $distrib_id = "DEBIAN";
$distrib_id = <RELEASE_FILE>;
last unless ($distrib_id =~ m/DISTRIB_ID\s*=\s*(\S+)/);
$distrib_id = $1;
} }
# List installed programs # List installed programs
my @soft; my @soft;
if ($distrib_id eq 'Ubuntu') { if ($distrib_id eq 'DEBIAN') {
@soft = `dpkg -l | grep ii`; @soft = `dpkg -l | grep ii`;
} else { } 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 # Check command line parameters
if ($#ARGV < 0) { if ($#ARGV < 0) {
print "Usage: $0 <interval> [cpu] [ram] [video] [nic] [hd] [cdrom] [software] [init_services] [filesystem] [users] [process] [ip] [route]\n\n"; print "Usage: $0 <interval> [cpu] [ram] [video] [nic] [hd] [cdrom] [software] [init_services] [filesystem] [users] [process] [ip] [route] [kernel] \n\n";
exit 1; exit 1;
} }
@ -425,6 +436,11 @@ if ($enable_all == 1 || $enabled{'route'} == 1) {
get_route_table('Routes', \%modules); get_route_table('Routes', \%modules);
} }
#kernel
if ($enable_all == 1 || $enabled{'kernel'} == 1){
get_kernel_info ('Kernel', \%modules);
}
# Print module data # Print module data
print "<inventory>\n"; print "<inventory>\n";
while (my ($name, $module) = each (%modules)) { while (my ($name, $module) = each (%modules)) {

View File

@ -0,0 +1,8 @@
echo "<module>";
echo "<name>top</name>";
echo "<type>generic_data_string</type>";
echo "<data><![CDATA["
top -b -n 1
echo "]]></data>"
echo "</module>"

View File

@ -0,0 +1,8 @@
echo "<module>";
echo "<name>who</name>";
echo "<type>generic_data_string</type>";
echo "<data><![CDATA["
who
echo "]]></data>"
echo "</module>"