Periodic temp readings from collectd to log files

IMHO this is over-thinking the issue..I already identified the problem (the fan under the router)...I'm just looking at continued temp reports that show if I am over nominal operating range.

the original answer does everything I want it to do...(obviously if you want to submit your own fix as an addendum (with your reasons why this is better) then I would appreciate the input)

1 Like

Addendum - this is what I use with the Prometheus node exporter for OpenWRT

Stored in: /usr/lib/lua/prometheus-collectors/thermal_zones.lua

local function scrape()
  thermal_metric =  metric("thermal_zone", "gauge" )

  local fd = io.popen("find /sys/class/thermal/*/ -name temp")
  local lines = fd:read("*all")
  fd:close()    
  -- Report thermal per zone
  for line in lines:gmatch("([^\r\n]*)[\r\n]") do
    if line then
      local zone = string.match(line, "zone%d+")
      local temp = string.gsub(get_contents(line), "n", "")
      local labels = { zone = zone }
      thermal_metric(labels, temp) 
    end
  end
end
  
return { scrape = scrape }

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.