mirror of
https://github.com/ntop/ntopng.git
synced 2026-05-02 00:40:10 +00:00
Various SNMP improvemenets
Moved to LuaJIT 2.1.0 updated to the latest git
This commit is contained in:
parent
66f9e346fc
commit
c7ef8d0c46
194 changed files with 130463 additions and 41 deletions
|
|
@ -12,34 +12,45 @@ sendHTTPContentTypeHeader('text/html')
|
|||
ntop.dumpFile(dirs.installdir .. "/httpdocs/inc/header.inc")
|
||||
dofile(dirs.installdir .. "/scripts/lua/inc/menu.lua")
|
||||
|
||||
if true then
|
||||
local rrd_dump = require "rrd_5min_dump_utils"
|
||||
local when = os.time()
|
||||
local config = rrd_dump.getConfig()
|
||||
local time_threshold = when - (when % 60) + 60 - 10 -- safe margin
|
||||
package.path = dirs.installdir .. "/pro/scripts/lua/modules/?.lua;" .. package.path
|
||||
require "snmp_utils"
|
||||
|
||||
community = _GET["community"]
|
||||
host = _GET["host"]
|
||||
snmp_read_interface_counters(config, time_threshold, true)
|
||||
else
|
||||
community = _GET["community"]
|
||||
host = _GET["host"]
|
||||
|
||||
print('Host: '..host.."<p>\n")
|
||||
print('Community: '..community.."<p>\n")
|
||||
|
||||
print('<table class="table table-bordered table-striped">\n')
|
||||
|
||||
sysname = "1.3.6.1.2.1.1.1.0"
|
||||
syscontact = "1.3.6.1.2.1.1.4.0"
|
||||
sysdescr = "1.3.6.1.2.1.1.5.0"
|
||||
|
||||
|
||||
print('Host: '..host.."<p>\n")
|
||||
print('Community: '..community.."<p>\n")
|
||||
|
||||
print('<table class="table table-bordered table-striped">\n')
|
||||
|
||||
sysname = "1.3.6.1.2.1.1.1.0"
|
||||
syscontact = "1.3.6.1.2.1.1.4.0"
|
||||
|
||||
rsp = ntop.snmpget(host, community, sysname, syscontact)
|
||||
if (rsp ~= nil) then
|
||||
for k, v in pairs(rsp) do
|
||||
print('<tr><th width=35%>'..k..'</th><td colspan=2>'.. v..'</td></tr>\n')
|
||||
rsp = ntop.snmpget(host, community, sysname, syscontact, sysdescr)
|
||||
if (rsp ~= nil) then
|
||||
for k, v in pairs(rsp) do
|
||||
print('<tr><th width=35%>'..k..'</th><td colspan=2>'.. v..'</td></tr>\n')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
rsp = ntop.snmpgetnext(host, community, syscontact)
|
||||
if (rsp ~= nil) then
|
||||
for k, v in pairs(rsp) do
|
||||
print('<tr><th width=35%>'..k..'</th><td colspan=2>'.. v..'</td></tr>\n')
|
||||
if(false) then
|
||||
rsp = ntop.snmpgetnext(host, community, syscontact)
|
||||
if (rsp ~= nil) then
|
||||
for k, v in pairs(rsp) do
|
||||
print('<tr><th width=35%>'..k..'</th><td colspan=2>'.. v..'</td></tr>\n')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
print('</table>\n')
|
||||
end
|
||||
|
||||
print('</table>\n')
|
||||
|
||||
|
||||
dofile(dirs.installdir .. "/scripts/lua/inc/footer.lua")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue