Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
[StatsdInput]
address = "localhost:8125"
[StatAccumInput]
type = "StatAccumInput"
ticker_interval = 1
emit_in_fields = true
percent_threshold = 95
[statmetric_atlas_encoder]
type = "SandboxEncoder"
filename = "/etc/hekad/statmetric_atlas_beta.lua"
[atlas]
type = "HttpOutput"
message_matcher = "Type == 'heka.statmetric'"
address = "http://atlas:7101/api/v1/publish"
encoder = "statmetric_atlas_encoder"
[atlas.headers]
Content-Type = ["application/json"]
[DashboardOutput]
ticker_interval = 1
## Debugging items
# [DebugOutput]
# #message_matcher = "Type == 'heka.sandbox.stellar.debug'"
# #message_matcher = "Type == 'heka.sandbox-terminated'"
# #message_matcher = "Type == 'heka.sandbox-terminated'"
# #message_matcher = "TRUE"
# message_matcher = "Type != 'heka.memstat' && Type != 'heka.all-report' && Type != 'heka.sandbox-output'"
# type = "LogOutput"
# encoder = "RstEncoder"
#
# [RstEncoder]
local cjson = require "cjson"
local table = require "table"
function process_message()
local output = {
tags = {
},
metrics = {
}
}
local ts = tonumber(read_message("Fields[timestamp]"))
if not ts then return -1 end
ts = ts * 1000
while true do
typ, name, value, representation, count = read_next_field()
if not typ then break end
if name ~= "timestamp" and typ ~= 1 then -- exclude bytes
local metric_payload = {
tags = {
name = name,
["atlas.dstype"] = "gauge"
},
timestamp = ts,
value = value
}
table.insert(output.metrics, metric_payload)
end
end
inject_payload("json", "atlas_stats", cjson.encode(output))
return 0
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment