Error 1067 - Telegraf WIndows service

I tried installing telegraf as windows service, on invoking the Telegraf service from services manager, received process terminated error - 1067. and there is no much info on windows event logger too.

Command used:
telegraf.exe --service install --config “E:\temp\Telegraf\telegraf.conf”
telegraf.exe --service start

Note :

  1. It is working fine if we try to run the Telegraf from command prompt with following command - ‘telegraf -config telegraf.conf’

Any suggestion for troubleshooting the issues

Thanks in advance on looking into the issue.

This usually happens when you don’t use the absolute path to the configuration file, or when the path is not valid.

Have a look at the service properties and ensure the --config is right, you can see that in the “path to executable” just below the “Description”. (and post it here if possible)
You might need to unregister the service and register it back if the parameter is not correctly set.

You can also try to don’t use the double quotes around the path, or to use single quotes. (but I think neither of them will help)

Thanks for response … Even I tried installing the telegraf as windows service in another machine in C:drive under program files, but there also same kind of error.

This is value it points to path to executable in the recent one installed “C:\Program Files\Telegraf\telegraf.exe” --config “C:\Program Files\Telegraf\telegraf.conf” --service-name telegraf

Maybe we can get something more verbose using PowerShell

Start-Service -Name telegraf -Verbose

try it and let me know

I would also check the permission of the user running the service, but by default it should be “system”, so godlike privileges.
If you have no time to look into it you can use nssm as a workaround (not a real workaround tho, as it’s commonly used to run services on windows), it will achieve the same result

Thanks for response.

Received generic error, not much detail even with verbose,

VERBOSE: Performing the operation “Start-Service” on target “Telegraf Data Collector Service (telegraf)”.
Start-Service : Failed to start service ‘Telegraf Data Collector Service (telegraf)’.
At line:1 char:1

  • Start-Service -Name telegraf -Verbose
  •   + CategoryInfo          : OpenError: (System.ServiceProcess.ServiceController:ServiceController) [Start-Service] 
     , ServiceCommandException
      + FullyQualifiedErrorId : StartServiceFailed,Microsoft.PowerShell.Commands.StartServiceCommand

I have telegraf running on several Windows hosts and this happens only when the path to config is incorrect or there is toml parsing error.

You said that it works fine when you run it from cmd, but the command you posted is ‘telegraf -config telegraf.conf’, note that there is only one dash before config… and that’s a whole different command for telegraf, it outputs its default configuration to stdout. (but maybe is just a typo)

I’d suggest you try to run
.\telegraf.exe --config __AbsolutePathToConf__ --test
also enable the debug logging for telegraf and write its log to a file (see the “agent” section of the config).
Then have a look at the log file for errors.

If there are no parsing or critical plugin related errors, then I have no clue about what could it be.

let me know what you find out

Thanks for the response.


On trying with the above command, found following log to command prompt

C:\Program Files\Telegraf>.\telegraf.exe --config “C:\Program Files\Telegraf\telegraf.conf” --test

2020-11-06T09:51:57Z I! Starting Telegraf 1.14.4

swap,host=XXHOSTNAMEXX free=31413997568i,total=35432873984i,used=4018876416i,used_percent=0.11342225352125701 1604656318000000000

And goes on with … win_proc, CPU, disk, device , diskio… mem

In Log file just seeing following line alone - 2020-11-06T09:51:57Z D! [agent] Initializing plugins

Note : Another observation, when ever the specific machine is restarted, the Telegraf Data collector service runs automatically. When ever if it is tried to stop and start it again - It throws the same error -‘Erro -1067’