diff options
Diffstat (limited to 'quagga-model.lua')
-rw-r--r-- | quagga-model.lua | 39 |
1 files changed, 36 insertions, 3 deletions
diff --git a/quagga-model.lua b/quagga-model.lua index 21ca098..be045d5 100644 --- a/quagga-model.lua +++ b/quagga-model.lua @@ -29,6 +29,30 @@ local function get_version() return cmd_output_result,cmd_output_error end +local function get_routes() + local cmd_output_result, cmd_output_error + local cmd = "/sbin/route -n 2>/dev/null" + local f = io.popen( cmd ) + local cmd_output_result = f:read("*a") + return cmd_output_result,cmd_output_error +end + +local function get_iproute() + local cmd_output_result, cmd_output_error + local cmd = "/bin/ip route 2>/dev/null" + local f = io.popen( cmd ) + local cmd_output_result = f:read("*a") + return cmd_output_result,cmd_output_error +end + +local function get_bgpinfo() + local cmd_output_result, cmd_output_error + local cmd = "/usr/sbin/bgpd --version 2>/dev/null" + local f = io.popen( cmd ) + local cmd_output_result = f:read("*a") + return cmd_output_result,cmd_output_error +end + local function autostarts() local cmd_output_result, cmd_output_error local cmd = "/sbin/rc_status | egrep '^S' | egrep '" .. processname .."' 2>/dev/null" @@ -85,10 +109,19 @@ function getstatus() }) -- THIS IS WHERE WE PRESENT THE OUTPUT FROM TELNET - status.stats = cfe({ name="stats", - label="Programstatus reports", - value="xxx", + status.iproute = cfe({ name="iproute", + label="ip route", + value=get_iproute(), + }) + status.routes = cfe({ name="routes", + label="route -n", + value=get_routes(), }) + status.bgpstats = cfe({ name="bgpstats", + label="BGP version", + value=get_bgpinfo(), + }) + return status end |