diff --git a/pandora_agents/ChangeLog b/pandora_agents/ChangeLog index bfe352ef53..1870232cc3 100644 --- a/pandora_agents/ChangeLog +++ b/pandora_agents/ChangeLog @@ -1,3 +1,10 @@ +2014-05-21 Vanessa Gil + + * pc/plugins/pandora_df + shellscript/linux/plugins/pandora_df + unix/plugins/pandora_df: Applied patch + 'pandora_fs.excludefs.patch'. + 2014-05-20 Vanessa Gil * win32/bin/pandora_agent.conf: Fixed typographic error. diff --git a/pandora_agents/pc/plugins/pandora_df b/pandora_agents/pc/plugins/pandora_df index e54069685d..59e04719cc 100644 --- a/pandora_agents/pc/plugins/pandora_df +++ b/pandora_agents/pc/plugins/pandora_df @@ -6,7 +6,8 @@ # # pandora_df Retrieve filesystem disk usage. By default information for all # filesystems is returned, but one or more filesystems may be -# specified as command line parameters. +# specified as command line parameters. If parameter start with +# a '-', the filesystem is excluded from results. # # Sample usage: ./pandora_df tmpfs /dev/sda1 # @@ -33,8 +34,19 @@ if ($#ARGV < 0) { # Parse command line parameters my %filesystems; +my %excluded_filesystems; +my $onlyexclude = 1; foreach my $fs (@ARGV) { - $filesystems{$fs} = '-1%'; + if (substr($fs,0,1) eq '-') { + $excluded_filesystems{substr($fs,1,)} = '-1%'; + } else { + $filesystems{$fs} = '-1%'; + $onlyexclude = 0; + } +} + +if ($onlyexclude) { + $all_filesystems = 1; } # Retrieve filesystem information @@ -51,7 +63,9 @@ if ($#df < 0) { foreach my $row (@df) { my @columns = split (' ', $row); exit 1 if ($#columns < 4); - $filesystems{$columns[0]} = $columns[4] if (defined ($filesystems{$columns[0]}) || $all_filesystems == 1); + if (defined ($filesystems{$columns[0]}) || ($all_filesystems == 1 && !defined ($excluded_filesystems{$columns[0]}))) { + $filesystems{$columns[0]} = $columns[4] ; + } } while (my ($filesystem, $use) = each (%filesystems)) { diff --git a/pandora_agents/shellscript/linux/plugins/pandora_df b/pandora_agents/shellscript/linux/plugins/pandora_df index e54069685d..59e04719cc 100755 --- a/pandora_agents/shellscript/linux/plugins/pandora_df +++ b/pandora_agents/shellscript/linux/plugins/pandora_df @@ -6,7 +6,8 @@ # # pandora_df Retrieve filesystem disk usage. By default information for all # filesystems is returned, but one or more filesystems may be -# specified as command line parameters. +# specified as command line parameters. If parameter start with +# a '-', the filesystem is excluded from results. # # Sample usage: ./pandora_df tmpfs /dev/sda1 # @@ -33,8 +34,19 @@ if ($#ARGV < 0) { # Parse command line parameters my %filesystems; +my %excluded_filesystems; +my $onlyexclude = 1; foreach my $fs (@ARGV) { - $filesystems{$fs} = '-1%'; + if (substr($fs,0,1) eq '-') { + $excluded_filesystems{substr($fs,1,)} = '-1%'; + } else { + $filesystems{$fs} = '-1%'; + $onlyexclude = 0; + } +} + +if ($onlyexclude) { + $all_filesystems = 1; } # Retrieve filesystem information @@ -51,7 +63,9 @@ if ($#df < 0) { foreach my $row (@df) { my @columns = split (' ', $row); exit 1 if ($#columns < 4); - $filesystems{$columns[0]} = $columns[4] if (defined ($filesystems{$columns[0]}) || $all_filesystems == 1); + if (defined ($filesystems{$columns[0]}) || ($all_filesystems == 1 && !defined ($excluded_filesystems{$columns[0]}))) { + $filesystems{$columns[0]} = $columns[4] ; + } } while (my ($filesystem, $use) = each (%filesystems)) { diff --git a/pandora_agents/unix/plugins/pandora_df b/pandora_agents/unix/plugins/pandora_df index e54069685d..59e04719cc 100755 --- a/pandora_agents/unix/plugins/pandora_df +++ b/pandora_agents/unix/plugins/pandora_df @@ -6,7 +6,8 @@ # # pandora_df Retrieve filesystem disk usage. By default information for all # filesystems is returned, but one or more filesystems may be -# specified as command line parameters. +# specified as command line parameters. If parameter start with +# a '-', the filesystem is excluded from results. # # Sample usage: ./pandora_df tmpfs /dev/sda1 # @@ -33,8 +34,19 @@ if ($#ARGV < 0) { # Parse command line parameters my %filesystems; +my %excluded_filesystems; +my $onlyexclude = 1; foreach my $fs (@ARGV) { - $filesystems{$fs} = '-1%'; + if (substr($fs,0,1) eq '-') { + $excluded_filesystems{substr($fs,1,)} = '-1%'; + } else { + $filesystems{$fs} = '-1%'; + $onlyexclude = 0; + } +} + +if ($onlyexclude) { + $all_filesystems = 1; } # Retrieve filesystem information @@ -51,7 +63,9 @@ if ($#df < 0) { foreach my $row (@df) { my @columns = split (' ', $row); exit 1 if ($#columns < 4); - $filesystems{$columns[0]} = $columns[4] if (defined ($filesystems{$columns[0]}) || $all_filesystems == 1); + if (defined ($filesystems{$columns[0]}) || ($all_filesystems == 1 && !defined ($excluded_filesystems{$columns[0]}))) { + $filesystems{$columns[0]} = $columns[4] ; + } } while (my ($filesystem, $use) = each (%filesystems)) {