eufon/blinkenlicht/metric/loadavg.fnl
Daniel Barlow 463c1eea03 standardise interface to metrics
call as follows:

(let [m  (metricname.new)]
  (m:read)
  (m:read)
   ...
   )
2022-04-26 21:25:43 +01:00

10 lines
278 B
Fennel

(fn loadavg []
(with-open [f (io.open "/proc/loadavg" :r)]
(let [line (f:read "*a")
(one five fifteen) (line:match "([%d.]+) +([%d.]+) +([%d.]+)")]
(values (tonumber one) (tonumber five) (tonumber fifteen)))))
{:new #{
:read #(loadavg)
})