浏览代码

add overlay usage to statistics.d

ohrensessel 10 年之前
父节点
当前提交
4e76436932
共有 1 个文件被更改,包括 7 次插入0 次删除
  1. 7 0
      package/gluon-announce/files/lib/gluon/announce/statistics.d/overlay

+ 7 - 0
package/gluon-announce/files/lib/gluon/announce/statistics.d/overlay

@@ -0,0 +1,7 @@
+local fs = require "nixio.fs"
+local opkg = require "luci.model.ipkg"
+
+local st = fs.statvfs(opkg.overlay_root())
+local used = 100*((st.blocks - st.bfree) / st.blocks) or 0
+
+return math.floor(used * 1000 + 0.5) / 1000