I am attempting to use telegraf execd with a python script running inside a virtual environment in windows that outputs line protocol once per second (reading from a wss websocket). If I use the influx api, the lines will write to database.
I created a batch script, to activate and run, but when I point to it from the config file, this seems to cause the agent to immediately stop the inputs.
Can anyone point me in the right direction? I tried to write a command instead of using a batch file, but I donāt have enough experience with this, and am not sure if itās even possible to have more than one command in the config file?
The batch looks like this:
@ECHO OFF
call C:\Users\wll\src\venv\alas\Scripts\activate.bat
C:\Users\wll\src\wss.py
pause >nul
Config file points to it:
[[inputs.execd]]
command = [āC:\Program Files\Telegraf\wss.batā]
Cheers and thanks!
PS C:\Windows\System32> telegraf --debug --config C:"Program Files"\Telegraf\telegraf.conf --test
2023-07-05T01:24:11Z I! Loading config: C:\Program Files\Telegraf\telegraf.conf
2023-07-05T01:24:11Z I! Starting Telegraf 1.27.1
2023-07-05T01:24:11Z I! Available plugins: 237 inputs, 9 aggregators, 28 processors, 23 parsers, 59 outputs, 4 secret-stores
2023-07-05T01:24:11Z I! Loaded inputs: execd
2023-07-05T01:24:11Z I! Loaded aggregators:
2023-07-05T01:24:11Z I! Loaded processors:
2023-07-05T01:24:11Z I! Loaded secretstores:
2023-07-05T01:24:11Z W! Outputs are not used in testing mode!
2023-07-05T01:24:11Z I! Tags enabled: host=wll-instance-1
2023-07-05T01:24:11Z D! [agent] Initializing plugins
2023-07-05T01:24:11Z D! [agent] Starting service inputs
2023-07-05T01:24:11Z I! [inputs.execd] Starting process: C:\Program Files\Telegraf\wss.bat
2023-07-05T01:24:11Z D! [agent] Stopping service inputs
2023-07-05T01:24:16Z E! [inputs.execd] Error in plugin: read |0: file already closed
2023-07-05T01:24:16Z E! [inputs.execd] Error in plugin: error reading stderr: read |0: file already closed
2023-07-05T01:24:16Z I! [inputs.execd] Process C:\Program Files\Telegraf\wss.bat shut down
2023-07-05T01:24:16Z D! [agent] Input channel closed
2023-07-05T01:24:16Z D! [agent] Stopped Successfully
2023-07-05T01:24:16Z E! [telegraf] Error running agent: input plugins recorded 2 errors