Radios on my first router stopped working within hours of setting it up and I suspected it due to high temperature (CPU was at 96°C). When I got a replacement, I didn't want to take a chance so had it always running with a fan. I recently upgraded to RT-AC86U and converted the old router to an AiMesh node. It is now positioned at a location where the fan noise would be really bothersome, so I wanted to see if fan is really needed, so I disconnected it and observed it for a while. The temperatures were hovering at around 80°C/61°C/67°C for CPU, 2.4 and 5Ghz chips respectively. I could not say for sure if these are safe enough by googling, so I decided to create a little script to monitor and take some corrective action. I am sharing the script here to get some feedback. The script checks for all 3 temperatures and sends an email alert and it also takes an action if it is one of the radios. It basically turns off the corresponding radio and adds a cron entry to get it turned back on at the turn of the hour. E.g., I got my first alert a few minutes ago
Here is the script:
I would appreciate any comments or suggestions for improving it further. Also, would appreciate inputs on what the max temperatures can safely be.
When I checked the temperatures after about 50min, 2.4Ghz dropped from 62 to 56 and CPU dropped from 80 to 76. The 5Ghz radio was still off, so I waited for it get turned back on to check the temperature and it too dropped from 68 to 61. The script is working, but the max temperatures need some tweaking. Also, I noticed that when the 5Ghz radio was turned back on, it caused some disruption. The node went offline momentarily and my Mac laptop that is connected to this SSID lost connection, so I had to manually select the network again (for some reason my Mac doesn't automatically reconnect, even to my 2.4Ghz SSID which should be available).Temperature too hot, CPU: 81/82 2.4Ghz wifi: 62/62 5Ghz wifi: 68/67
Router RT-AC68U
9:08 PM (48 minutes ago)
to me
Turning off 5Ghz radio for up to an hour
---
Your friendly router RT-AC68U.
Here is the script:
Code:
#!/bin/sh
# Based on: https://www.snbforums.com/threads/email-notification-when-switching-to-secondary-wan.39724/post-331321
MAX_TEMP_CPU=82
MAX_TEMP_24=62
MAX_TEMP_5=67
function radio_off() {
local iface=$1
wl -i $iface radio off
local cronId=TurnOn-$iface
cru a $cronId "0 * * * * wl -i $iface radio on; cru d $cronId"
}
# Email settings (mail envelope) #
FROM_ADDRESS="you@gmail.com"
TO_NAME="Your Name"
TO_ADDRESS="you@gmail.com"
# Email credentials #
USERNAME="you@gmail.com"
PASSWORD="gmail-password"
# Server settings #
SMTP="smtp.gmail.com"
PORT="587"
# FROM Name in email
FROM_NAME="Router $(nvram get productid)"
### Do not change below ###
# set environment PATH to system binaries
export PATH=/sbin:/bin:/usr/sbin:/usr/bin:$PATH
wifi24_status=$(wl -i eth1 radio)
wifi5_status=$(wl -i eth2 radio)
cpu_temp=$(cat /proc/dmu/temperature | sed 's/[^0-9]//g')
wifi24_temp=$([ $wifi24_status = 0x0000 ] && wl -i eth1 phy_tempsense | sed 's/ .*//' || echo 0)
wifi5_temp=$([ $wifi5_status = 0x0000 ] && wl -i eth2 phy_tempsense | sed 's/ .*//' || echo 0)
if [ $cpu_temp -gt $MAX_TEMP_CPU -o $wifi24_temp -gt $MAX_TEMP_24 -o $wifi5_temp -gt $MAX_TEMP_5 ]; then
msg="Temperature too hot, CPU: $cpu_temp/$MAX_TEMP_CPU 2.4Ghz wifi: $wifi24_temp/$MAX_TEMP_24 5Ghz wifi: $wifi5_temp/$MAX_TEMP_5"
# notify Syslog of the event
logger $msg
# assemble the message
echo "From: \"$FROM_NAME\" <$FROM_ADDRESS>" > /tmp/mail.txt
echo "To: \"$TO_NAME\" <$TO_ADDRESS>" >> /tmp/mail.txt
echo "Subject: $msg" >> /tmp/mail.txt
echo "Date: $(date -R)" >> /tmp/mail.txt
echo "" >> /tmp/mail.txt
if [ $wifi24_temp -gt $MAX_TEMP_24 ]; then
radio_off eth1
echo "Turning off 2.4Ghz radio for up to an hour" >> /tmp/mail.txt
fi
if [ $wifi5_temp -gt $MAX_TEMP_5 ]; then
radio_off eth2
echo "Turning off 5Ghz radio for up to an hour" >> /tmp/mail.txt
fi
echo "--- " >> /tmp/mail.txt
echo "Your friendly router $(nvram get productid)." >> /tmp/mail.txt
# send with curl
curl --url smtp://$SMTP:$PORT \
--mail-from "$FROM_ADDRESS" --mail-rcpt "$TO_ADDRESS" \
--upload-file /tmp/mail.txt \
--ssl-reqd \
--user "$USERNAME:$PASSWORD" --insecure
# remove temp file
rm /tmp/mail.txt
fi