mirror of https://github.com/aredn/aredn.git
bugfix: aredn sysinfo.json fails with mesh rf off
added json meshrf->status->on/off fixes: #317
This commit is contained in:
parent
27f4356a46
commit
6728fba06b
|
@ -84,11 +84,16 @@ info['node_details']['firmware_mfg']=fw_mfg
|
|||
info['node_details']['firmware_version']=getFirmwareVersion()
|
||||
|
||||
-- Mesh RF info
|
||||
info["meshrf"]={}
|
||||
info["meshrf"]["ssid"]=getSSID()
|
||||
info['meshrf']={}
|
||||
local radio=getMeshRadioDevice()
|
||||
info["meshrf"]["channel"]=getChannel(radio)
|
||||
info["meshrf"]['chanbw']=getChannelBW(radio)
|
||||
if ( radio ~= nill and radio ~= "" ) then
|
||||
info['meshrf']['status']="on"
|
||||
info['meshrf']['ssid']=getSSID()
|
||||
info['meshrf']['channel']=getChannel(radio)
|
||||
info['meshrf']['chanbw']=getChannelBW(radio)
|
||||
else
|
||||
info['meshrf']['status']="off"
|
||||
end
|
||||
|
||||
-- Tunnel info
|
||||
info['tunnels']={}
|
||||
|
@ -97,11 +102,11 @@ local tunnel_installed=false
|
|||
if file_exists("/usr/sbin/vtund") then
|
||||
tunnel_installed="true"
|
||||
end
|
||||
info['tunnels']["tunnel_installed"]=tunnel_installed
|
||||
info['tunnels']['tunnel_installed']=tunnel_installed
|
||||
-- ACTIVE TUNNELS
|
||||
local atc=""
|
||||
atc=os.capture("ifconfig|grep tun|wc -l")
|
||||
info['tunnels']["active_tunnel_count"]=atc:chomp()
|
||||
info['tunnels']['active_tunnel_count']=atc:chomp()
|
||||
|
||||
-- Location info
|
||||
-- LAT/LON
|
||||
|
@ -110,7 +115,7 @@ info['lat']=lat
|
|||
info['lon']=lon
|
||||
|
||||
-- GRID SQUARE
|
||||
info["grid_square"]=getGridSquare()
|
||||
info['grid_square']=getGridSquare()
|
||||
|
||||
-- UPTIME AND LOADAVGS
|
||||
mynix=nixio.sysinfo()
|
||||
|
@ -140,7 +145,7 @@ for pos, i in pairs(ift) do
|
|||
table.insert(tif,nim)
|
||||
end
|
||||
end
|
||||
info["interfaces"]=tif
|
||||
info['interfaces']=tif
|
||||
|
||||
-- HOSTS
|
||||
if string.find(nixio.getenv("QUERY_STRING"):lower(),"hosts=1") then
|
||||
|
@ -177,7 +182,7 @@ if string.find(nixio.getenv("QUERY_STRING"):lower(),"hosts=1") then
|
|||
host['error']="Cannot read hosts file"
|
||||
table.insert(hosts,host)
|
||||
end
|
||||
info["hosts"]=hosts
|
||||
info['hosts']=hosts
|
||||
end
|
||||
|
||||
-- SERVICES
|
||||
|
@ -205,7 +210,7 @@ if string.find(nixio.getenv("QUERY_STRING"):lower(),"services=1") then
|
|||
service['error']="Cannot read services file"
|
||||
table.insert(services,service)
|
||||
end
|
||||
info["services"]=services
|
||||
info['services']=services
|
||||
end
|
||||
|
||||
-- LOCALLY HOSTED SERVICES ONLY
|
||||
|
|
Loading…
Reference in New Issue