Telegraf Execute script task Windows

Hello Everyone,

Am new to Telegraf & have some questions related to possibilities of achieving it from Telegraf.

  1. Execute a Python script which basically will load a table in SQL Server every 1 second.
    I don’t wish to use the SQL Server inbuilt scheduler. There won’t be any output just execution of Python script for table loading with telegraf executing the script every 1 second in background.

2.Execute another Python script to connect to SQL Server , perform some data manipulations from Telegraf. This time the data needs to be pushed out to Influx DB.

The default input driver for SQL Server lacks some functionality that’s the reason I am using the Input.Exec to execute Python scripts.

Please , let me know do I need to run 2 different telegraf instances . 1 for the requirement one & another for second requirement It will be very supportive, if someone can share any example for requirement 1 & 2.

Thanks in advance

Hi @Rishab , welcome to the community !

you can use 1 telegraf instance ,
for example :


commands = ["/tmp/"]


commands = ["/tmp/"]

you can test if telegraf can execute the script as follows
sudo -u telegraf /tmp/

hope this helps ,
best regards

Thank you so much for the quick support. Am able to execute my Python script on windows
with below command

C:\"Program Files"\Telegraf\telegraf.exe --config C:\"Program Files"\Telegraf\telegraf.conf --test

It runs absolutely fine.As mentioned that I need to refer to config file which I do
C:“Program Files”\Telegraf\telegraf.exe --config C:“Program Files”\Telegraf\telegraf.conf --service install
Next I do the below
C:“Program Files”\Telegraf\telegraf.exe --service start
I receive no error in Visual studio code (Admin) but that doesn’t run the telegraf.
Next I tried

net start telegraf

Received the below error
The Telegraf Data Collector Service service is starting.
The Telegraf Data Collector Service service could not be started.

A system error has occurred.

System error 1067 has occurred.

The process terminated unexpectedly.

I even changed the log on to my own windows user acc from ‘Local System Account’

Please help :slight_smile: what am doing wrong it executes as a test parameter but not when I try to start it.
Thanks again for the quick support.

Hi Rishab ,

I am glad your problem is solved ,

best regards