You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
623 B

  1. local labels = {
  2. id = "",
  3. release = "",
  4. revision = "",
  5. model = string.sub(get_contents("/tmp/sysinfo/model"), 1, -2),
  6. board_name = string.sub(get_contents("/tmp/sysinfo/board_name"), 1, -2)
  7. }
  8. for k, v in string.gmatch(get_contents("/etc/openwrt_release"), "(DISTRIB_%w+)='(.-)'\n") do
  9. if k == "DISTRIB_ID" then
  10. labels["id"] = v
  11. elseif k == "DISTRIB_RELEASE" then
  12. labels["release"] = v
  13. elseif k == "DISTRIB_REVISION" then
  14. labels["revision"] = v
  15. end
  16. end
  17. local function scrape()
  18. metric("node_openwrt_info", "gauge", labels, 1)
  19. end
  20. return { scrape = scrape }