#!/bin/bash export LANG=de_DE.UTF-8 HOST="192.168.100.44" FILE="/var/www/dokuwiki/data/pages/wtts.txt" GET="/usr/bin/snmpget" P="/usr/local/wetter" TEMP=`$GET -v1 -c public $HOST 1.3.6.1.4.1.31440.10.15.1.1.1 | cut -d '"' -f 2` HUDM=`$GET -v1 -c public $HOST 1.3.6.1.4.1.31440.10.15.1.2.1 | cut -d '"' -f 2` DEWP=`$GET -v1 -c public $HOST 1.3.6.1.4.1.31440.10.15.1.3.1 | cut -d '"' -f 2` BPMB=`$GET -v1 -c public $HOST 1.3.6.1.4.1.31440.10.15.1.6.1 | cut -d '"' -f 2` LIGT=`$GET -v1 -c public $HOST 1.3.6.1.4.1.31440.10.15.1.8.1 | cut -d '"' -f 2` #HUDI=`$GET -v1 -c public $HOST 1.3.6.1.4.1.31440.10.15.1.4.1 | cut -d '"' -f 2` #HETI=`$GET -v1 -c public $HOST 1.3.6.1.4.1.31440.10.15.1.5.1 | cut -d '"' -f 2` #BPHG=`$GET -v1 -c public $HOST 1.3.6.1.4.1.31440.10.15.1.7.1 | cut -d '"' -f 2` test -f $P/temp_max || echo $TEMP > $P/temp_max test -f $P/temp_min || echo $TEMP > $P/temp_min test -f $P/hudm_max || echo $HUDM > $P/hudm_max test -f $P/hudm_min || echo $HUDM > $P/hudm_min test -f $P/dewp_max || echo $DEWP > $P/dewp_max test -f $P/dewp_min || echo $DEWP > $P/dewp_min test -f $P/bpmb_max || echo $BPMB > $P/bpmb_max test -f $P/bpmb_min || echo $BPMB > $P/bpmb_min test -f $P/ligt_max || echo $LIGT > $P/ligt_max test -f $P/ligt_min || echo $LIGT > $P/ligt_min TEMP_MAX=`cat $P/temp_max` TEMP_MIN=`cat $P/temp_min` HUDM_MAX=`cat $P/hudm_max` HUDM_MIN=`cat $P/hudm_min` DEWP_MAX=`cat $P/dewp_max` DEWP_MIN=`cat $P/dewp_min` BPMB_MAX=`cat $P/bpmb_max` BPMB_MIN=`cat $P/bpmb_min` LIGT_MAX=`cat $P/ligt_max` LIGT_MIN=`cat $P/ligt_min` if [ `echo "$TEMP < $TEMP_MIN" | bc` -eq 1 ]; then echo $TEMP > $P/temp_min TEMP_MIN=$TEMP fi if [ `echo "$TEMP > $TEMP_MAX" | bc` -eq 1 ]; then echo $TEMP > $P/temp_max TEMP_MAX=$TEMP fi if [ `echo "$HUDM < $HUDM_MIN" | bc` -eq 1 ]; then echo $HUDM > $P/hudm_min HUDM_MIN=$HUDM fi if [ `echo "$HUDM > $HUDM_MAX" | bc` -eq 1 ]; then echo $HUDM > $P/hudm_max HUDM_MAX=$HUDM fi if [ `echo "$DEWP < $TEMP_MIN" | bc` -eq 1 ]; then echo $DEWP > $P/dewp_min DEWP_MIN=$DEWP fi if [ `echo "$DEWP > $DEWP_MAX" | bc` -eq 1 ]; then echo $DEWP > $P/dewp_max DEWP_MAX=$DEWP fi if [ `echo "$BPMB < $BPMB_MIN" | bc` -eq 1 ]; then echo $BPMB > $P/bpmb_min BPMB_MIN=$BPMB fi if [ `echo "$BPMB > $BPMB_MAX" | bc` -eq 1 ]; then echo $BPMB > $P/bpmb_max BPMB_MAX=$BPMB fi if [ `echo "$LIGT < $LIGT_MIN" | bc` -eq 1 ]; then echo $LIGT > $P/ligt_min LIGT_MIN=$LIGT fi if [ `echo "$LIGT > $LIGT_MAX" | bc` -eq 1 ]; then echo $LIGT > $P/ligt_max LIGT_MAX=$LIGT fi #rrdtool update $P/temp.rrd N:$TEMP #rrdtool update $P/hudm.rrd N:$HUDM #rrdtool update $P/dewp.rrd N:$DEWP #rrdtool update $P/bpmb.rrd N:$BPMB #rrdtool update $P/ligt.rrd N:$LIGT TEMP=`echo $TEMP | sed 's/\./,/g'` TEMP_MIN=`echo $TEMP_MIN | sed 's/\./,/g'` TEMP_MAX=`echo $TEMP_MAX | sed 's/\./,/g'` TEMP_MIN_T=`date -r $P/temp_min +%H:%M` TEMP_MAX_T=`date -r $P/temp_max +%H:%M` HUDM=`echo $HUDM | sed 's/\./,/g'` HUDM_MIN=`echo $HUDM_MIN | sed 's/\./,/g'` HUDM_MAX=`echo $HUDM_MAX | sed 's/\./,/g'` HUDM_MIN_T=`date -r $P/hudm_min +%H:%M` HUDM_MAX_T=`date -r $P/hudm_max +%H:%M` DEWP=`echo $DEWP | sed 's/\./,/g'` DEWP_MIN=`echo $DEWP_MIN | sed 's/\./,/g'` DEWP_MAX=`echo $DEWP_MAX | sed 's/\./,/g'` DEWP_MIN_T=`date -r $P/dewp_min +%H:%M` DEWP_MAX_T=`date -r $P/dewp_max +%H:%M` BPMB=`echo $BPMB | sed 's/\./,/g'` BPMB_MIN=`echo $BPMB_MIN | sed 's/\./,/g'` BPMB_MAX=`echo $BPMB_MAX | sed 's/\./,/g'` BPMB_MIN_T=`date -r $P/bpmb_min +%H:%M` BPMB_MAX_T=`date -r $P/bpmb_max +%H:%M` LIGT=`echo $LIGT | sed 's/\./,/g'` LIGT_MIN=`echo $LIGT_MIN | sed 's/\./,/g'` LIGT_MAX=`echo $LIGT_MAX | sed 's/\./,/g'` LIGT_MIN_T=`date -r $P/ligt_min +%H:%M` LIGT_MAX_T=`date -r $P/ligt_max +%H:%M` # Tabelle generiern echo "|**Wetter**| jetzt || Minimum ||| Maximum |||" > $FILE"_" printf "|Temperatur:| %7.1f|°|%s | %7.1f|°|%s | %7.1f|°|\n" $TEMP $TEMP_MIN_T $TEMP_MIN $TEMP_MAX_T $TEMP_MAX >> $FILE"_" printf "|Luftfeuchtigkeit:| %7.1f|%%|%s | %7.1f|%%|%s | %7.1f|%%|\n" $HUDM $HUDM_MIN_T $HUDM_MIN $HUDM_MAX_T $HUDM_MAX >> $FILE"_" printf "|Taupunkt:| %7.1f|°|%s | %7.1f|°|%s | %7.1f|°|\n" $DEWP $DEWP_MIN_T $DEWP_MIN $DEWP_MAX_T $DEWP_MAX >> $FILE"_" printf "|Luftdruck:| %7.1f|hp|%s | %7.1f|hp|%s | %7.1f|hp|\n" $BPMB $BPMB_MIN_T $BPMB_MIN $BPMB_MAX_T $BPMB_MAX >> $FILE"_" printf "|Helligkeit:| %7.1f|Lux|%s | %7.1f|Lux|%s | %7.1f|Lux|\n" $LIGT $LIGT_MIN_T $LIGT_MIN $LIGT_MAX_T $LIGT_MAX >> $FILE"_" echo "|"`date`"|||||||||" >> $FILE"_" mv $FILE"_" $FILE