From 88b29be53e69b50dcdbb5715490fc4fa3e6ede3d Mon Sep 17 00:00:00 2001 From: Eike Baran <eike.baran@uni-oldenburg.de> Date: Mon, 17 Aug 2015 21:44:28 +0200 Subject: [PATCH] added symlink from old location in statuspage/node.data; converted traffic-bytes tonumber() --- .../files/lib/ffnw/nodewatcher2/nodewatcher.lua | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/nodewatcher2/files/lib/ffnw/nodewatcher2/nodewatcher.lua b/nodewatcher2/files/lib/ffnw/nodewatcher2/nodewatcher.lua index a57f7ad..06c68f3 100755 --- a/nodewatcher2/files/lib/ffnw/nodewatcher2/nodewatcher.lua +++ b/nodewatcher2/files/lib/ffnw/nodewatcher2/nodewatcher.lua @@ -176,10 +176,14 @@ function generateNodewatcherCompat() end local string=xmlEncode (comTbl, "data", 1) - writeToFile(string,path) + writeToFile(string,path) + --recreate symlink to old location + local fp=uci:get("nodewatcher2","prefs","destination_folder").."/"..path + os.execute("if [ ! -h /lib/gluon/status-page/www/node.data ]; then ln -s "..fp.." /lib/gluon/status-page/www/node.data ; fi") else removeFile(path) - end + end + end @@ -290,8 +294,8 @@ function fetchInterfaces() if i.name~="lo" then i.ipv6={} i.traffic={} - i.traffic.rx=readFirstRow(readFile(ipath.."/statistics/rx_bytes")) - i.traffic.tx=readFirstRow(readFile(ipath.."/statistics/tx_bytes")) + i.traffic.rx=tonumber(readFirstRow(readFile(ipath.."/statistics/rx_bytes"))) + i.traffic.tx=tonumber(readFirstRow(readFile(ipath.."/statistics/tx_bytes"))) -- general interface info for _,ipl in pairs(readOutput("ip addr show "..i.name)) do local match=ipl:match("%s*inet6 ([0-9a-f:]+)(/%d+) .*") @@ -320,7 +324,6 @@ function fetchInterfaces() -- wifi info i.radio={} for _,ipl in pairs(readOutput("iwinfo "..i.name.." info 2>/dev/null")) do - -- print(ipl) local match=ipl:match('ESSID:%s+"(.*)".*') if match~=nil then i.radio.essid=match -- GitLab