2009-12-07 Sancho Lerena <slerena@artica.es>
* plugins/inventory: Fixed some problems with the plugin (for * linux). Added inventory for RPM systems. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2166 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
84c608d9ad
commit
d60e0e9360
|
@ -1,3 +1,8 @@
|
|||
2009-12-07 Sancho Lerena <slerena@artica.es>
|
||||
|
||||
* plugins/inventory: Fixed some problems with the plugin (for linux). Added
|
||||
inventory for RPM systems.
|
||||
|
||||
2009-12-03 Ramon Novoa <rnovoa@artica.es>
|
||||
|
||||
* pandora_agent: Empty modules and plugins before loading a remote
|
||||
|
|
|
@ -135,19 +135,27 @@ sub get_software_module_data ($$) {
|
|||
my ($name, $modules) = @_;
|
||||
|
||||
# Guess the current distribution
|
||||
open (RELEASE_FILE, '< /etc/lsb-release') or return;
|
||||
my $distrib_id = <RELEASE_FILE>;
|
||||
last unless ($distrib_id =~ m/DISTRIB_ID\s*=\s*(\S+)/);
|
||||
$distrib_id = $1;
|
||||
my $distrib_id = "";
|
||||
|
||||
if ( -e "/etc/SuSE-release"){
|
||||
$distrib_id = "SUSE";
|
||||
} else {
|
||||
open (RELEASE_FILE, '< /etc/lsb-release') or return;
|
||||
$distrib_id = <RELEASE_FILE>;
|
||||
last unless ($distrib_id =~ m/DISTRIB_ID\s*=\s*(\S+)/);
|
||||
$distrib_id = $1;
|
||||
}
|
||||
|
||||
# List installed programs
|
||||
my @soft;
|
||||
if ($distrib_id eq 'Ubuntu') {
|
||||
@soft = `dpkg -l | grep ii`;
|
||||
} else {
|
||||
return;
|
||||
|
||||
@soft = `rpm -q -a --qf "ii\t%{NAME}\t%{VERSION}\t%{SUMMARY}\n"`;
|
||||
}
|
||||
|
||||
|
||||
# Parse data
|
||||
foreach my $row (@soft) {
|
||||
next unless ($row =~ /^ii\s+(\S+)\s+(\S+)\s+([^\n]+)/);
|
||||
|
@ -157,7 +165,6 @@ sub get_software_module_data ($$) {
|
|||
$module{'version'} = $2;
|
||||
$module{'description'} = $3;
|
||||
$module{'_keys'} = ['program', 'version','description'];
|
||||
|
||||
push (@{$modules->{$name}}, \%module);
|
||||
}
|
||||
}
|
||||
|
@ -191,9 +198,18 @@ if ($#ARGV < 0) {
|
|||
|
||||
# Parse command line parameters
|
||||
my %enabled;
|
||||
my $enable_all = ($#ARGV > 0 ? 0 : 1);
|
||||
my $interval = shift (@ARGV);
|
||||
foreach my $module (@ARGV) {
|
||||
my $interval = 1;
|
||||
my $enable_all = 0;
|
||||
|
||||
$interval = $ARGV[0];
|
||||
if ($#ARGV == 0){
|
||||
$enable_all = 1;
|
||||
}
|
||||
|
||||
foreach my $module (@ARGV) {
|
||||
if ($module eq "all"){
|
||||
$enable_all = 1;
|
||||
}
|
||||
$enabled{$module} = 1;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue