Imported Upstream version 1.4.16+git20130902

This commit is contained in:
Jan Wagner 2013-11-26 23:59:47 +01:00
parent e76be63abf
commit e70fb8c051
517 changed files with 44015 additions and 43295 deletions

File diff suppressed because it is too large Load diff

View file

@ -176,7 +176,7 @@ $SIG{'ALRM'} = sub {
};
alarm($TIMEOUT);
# Execute an "ls" on the share using smbclient program
# Execute a "du" on the share using smbclient program
# get the results into $res
my @cmd = (
$smbclient,
@ -185,7 +185,7 @@ my @cmd = (
defined($workgroup) ? ("-W", $workgroup) : (),
defined($address) ? ("-I", $address) : (),
defined($opt_P) ? ("-p", $opt_P) : (),
"-c", "ls"
"-c", "du"
);
print join(" ", @cmd) . "\n" if ($verbose);
@ -198,7 +198,7 @@ alarm(0);
@lines = split /\n/, $res;
#Get the last line into $_
$_ = $lines[$#lines];
$_ = $lines[$#lines-1];
#print "$_\n";
#Process the last line to get free space.

View file

@ -18,6 +18,7 @@ print_usage() {
echo " $PROGNAME --tns <Oracle Sid or Hostname/IP address>"
echo " $PROGNAME --db <ORACLE_SID>"
echo " $PROGNAME --login <ORACLE_SID>"
echo " $PROGNAME --connect <ORACLE_SID>"
echo " $PROGNAME --cache <ORACLE_SID> <USER> <PASS> <CRITICAL> <WARNING>"
echo " $PROGNAME --tablespace <ORACLE_SID> <USER> <PASS> <TABLESPACE> <CRITICAL> <WARNING>"
echo " $PROGNAME --oranames <Hostname>"
@ -39,6 +40,8 @@ print_help() {
echo " filesystem for sgadefORACLE_SID.dbf"
echo "--login SID"
echo " Attempt a dummy login and alert if not ORA-01017: invalid username/password"
echo "--connect SID"
echo " Attempt a login and alert if an ORA- error is returned"
echo "--cache"
echo " Check local database for library and buffer cache hit ratios"
echo " ---> Requires Oracle user/password and SID specified."
@ -187,6 +190,18 @@ case "$cmd" in
exit $STATE_CRITICAL
fi
;;
--connect)
connectchk=`sqlplus $2 < /dev/null`
connectchk2=` echo $connectchk | grep -c ORA-`
if [ ${connectchk2} -eq 0 ] ; then
echo "OK - login successful"
exit $STATE_OK
else
connectchk3=` echo "$connectchk" | grep "ORA-" | head -1`
echo "CRITICAL - $connectchk3"
exit $STATE_CRITICAL
fi
;;
--cache)
if [ ${5} -gt ${6} ] ; then
echo "UNKNOWN - Warning level is less then Crit"

View file

@ -44,25 +44,28 @@ case "$1" in
*)
sensordata=`sensors 2>&1`
status=$?
if test ${status} -eq 127; then
text="SENSORS UNKNOWN - command not found (did you install lmsensors?)"
exit=$STATE_UNKNOWN
elif test ${status} -ne 0; then
text="WARNING - sensors returned state $status"
exit=$STATE_WARNING
elif echo ${sensordata} | egrep ALARM > /dev/null; then
text="SENSOR CRITICAL - Sensor alarm detected!"
exit=$STATE_CRITICAL
elif echo ${sensordata} | egrep FAULT > /dev/null \
&& test "$1" != "-i" -a "$1" != "--ignore-fault"; then
text="SENSOR UNKNOWN - Sensor reported fault"
exit=$STATE_UNKNOWN
else
text="SENSORS OK"
exit=$STATE_OK
fi
echo "$text"
if test "$1" = "-v" -o "$1" = "--verbose"; then
echo ${sensordata}
fi
if test ${status} -eq 127; then
echo "SENSORS UNKNOWN - command not found (did you install lmsensors?)"
exit $STATE_UNKNOWN
elif test ${status} -ne 0; then
echo "WARNING - sensors returned state $status"
exit $STATE_WARNING
fi
if echo ${sensordata} | egrep ALARM > /dev/null; then
echo SENSOR CRITICAL - Sensor alarm detected!
exit $STATE_CRITICAL
elif echo ${sensordata} | egrep FAULT > /dev/null \
&& test "$1" != "-i" -a "$1" != "--ignore-fault"; then
echo SENSOR UNKNOWN - Sensor reported fault
exit $STATE_UNKNOWN
fi
echo sensor ok
exit $STATE_OK
exit $exit
;;
esac

View file

@ -23,7 +23,16 @@ support() {
#
# check_range takes a value and a range string, returning successfully if an
# alert should be raised based on the range.
# alert should be raised based on the range. Range values are inclusive.
# Values may be integers or floats.
#
# Example usage:
#
# Generating an exit code of 1:
# check_range 5 2:8
#
# Generating an exit code of 0:
# check_range 1 2:8
#
check_range() {
local v range yes no err decimal start end cmp match