1

I am writing temperature, cpu load and memory data to a rrdtool table, in update i am using N in order to pass the time however there is a problem with the time being way off. illegal attempt to update using time 1487152126 when last update time is 1487212862 (minimum one second step) That is quite a time difference and i dont know why it would be that far off. Any help is great - it was working perfectly fine yesterday so no idea where its went wrong. update function:

#!/bin/bash
cd /temptest/
TEMPERATURE=$(/opt/vc/bin/vcgencmd measure_temp | sed 's/[^0-9]*//g')
TEMPERATURE=$(echo $TEMPERATURE | sed 's/.$/.&/')
CPULOAD=$(top -d 0.5 -b -n2 | grep "Cpu(s)"|tail -n 1 | 
awk '{print $2 +$4}')
PIMEM=$(free -h | grep "Mem:" | awk '{print $4}')
PIMEM=$(echo $PIMEM | sed 's/[^0-9]*//g')
PIMEMTOTAL=$(free -h | grep "Mem:" | awk '{print $2}')
PIMEMTOTAL=$(echo $PIMEMTOTAL | sed 's/[^0-9]*//g')
PIMEMPERCENT=
$(awk -v mem="$PIMEM" -v tot="$PIMEMTOTAL" 'BEGIN{print (mem/tot) $
/usr/bin/rrdtool update pitable.rrd N:$TEMPERATURE:$CPULOAD:0:$PIMEMPERCENT

1 Answers1

3

Since you are using N: rrdtool uses the system time. Such an error would mean that your system time has changed ... maybe some misconfiguration ... timezone set and the time re-adjusted for example ? Rrdtool uses UTC internally!

Tobi Oetiker
  • 1,842
  • 13
  • 12
  • Thanks seems like it was a random system blip. Everything seems fine now making sure the system time syncs with online timezone server and hopefully that will help. Havnt had a problem since then. – EliteMinerZMC Feb 17 '17 at 09:56