Telegraf: [BUG] windows, can not add config-directory with "-service install"

Created on 21 Sep 2016  路  5Comments  路  Source: influxdata/telegraf

Hi,

"-service install" does not install the service with "-config-directory c:program filestelegraftelegraf.d" even if we specify it during "service install"

I'm running telegraf 1.0.0 on windows 2012R2

To reproduce, just add the service as written in the documentation and check "path to executable" on windows service.

Regards

bug help wanted need more info platforwindows

All 5 comments

dupe of #1137

I'm not sure this is the same problem.

With version previous 1.0.0, I was using "nssm" and telegraf.d was "working". Files inside were read. But we can only declare one of each input.

About this bug, no file inside telegraf.d are readen. In fact, "-config-directory" is not set on the command line.

Whilst annoying, it's reasonably trivial to work around this by using sc.exe to update the the service binPath following installing with --service install:

````
c:telegraftelegraf.exe --config c:telegrafconfigtelegraf.conf --service install"

sc.exe config telegraf binPath= "c:telegraftelegraf.exe -config c:telegrafconfigtelegraf.conf -config-directory c:telegrafconfig.d"
````

It's also worth noting that whilst https://github.com/cosmopetrich/telegraf/commit/fa8f9b534e23220da16f4bfe80417a341d892721 adds the ability to use the -config-directory switch on the service startup (leveraged above), --service install still doesn't pass the option through to the service configuration if you specify it.

Well done @davestephens

Just replace sc.exe update by sc.exe config worked for me.

With the default installation dir :

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

So, with the right way for quotes :

sc config telegraf binPath= """"C:\Program Files\Telegraf\telegraf.exe""" -config """C:\Program Files\Telegraf\telegraf.conf""" -config-directory """C:\Program Files\Telegraf\telegraf.d""""

Isn't this bug fixed by #2330 ?

Was this page helpful?
0 / 5 - 0 ratings