Code: Alles auswählen
Info_RS(){
RAMSIZE="`free -m | tail -n 2 | head -1 | awk '{print $2}'`"
RAMUSED="`free -m | tail -n 2 | head -1 | awk '{print $3}'`"
RAMAVAI="`free -m | tail -n 2 | head -1 | awk '{print $4}'`"
RAMCACH="`free -m | tail -n 2 | head -1 | awk '{print $7}'`"
SWPSIZE="`free -m | tail -n 1 | head -2 | awk '{print $2}'`"
SWPUSED="`free -m | tail -n 1 | head -2 | awk '{print $3}'`"
SWPAVAI="`free -m | tail -n 1 | head -2 | awk '{print $4}'`"
CPU=$( echo "$CPUINFOS" | awk '{print $3}' )
UPT0="`uptime`"
UPT1=$( echo "$UPT0" | awk -F"up " '{print $2}' | awk -F"load" '{print $1}' )
UPT2=$( echo "$UPT1" | sed -e 's/,//g' )
UPT3=$( echo "$UPT2" | awk -F" " '{print $1}' )
UPT4=$( echo "$UPT3" | cut -d" " -f2 )
if [ "$UPT4" = "min" ]; then
UPT5=$( echo "$UPT3" | cut -d" " -f1 )
UPTIME="0,0,$UPT5,0"
fi
if [[ "$UPT4" = "day" || "$UPT4" = "days" ]]; then
UPT5=$( echo "$UPT3" | cut -d" " -f1 )
UPT6=$( echo "$UPT2" | cut -d" " -f4 )
UPT7=$( echo "$UPT6" | cut -d":" -f1 )
UPT8=$( echo "$UPT6" | cut -d":" -f2 )
UPTIME="$UPT5,$UPT7,$UPT8,0"
fi
if [[ "$UPT4" != "min" && "$UPT4" != "day" && "$UPT4" != "days" ]] ; then
UPT5=$( echo "$UPT3" | cut -d":" -f1 )
UPT6=$( echo "$UPT3" | cut -d":" -f2 )
UPTIME="0,$UPT5,$UPT6,0"
fi
return_info=" $RAMSIZE|$RAMUSED|$RAMAVAI|$RAMCACH||$SWPSIZE|$SWPUSED|$SWPAVAI||CPU||$UPTIME"
}