willixix/WL-NagiosPlugins — pull request #15 by bpat (2013-01-23 13:17:55+00:00)
Title: check_files.pl: now able to sum the size of files (can do it using SSH) and search which file is bigger.

Hello,

Here is some modifications we did on the script check_files.pl, we wanted to share this change with you ;-)

The script can check the size sum of searched files with "-S". It can also returns the biggest
file from a list and with "-H" it can execute ls command remotly on a host using SSH.

**Here are the changes:**

- Added a new argument "-S [warn,crit]" to show the sum of the size of selected
files.
- Added a new argument "-s [warn,crit]" to search for selected files which one
is bigger.
- Performance data suppport for these new checks.
- Added a new argument "-H " to execute the ls command on a remote
host using SSH (used for host that does not have all Perl dependencies). Only
public-key auth is supported.

**Examples:**

_Compute the sum size of files:_

$ ./check_files.pl -D /opt/oradata -F"t" -f -S -H "10.224.20.48"
OK - Sum of file sizes is 3897 octet, 2 t files found | 't'=2 size_sum=3897o

_Search largest file:_

$ ./check_files.pl -D /opt/oradata -F"t" -f -s -H "10.224.20.48"
OK - Largest size file is 3896 octet, 2 t files found | 't'=2 size_largest=3896o size_smallest=1o

_Combined:_

$ ./check_files.pl -D /opt/oradata -F"t" -f -S -s -H "10.224.20.48"
OK - Largest size file is 3896 octet, Sum of file sizes is 3897 octet, 2 t files found | 't'=2 size_largest=3896o size_smallest=1o size_sum=3897o

Warning and Critical thresholds can also be set.

Bye,
Patrick