X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=mod_statusbar%2Fion-statusd%2Fstatusd_load.lua;fp=mod_statusbar%2Fion-statusd%2Fstatusd_load.lua;h=0000000000000000000000000000000000000000;hb=de01e0dd832dc5eeac12f504d02b362c52bb4557;hp=88162af1cf8ae1e70be3238b79d9b63b9b495f0b;hpb=24c77c99349b1ebb879c674e3c33a90c125983a5;p=ion3.git diff --git a/mod_statusbar/ion-statusd/statusd_load.lua b/mod_statusbar/ion-statusd/statusd_load.lua deleted file mode 100644 index 88162af..0000000 --- a/mod_statusbar/ion-statusd/statusd_load.lua +++ /dev/null @@ -1,70 +0,0 @@ --- --- ion/mod_statusbar/ion-statusd/statusd_load.lua --- --- Copyright (c) Tuomo Valkonen 2004-2006. --- --- Ion is free software; you can redistribute it and/or modify it under --- the terms of the GNU Lesser General Public License as published by --- the Free Software Foundation; either version 2.1 of the License, or --- (at your option) any later version. --- - --- --- We should really use getloadavg(3) instead and move the meter to --- Ion side to get properly up-to-date loads. But until such an export --- is made, and we use potentially blocking files and external programs, --- this meter must be in ion-statusd. --- - -local defaults={ - update_interval=10*1000, - load_hint="1min", - important_threshold=1.5, - critical_threshold=4.0 -} - -local settings=table.join(statusd.get_config("load"), defaults) - -local load_timer - -local function get_hint(v) - local i="normal" - if v then - if v>settings.critical_threshold then - i="critical" - elseif v>settings.important_threshold then - i="important" - end - end - return i -end - -local function fmt(l) - if not l then - return "?" - else - return string.format("%0.2f", l) - end -end - -local function update_load() - local lds = statusd.getloadavg() - f1, f5, f15 = fmt(lds["1min"]), fmt(lds["5min"]), fmt(lds["15min"]) - statusd.inform("load", f1..", "..f5..", "..f15) - statusd.inform("load_hint", get_hint(lds[settings.load_hint])) - statusd.inform("load_1min", f1) - statusd.inform("load_1min_hint", get_hint(lds["1min"])) - statusd.inform("load_5min", f5) - statusd.inform("load_5min_hint", get_hint(lds["5min"])) - statusd.inform("load_15min", f15) - statusd.inform("load_15min_hint", get_hint(lds["15min"])) - load_timer:set(settings.update_interval, update_load) -end - --- Init ---statusd.inform("load_template", "0.00, 0.00, 0.00"); - -load_timer=statusd.create_timer() -update_load() - -