Commit c4ecae88 authored by mape2k's avatar mape2k
Browse files

Stop with critical exit code and error message if no device given


git-svn-id: https://subversion.fem.tu-ilmenau.de/repository/nagios@34 0c029375-f9a5-47ba-aa0c-8883c34e326a
parent 9d39fb8f
......@@ -3,13 +3,14 @@
# S.M.A.R.T bad sector check plugin for Nagios
# Copyright (c) 2008-2015 Forschungsgemeinschaft elektronische Medien e.V. (FeM e.V.)"
# Written by Marcel Pennewiss (opensource@pennewiss.de)
# Last Modified: 2015-08-15
# Last Modified: 2015-09-03
# Changelog
# 0.1 - initial release
# 0.2 - changed warning/critical treshold
# 0.2-r1 - check for setuid-bit or user root
# 0.3 - add performance data
# 0.3.1 - check parameters for device
NAGIOS_OK=0
NAGIOS_WARNING=1
......@@ -24,7 +25,7 @@ PROGRAM_WHOAMI=$(which whoami)
# set default values
defaults() {
VERSION="0.3"
VERSION="0.3.1"
WARNING=1
WARNING_REALLOCATED=${WARNING}
WARNING_CURRENT_PENDING=${WARNING}
......@@ -75,6 +76,12 @@ checksystem() {
exit ${NAGIOS_WARNING}
fi
# check if device is given
if [ -z $1 ]; then
echo "SMART CRITICAL - No device as parameter given."
exit ${NAGIOS_CRITICAL}
fi
# check if device is special block device
if [ ! -b $1 ]; then
echo "SMART WARNING - Device $1 is not a special block device"
......@@ -218,7 +225,7 @@ while getopts ":hd:t:w:c:V" Option; do
pending) OPTION=${OPTARG};;
uncorrectable) OPTION=${OPTARG};;
allsectors) OPTION=${OPTARG};;
*) echo "SMART UNKNWON - unknown check type. See help."
*) echo "SMART UNKNOWN - unknown check type. See help."
print_usage
exit ${NAGIOS_UNKNOW}
;;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment