Ausgabe überarbeitet (Hex und Nummer)
This commit is contained in:
parent
5daa38f801
commit
7765093433
@ -26,6 +26,8 @@ function hilfetext(){
|
||||
-l | --list List all sensors
|
||||
--celsius Display all temperatures in degree celsius (default)
|
||||
--fahrenheit Display all temperatures in degree fahrenheit
|
||||
--sensor_hex Output of the Hex-Sensors (default)
|
||||
--sensor_nr Output of the Sensor-Numbers
|
||||
-p | --perfdata show Performancedata
|
||||
-h | --help Print this Help
|
||||
|
||||
@ -34,7 +36,7 @@ function hilfetext(){
|
||||
|
||||
function ParameterEvaluation(){
|
||||
|
||||
options=$(getopt -o s:S:w:c:lph --long config: --long sensor: --long warn: --long crit: --long list --long perfdata --long help --long celsius --long fahrenheit -- "$@")
|
||||
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 -- "$@")
|
||||
|
||||
#Option nicht verfügbar
|
||||
[ "$?" -eq "0" ] || {
|
||||
@ -78,6 +80,12 @@ function ParameterEvaluation(){
|
||||
"--fahrenheit")
|
||||
FAHRENHEIT="1"
|
||||
;;
|
||||
"--sensor_hex")
|
||||
DISPLAY_SENSOR_HEX="1"
|
||||
;;
|
||||
"--sensor_nr")
|
||||
DISPLAY_SENSOR_NR="1"
|
||||
;;
|
||||
"-p"|"--perfdata")
|
||||
PERFDATA="1"
|
||||
;;
|
||||
@ -146,19 +154,35 @@ then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#Sollte weder --fahrenheit noch --celsius gesetzt sein, wird CELSIUS aktiviert
|
||||
if [ "$FAHRENHEIT" = "" -a "$CELSIUS" = "" ]
|
||||
then
|
||||
CELSIUS="1"
|
||||
fi
|
||||
|
||||
#Sollte --fahrenheit und --celsius gesetzt sein, wird das Script beednet
|
||||
#Sollte "--fahrenheit" und "--celsius" gesetzt sein, wird das Script beendet
|
||||
if [ "$FAHRENHEIT" = "1" -a "$CELSIUS" = "1" ]
|
||||
then
|
||||
echo 'Parameter "--celsius" and "--fahrenheit" gesetzt'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#Sollte weder "--fahrenheit" noch "--celsius" gesetzt sein, wird CELSIUS aktiviert
|
||||
if [ "$FAHRENHEIT" = "" -a "$CELSIUS" = "" ]
|
||||
then
|
||||
CELSIUS="1"
|
||||
fi
|
||||
|
||||
|
||||
#Sollte "--sensor_nr" und "--sensor_hex" gesetzt sein, wird das Script beendet
|
||||
if [ "$DISPLAY_SENSOR_HEX" = "1" -a "$DISPLAY_SENSOR_NR" = "1" ]
|
||||
then
|
||||
echo 'Parameter "--sensor_nr" and "--sensor_hex" gesetzt'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#Sollte weder "--sensor_nr" noch "--sensor_hex" gesetzt sein, wird DISPLAY_SENSOR_HEX aktiviert
|
||||
if [ "$DISPLAY_SENSOR_HEX" = "" -a "$DISPLAY_SENSOR_NR" = "" ]
|
||||
then
|
||||
DISPLAY_SENSOR_HEX="1"
|
||||
fi
|
||||
|
||||
|
||||
if [ "$LIST" = "1" ]
|
||||
then
|
||||
$DIGITEMP -c "$CONFIG_PATH" -a -o"Sensor %s: Serial %R" -q
|
||||
@ -170,7 +194,7 @@ fi
|
||||
#DEBUG
|
||||
#echo "SENSORS: \"$SENSORS\""
|
||||
|
||||
|
||||
#Initialisieren der Variablen
|
||||
STATUS_CRITICAL=0
|
||||
STATUS_WARNING=0
|
||||
STATUS_OK=0
|
||||
@ -204,8 +228,16 @@ do
|
||||
#echo "ToDo: Ausgabe OK"
|
||||
fi
|
||||
|
||||
if [ "$DISPLAY_SENSOR_HEX" = "1" ]
|
||||
then
|
||||
OUTPUT+=" Sensor $sensor_hex is ${celsius}°C;"
|
||||
OUTPUT_PERFDATA+="Sensor $sensor_hex=$celsius;$WARNING;$CRITICAL "
|
||||
elif [ "$DISPLAY_SENSOR_NR" = "1" ]
|
||||
then
|
||||
OUTPUT+=" Sensor $sensor_id is ${celsius}°C;"
|
||||
OUTPUT_PERFDATA+="Sensor $sensor_id=$celsius;$WARNING;$CRITICAL "
|
||||
fi
|
||||
|
||||
|
||||
fi
|
||||
|
||||
@ -224,8 +256,15 @@ do
|
||||
#echo "ToDo: Ausgabe OK"
|
||||
fi
|
||||
|
||||
if [ "$DISPLAY_SENSOR_HEX" = "1" ]
|
||||
then
|
||||
OUTPUT+=" Sensor $sensor_hex is ${fahrenheit}°F;"
|
||||
OUTPUT_PERFDATA+="Sensor $sensor_hex=$fahrenheit;$WARNING;$CRITICAL "
|
||||
elif [ "$DISPLAY_SENSOR_NR" = "1" ]
|
||||
then
|
||||
OUTPUT+=" Sensor $sensor_id is ${fahrenheit}°F;"
|
||||
OUTPUT_PERFDATA+="Sensor $sensor_id=$fahrenheit;$WARNING;$CRITICAL "
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user