Parameter "--bad-output-only" ergänzt
This commit is contained in:
parent
e9a65fbbd6
commit
934adecce2
@ -34,6 +34,7 @@ function hilfetext(){
|
||||
--fahrenheit Display all temperatures in degree fahrenheit
|
||||
--sensor_hex Output of the Hex-Sensors (default)
|
||||
--sensor_nr Output of the Sensor-Numbers
|
||||
--bad-output-only List only the warning and critical values
|
||||
-p | --perfdata show Performancedata
|
||||
-h | --help Print this Help
|
||||
|
||||
@ -42,7 +43,7 @@ function hilfetext(){
|
||||
|
||||
function ParameterEvaluation(){
|
||||
|
||||
options=$(getopt -o s:S:w:c:lph --long config: --long sensor: --long warn: --long crit: --long list --long celsius --long fahrenheit --long sensor_hex --long sensor_nr --long perfdata --long help -- "$@")
|
||||
options=$(getopt -o s:S:w:c:lph --long config: --long sensor: --long warn: --long crit: --long list --long celsius --long fahrenheit --long sensor_hex --long sensor_nr --long perfdata --long help --long bad-output-only -- "$@")
|
||||
|
||||
#Option nicht verfügbar
|
||||
[ "$?" -eq "0" ] || {
|
||||
@ -92,6 +93,10 @@ function ParameterEvaluation(){
|
||||
"--sensor_nr")
|
||||
DISPLAY_SENSOR_NR="1"
|
||||
;;
|
||||
"--bad-output-only")
|
||||
DISPLAY_BAD_OUTPUT_ONLY="1"
|
||||
;;
|
||||
|
||||
"-p"|"--perfdata")
|
||||
PERFDATA="1"
|
||||
;;
|
||||
@ -246,11 +251,31 @@ do
|
||||
|
||||
if [ "$DISPLAY_SENSOR_HEX" = "1" ]
|
||||
then
|
||||
OUTPUT+=" Sensor $sensor_hex is ${celsius}°C;"
|
||||
if [ "$DISPLAY_BAD_OUTPUT_ONLY" = "1" ] && [ "$celsius" -ge "$CRITICAL" ]
|
||||
then
|
||||
OUTPUT+=" Sensor $sensor_hex is ${celsius}°C;"
|
||||
elif [ "$DISPLAY_BAD_OUTPUT_ONLY" = "1" ] && [ "$celsius" -ge "$WARNING" ]
|
||||
then
|
||||
OUTPUT+=" Sensor $sensor_hex is ${celsius}°C;"
|
||||
elif [ ! "$DISPLAY_BAD_OUTPUT_ONLY" = "1" ]
|
||||
then
|
||||
OUTPUT+=" Sensor $sensor_hex is ${celsius}°C;"
|
||||
fi
|
||||
|
||||
OUTPUT_PERFDATA+="Sensor $sensor_hex=$celsius;$WARNING;$CRITICAL "
|
||||
elif [ "$DISPLAY_SENSOR_NR" = "1" ]
|
||||
then
|
||||
OUTPUT+=" Sensor $sensor_id is ${celsius}°C;"
|
||||
if [ "$DISPLAY_BAD_OUTPUT_ONLY" = "1" ] && [ "$celsius" -ge "$CRITICAL" ]
|
||||
then
|
||||
OUTPUT+=" Sensor $sensor_id is ${celsius}°C;"
|
||||
elif [ "$DISPLAY_BAD_OUTPUT_ONLY" = "1" ] && [ "$celsius" -ge "$WARNING" ]
|
||||
then
|
||||
OUTPUT+=" Sensor $sensor_id is ${celsius}°C;"
|
||||
elif [ ! "$DISPLAY_BAD_OUTPUT_ONLY" = "1" ]
|
||||
then
|
||||
OUTPUT+=" Sensor $sensor_id is ${celsius}°C;"
|
||||
fi
|
||||
|
||||
OUTPUT_PERFDATA+="Sensor $sensor_id=$celsius;$WARNING;$CRITICAL "
|
||||
fi
|
||||
|
||||
@ -274,11 +299,31 @@ do
|
||||
|
||||
if [ "$DISPLAY_SENSOR_HEX" = "1" ]
|
||||
then
|
||||
OUTPUT+=" Sensor $sensor_hex is ${fahrenheit}°F;"
|
||||
if [ "$DISPLAY_BAD_OUTPUT_ONLY" = "1" ] && [ "$fahrenheit" -ge "$CRITICAL" ]
|
||||
then
|
||||
OUTPUT+=" Sensor $sensor_hex is ${fahrenheit}°F;"
|
||||
elif [ "$DISPLAY_BAD_OUTPUT_ONLY" = "1" ] && [ "$fahrenheit" -ge "$WARNING" ]
|
||||
then
|
||||
OUTPUT+=" Sensor $sensor_hex is ${fahrenheit}°F;"
|
||||
elif [ ! "$DISPLAY_BAD_OUTPUT_ONLY" = "1" ]
|
||||
then
|
||||
OUTPUT+=" Sensor $sensor_hex is ${fahrenheit}°F;"
|
||||
fi
|
||||
|
||||
OUTPUT_PERFDATA+="Sensor $sensor_hex=$fahrenheit;$WARNING;$CRITICAL "
|
||||
elif [ "$DISPLAY_SENSOR_NR" = "1" ]
|
||||
then
|
||||
OUTPUT+=" Sensor $sensor_id is ${fahrenheit}°F;"
|
||||
if [ "$DISPLAY_BAD_OUTPUT_ONLY" = "1" ] && [ "$fahrenheit" -ge "$CRITICAL" ]
|
||||
then
|
||||
OUTPUT+=" Sensor $sensor_id is ${fahrenheit}°F;"
|
||||
elif [ "$DISPLAY_BAD_OUTPUT_ONLY" = "1" ] && [ "$fahrenheit" -ge "$WARNING" ]
|
||||
then
|
||||
OUTPUT+=" Sensor $sensor_id is ${fahrenheit}°F;"
|
||||
elif [ ! "$DISPLAY_BAD_OUTPUT_ONLY" = "1" ]
|
||||
then
|
||||
OUTPUT+=" Sensor $sensor_id is ${fahrenheit}°F;"
|
||||
fi
|
||||
|
||||
OUTPUT_PERFDATA+="Sensor $sensor_id=$fahrenheit;$WARNING;$CRITICAL "
|
||||
fi
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user