Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Send session to InfluxDB
- uptime_skip = 10 -- do not sessions less 10 seconds
- function auth_request(session_id, request, callback)
- if request ~= nil then
- callback(true)
- return nil
- end
- local stat = http_output_client_list[session_id]
- local ctime = os.time()
- local uptime = ctime - stat.st
- if uptime_skip > uptime then
- return nil
- end
- local content = "session" ..
- ",host=" .. hostname ..
- ",id=" .. stat.channel_id ..
- ",name=" .. stat.channel_name ..
- ",addr=" .. stat.request.addr ..
- " uptime=" .. uptime ..
- " " .. ctime .. "000000000"
- local event_config = {
- host = _event_request.host,
- port = _event_request.port,
- path = _event_request.path,
- method = "POST",
- headers = {
- "User-Agent: Astra " .. astra.version,
- "Host: " .. _event_request.host .. ":" .. _event_request.port,
- "Content-Type: application/x-www-form-urlencoded",
- "Content-Length: " .. #content,
- "Connection: close"
- },
- callback = function(self, response)
- if response.code ~= 204 then
- log.error(("[stream.lua] event_request_send() failed %d:%s")
- :format(response.code, response.message))
- end
- end,
- content = content,
- }
- http_request(event_config)
- end
Advertisement
Add Comment
Please, Sign In to add comment