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:
parent
fd549b9324
commit
f4ab620a23
|
@ -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>
|
||||
|
||||
* pandora_agent: Added support to the new fields of the
|
||||
|
|
|
@ -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 => {
|
||||
|
|
|
@ -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 = <RELEASE_FILE>;
|
||||
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 <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;
|
||||
}
|
||||
|
||||
|
@ -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 "<inventory>\n";
|
||||
while (my ($name, $module) = each (%modules)) {
|
||||
|
|
|
@ -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>"
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
echo "<module>";
|
||||
echo "<name>who</name>";
|
||||
echo "<type>generic_data_string</type>";
|
||||
echo "<data><![CDATA["
|
||||
who
|
||||
echo "]]></data>"
|
||||
echo "</module>"
|
||||
|
Loading…
Reference in New Issue