I have a wrt1900ACS router running the divested build (which tbh isn't relevant to this question) and I've added the luci-app-statistics module to the webGUI so I can monitor the temperature of my router (cos it's in a hard to reach place up high (heat rises) and I recently had an external cooling fan fail resulting in an outage.
As the external fan is pretty critical, I would like to have periodic temperature readings spat out to the log file (say every 10mins?)...I've tried to find this and I think I can do it by sending the output of the temp sensor to the log via a cron job, but I don't know where to look to find the actual temp reading that is obtained from collectd. (I looked in /tmp/rrd but it's not human-readable)
Where should I look for a text output of the temperature reading? or is this something I have to accomplish using other means?
Well, if it ever goes above 99.999 (or below 10.000) then you'll either need to use the $(( x / 1000 )) method ... or, if you want to keep the fractional part
logger -t temp "$(cat $(find /sys -name temp) | head -1 | sed -e 's/...$/.&/')"
one more quick question..my cron job runs as planned now and everything shows up fine, however the level status is Error in the log. Any idea what could be causing this?
this is a typical output in the log Thu Nov 11 19:45:00 2021 cron.err crond[28182]: USER root pid 28352 cmd /usr/sbin/get_temp Thu Nov 11 19:45:00 2021 user.alert System_Temp: 51.789
That is a quirk: cron uses a log function in busybox that has no input for error levels and is fixed to log everything as an "error." Consequently every log entry by cron will be tagged cron.err, whether it is an actual error or not.
What you can do, however, is set cron itself to a different error level, it will internally decide what to send to the log -- see the cronloglevel option in /etc/config/system. Personally I set it to 9, so it will really only send actual errors.
@batkung I would not average it out if the reported temperatures are not "uniform"
Figuring out what the thermal zones are and then averaging that out as a monitoring post-op makes more sense. You might want to know the cause of a change.
My 2c.
FYI, cellular modems do expose internal temperatures that can also be extracted and monitored against the suggested operating temperatures.