本帖最后由 Mirukuteii 于 2018-4-22 16:49 编辑
可惜snmp不能提供温度,而ASUSWRT的asp文件中是这样获取温度的:
curr_coreTmp_2_raw = "<% sysinfo("temperature.2"); %>";
curr_coreTmp_2 = (curr_coreTmp_2_raw.indexOf("disabled") > 0 ? 0 : curr_coreTmp_2_raw.replace("°C", ""));
curr_coreTmp_5_raw = "<% sysinfo("temperature.5"); %>";
curr_coreTmp_5 = (curr_coreTmp_5_raw.indexOf("disabled") > 0 ? 0 : curr_coreTmp_5_raw.replace("°C", ""));
curr_coreTmp_cpu = "<% get_cpu_temperature(); %>";
function update_temperatures(){
$.ajax({
url: '/ajax_coretmp.asp',
dataType: 'script',
error: function(xhr){
update_temperatures();
},
success: function(response){
code = "<b>2.4 GHz:</b><span> " + curr_coreTmp_2_raw + "</span>";
if (band5g_support)
code += " - <b>5 GHz:</b> <span>" + curr_coreTmp_5_raw + "</span>";
if (curr_coreTmp_cpu != "")
code +=" - <b>CPU:</b> <span>" + curr_coreTmp_cpu +"°C</span>";
document.getElementById("temp_td").innerHTML = code;
setTimeout("update_temperatures();", 3000);
}
});
}
|