Last active
November 28, 2017 22:46
-
-
Save nathwill/7f5058e92e9026b945f1 to your computer and use it in GitHub Desktop.
heka monitoring
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# heka.toml | |
[hekad] | |
base_dir = '/tmp/heka' | |
[boot] | |
type = "LogstreamerInput" | |
log_directory = '/var/log' | |
file_match = 'boot\.log' | |
[pulse] | |
type = "SandboxFilter" | |
filename = "/tmp/pulse.lua" | |
message_matcher = "Logger != 'pulse'" | |
ticker_interval = 60 | |
[PayloadEncoder] | |
[ekg] | |
type = "FileOutput" | |
message_matcher = "Logger == 'pulse'" | |
path = "/tmp/heka-ekg.log" | |
encoder = "PayloadEncoder" | |
rotation_interval = 24 | |
=============================== | |
-- pulse.lua | |
require "string" | |
total = 0 | |
local count = 0 | |
local last_ns = 0 | |
function process_message() | |
total= total + 1 | |
count = count + 1 | |
return 0 | |
end | |
function timer_event(current_ns) | |
local elapsed = current_ns - last_ns | |
inject_payload("txt", "", | |
string.format("%d messages in the last %d ns; total=%d", | |
count, elapsed, total)) | |
last_ns = current_ns; count = 0 | |
end | |
=============================== | |
# monit.conf | |
check file heka_ekg with path /tmp/heka-ekg.log | |
every 5 cycles | |
if timestamp > 15 minutes | |
then exec "/usr/bin/systemctl restart hekad.service" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment