Skip to content

Instantly share code, notes, and snippets.

@llamafilm
Last active February 9, 2025 20:48
Show Gist options
  • Save llamafilm/b250973ff0f34441a4f45619c29b5dff to your computer and use it in GitHub Desktop.
Save llamafilm/b250973ff0f34441a4f45619c29b5dff to your computer and use it in GitHub Desktop.
Telegraf execd config
[[inputs.execd]]
command = ["python", "-u", "./python-execd.py", "localhost"]
data_format = "influx"
signal = "STDIN"
[[outputs.file]]
files = ["stdout"]
use_batch_format = false
data_format = "influx"
import random
import sys
import time
sys.stderr.write("D! Waiting for input on stdin...\n")
while True:
sys.stdin.readline()
host = sys.argv[1]
value = random.random()
timestamp = time.time_ns()
print(f'mymetric,source={host} value={value} {timestamp}\n')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment