Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] windows, can not add config-directory with "-service install" #1797

Closed
GuillaumeLohez opened this issue Sep 21, 2016 · 5 comments
Closed
Labels
bug unexpected problem or unintended behavior help wanted Request for community participation, code, contribution platform/windows

Comments

@GuillaumeLohez
Copy link

Hi,

"-service install" does not install the service with "-config-directory c:\program files\telegraf\telegraf.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

@GuillaumeLohez GuillaumeLohez changed the title windows, can not add config-directory with "-service install" [BUG] windows, can not add config-directory with "-service install" Sep 21, 2016
@sparrc
Copy link
Contributor

sparrc commented Sep 21, 2016

dupe of #1137

@sparrc sparrc closed this as completed Sep 21, 2016
@GuillaumeLohez
Copy link
Author

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.

@sparrc sparrc reopened this Sep 21, 2016
@sparrc sparrc added bug unexpected problem or unintended behavior platform/windows help wanted Request for community participation, code, contribution labels Sep 21, 2016
@nhaugo nhaugo added this to the Future Milestone milestone Sep 28, 2016
@davestephens
Copy link

davestephens commented Mar 29, 2017

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:\telegraf\telegraf.exe --config c:\telegraf\config\telegraf.conf --service install"

sc.exe config telegraf binPath= "c:\telegraf\telegraf.exe -config c:\telegraf\config\telegraf.conf -config-directory c:\telegraf\config.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.

@Papyruse
Copy link

Papyruse commented Mar 29, 2017

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""""

@PierreF
Copy link
Contributor

PierreF commented Apr 18, 2017

Isn't this bug fixed by #2330 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug unexpected problem or unintended behavior help wanted Request for community participation, code, contribution platform/windows
Projects
None yet
Development

No branches or pull requests

7 participants