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
767 B

  1. local function scrape()
  2. -- NOTE: Both of these are missing in OpenWRT kernels.
  3. -- See: https://dev.openwrt.org/ticket/15781
  4. local netstat = get_contents("/proc/net/netstat") .. get_contents("/proc/net/snmp")
  5. -- all devices
  6. local netsubstat = {"IcmpMsg", "Icmp", "IpExt", "Ip", "TcpExt", "Tcp", "UdpLite", "Udp"}
  7. for i, nss in ipairs(netsubstat) do
  8. local substat_s = string.match(netstat, nss .. ": ([A-Z][A-Za-z0-9 ]+)")
  9. if substat_s then
  10. local substat = space_split(substat_s)
  11. local substatv = space_split(string.match(netstat, nss .. ": ([0-9 -]+)"))
  12. for ii, ss in ipairs(substat) do
  13. metric("node_netstat_" .. nss .. "_" .. ss, "gauge", nil, substatv[ii])
  14. end
  15. end
  16. end
  17. end
  18. return { scrape = scrape }