moltenbar/mod/load_average
fbt fd3bca11c5 my_config
Signed-off-by: fbt <fbt@fleshless.org>
2016-10-04 15:34:25 +03:00

24 lines
492 B
Ruby

# vim: ft=ruby
class LoadAverage < Worker
def mainloop()
while true do
file = File.open("/proc/loadavg", "r")
la_m = file.gets.split[0]
if la_m.to_i > @my_config['crit_value']
fg_colour = @my_config['crit_colour']
elsif la_m.to_i > @my_config['warn_value']
fg_colour = @my_config['warn_colour']
else
fg_colour = @my_config['ok_colour']
end
self.write "%{F#{fg_colour}}#{la_m}%{F-}"
sleep(5)
end
end
end
Modules.add("load_average", "LoadAverage")