Last active
February 9, 2025 20:48
-
-
Save llamafilm/b250973ff0f34441a4f45619c29b5dff to your computer and use it in GitHub Desktop.
Telegraf execd config
This file contains 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
[[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" |
This file contains 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
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