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.

20 lines
660 B

  1. local uname_fd = io.popen("uname -m")
  2. local labels = {
  3. domainname = "",
  4. nodename = "",
  5. release = string.sub(get_contents("/proc/sys/kernel/osrelease"), 1, -2),
  6. sysname = string.sub(get_contents("/proc/sys/kernel/ostype"), 1, -2),
  7. version = string.sub(get_contents("/proc/sys/kernel/version"), 1, -2),
  8. machine = string.sub(uname_fd:read("*a"), 1, -2)
  9. }
  10. uname_fd:close()
  11. local function scrape()
  12. labels["domainname"] = string.sub(get_contents("/proc/sys/kernel/domainname"), 1, -2)
  13. labels["nodename"] = string.sub(get_contents("/proc/sys/kernel/hostname"), 1, -2)
  14. metric("node_uname_info", "gauge", labels, 1)
  15. end
  16. return { scrape = scrape }