1. ntop Lua Object
The ntop object exposes global utility functions which are not bound to a specific network interface.
Here is some example of recurrent functions calls:
-- An URL
print[[<a href="]] print(ntop.getHttpPrefix()) print[[/lua/if_stats.lua">interface stats</a>]]
-- A POST form
print[[<form method="POST">
<input name="csrf" type="hidden" value="]] print(ntop.getRandomCSRFValue()) print[[" />
<input name="my_custom_value" value="1" />
</form>]]
-- Set a persistent preference
ntop.setPref("ntopng.prefs.my_custom_pref", "my_custom_value")
-- Get a persistent preference
local res = ntop.getPref("ntopng.prefs.my_custom_pref")
-- tprint(res)
- 1.1. Cache API
- 1.2. Prefs API
setPref()getPref()getPrefs()flushCache()listIndexCache()lpushCache()rpushCache()lpopCache()rpopCache()lremCache()ltrimCache()lrangeCache()llenCache()setMembersCache()delMembersCache()getMembersCache()getHashCache()setHashCache()delHashCache()getHashKeysCache()getHashAllCache()getKeysCache()
- 1.3. Filesystem API
- 1.4. Network API
- 1.5. Users API
- 1.6. Misc API
getDirs()getInfo()getUptime()getHttpPrefix()getRandomCSRFValue()isShuttingDown()getLocalNetworks()addLocalNetwork()setMacDeviceType()reloadHostPools()getNetworkNameById()getNetworkIdByName()getHostInformation()systemHostStat()syslog()setLoggingLevel()traceEvent()verboseTrace()gettimemsec()getticks()gettickspersec()isLoginDisabled()hasVLANs()hasGeoIP()isWindows()msleep()getMacManufacturer()md5()exec_sql_query()resetStats()isPro()isEnterpriseM()isEnterpriseL()isPackage()getStartupEpoch()serviceRestart()matchCustomCategory()getTLSVersionName()bitmapIsSet()bitmapSet()bitmapClear()setnDPIProtoCategory()getnDPIProtoCategory()ptreeClear()ptreeInsert()ptreeMatch()isDeadlineApproaching()getDeadline()speedtest()