Hi experts,
Is it possible to the use --pidfile startup option when telegraf is running as a windows service?
i tried adding this to “Start Parameters” field from Services > “Telegraf Data Collector Service” > Properties panel. But when i click OK or Apply, the parameters i specified get cleared out. Looks like the start parameters is not taking effect for the telegraf service.
You can create the service manually to add the extra argument. It is possible to do this with the sc.exe command packaged with Windows but I recommend using NSSM instead.
Thanks Daniel. May i trouble you further to share either the sc.exe or NSSM arguments to create the service so i can create it just like “telegraf.exe --service install”? I’ll add pidfile argument to it. i’m worried that the service i install manually may differ from the one installed by telegraf.exe in some other ways that i don’t want…which is why i’m requesting for this info.
Thanks again!
Then just add the arguments, --config "C:\Program Files\Telegraf\telegraf.conf", with the correct path to the config file and then you will just need to add the --pidfile argument.
Thanks Daniel. Tied a few options but the service did not start or started without creating the pidfile.
For eg.,
sc.exe create telegraf binPath= “C:\Program Files\Telegraf\telegraf.exe --config C:\Program Files\Telegraf\telegraf.conf --pidfile C:\Program Files\Telegraf\telegraf.pid” DisplayName= “Telegraf Data Collector Service”
created a service but on starting resulted in an error
No sweat. This is not urgent for me. i’m not blocked on this one currently. Thanks for your help.