ntopng/scripts/lua/modules/grafana/index.lua
2017-06-07 19:02:28 +02:00

23 lines
611 B
Lua

--
-- (C) 2013-17 - ntop.org
--
-- This page is requested by grafana Simple JSON plugin when testing the datasource
-- datasource test involes a request to / that is mapped by ntopng to index.lua
dirs = ntop.getDirs()
package.path = dirs.installdir .. "/scripts/lua/modules/?.lua;" .. package.path
require "lua_utils"
require "grafana_utils"
local json = require("dkjson")
if isCORSpreflight() then
processCORSpreflight()
else
local corsr = {}
corsr["Access-Control-Allow-Origin"] = _SERVER["Origin"]
sendHTTPHeader('application/json', nil, corsr)
print(json.encode({status="OK"}, nil))
end