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

Telegraf Execd Go Shim on Windows Error "file does not exist" #7911

Closed
ashishkaransingh opened this issue Jul 28, 2020 · 9 comments
Closed
Labels
area/execd Issues related to execd or plugins that would be better suited to be used through execd
Milestone

Comments

@ashishkaransingh
Copy link

https://github.com/influxdata/telegraf/tree/master/plugins/common/shim

I downloaded and build rand using "go build -o rand cmd/main.go"

image

Then under telegraf.conf I used it as following:

[[inputs.execd]]
  command = ["C:/Users/test_user/Downloads/rand-master/rand-master/rand", "-config", "C:/Users/test_user/Downloads/rand-master/rand-master/plugin.conf"]
  signal = "none"

Then finally i ran it using: telegraf.exe --config telegraf.conf -test
But getting the following error

C:\Users\test_user\Downloads\telegraf-master\telegraf-master>telegraf.exe --config telegraf.conf -test
2020-07-28T16:58:38Z I! Starting Telegraf
2020-07-28T16:58:38Z I! [inputs.execd] Starting process: C:/Users/test_user/Downloads/rand-master/rand-master/rand [-config C:/Users/test_user/Downloads/rand-master/rand-master/plugin.conf]
2020-07-28T16:58:38Z E! [agent] Starting input inputs.execd: failed to start process [C:/Users/test_user/Downloads/rand-master/rand-master/rand -config C:/Users/test_user/Downloads/rand-master/rand-master/plugin.conf]: error starting process: exec: "C:/Users/test_user/Downloads/rand-master/rand-master/rand": file does not exist

What i am missing?

Please help!

@ssoroka
Copy link
Contributor

ssoroka commented Jul 28, 2020

Hi, a couple thoughts:

  1. In windows the file should probably be called rand.exe, as this is normal for windows executable files. You can just rename the rand one, or regenerate it with go build -o rand.exe cmd/main.go
  2. I'm not sure if the slash matters or not. Do forward slashes work in place of backslahes? Or do you need to do something like command = ["C:\\Users\\test_user\\Downloads\\rand-master\\rand-master\\rand.exe", "-config", "C:\\Users\\test_user\\Downloads\\rand-master\\rand-master\\plugin.conf"]?

Let me know where you're at after that.

@ashishkaransingh
Copy link
Author

  1. rand.ex

Hi @ssoroka,

Thank you for your response, greatly appreciate it.
Sure i will try and let you know.

Thanks Again

@ashishkaransingh
Copy link
Author

ashishkaransingh commented Jul 28, 2020

Went little further, now getting the following error:
stderr: "Err loading input: toml: cannot load TOML value of type string into a Go integer"

C:\Users\test_user\Downloads\telegraf-master\telegraf-master>telegraf.exe --config telegraf.conf -test
2020-07-28T17:56:14Z I! Starting Telegraf
2020-07-28T17:56:14Z I! [inputs.execd] Starting process: C:\Users\test_user\Downloads\rand-master\rand-master\rand.exe [-config C:\Users\test_user\Downloads\rand-master\rand-master\plugin.conf]
2020-07-28T17:56:14Z E! [inputs.execd] stderr: "Err loading input: toml: cannot load TOML value of type string into a Go integer"
2020-07-28T17:56:14Z I! [inputs.execd] Process C:\Users\test_user\Downloads\rand-master\rand-master\rand.exe shut down
2020-07-28T17:56:14Z E! [telegraf] Error running agent: input plugins recorded 1 errors

@ssoroka
Copy link
Contributor

ssoroka commented Jul 28, 2020

You might have to share your toml. If you're using my rand demo, min and max are integers and should not be quoted in the config. It's possible there's a bug in the config loading somewhere. Try removing individual lines of the config until you can figure out which one is causing problems; possibly the sample_frequency, as I think some versions of Telegraf before 1.15.1 have bugs with config.Duration.

@ashishkaransingh
Copy link
Author

I have already checked min and max are not quoted.

From plugin.conf

[[inputs.rand]]
	value_name = "value"
	min = 4
	max = 12
	sample_frequency = "1s"

@ashishkaransingh
Copy link
Author

After removing "sample_frequency = "1s" did not get error but no output either?

2020-07-29T11:12:45Z I! Starting Telegraf
2020-07-29T11:12:45Z I! [inputs.execd] Starting process: C:\Users\test_user\Downloads\rand-master\rand-master\rand.exe [-config C:\Users\test_user\Downloads\rand-master\rand-master\plugin.conf]
2020-07-29T11:12:45Z I! [inputs.execd] Process C:\Users\test_user\Downloads\rand-master\rand-master\rand.exe shut down

@ssoroka
Copy link
Contributor

ssoroka commented Aug 7, 2020

By default, processed records aren't written to stdout. Try adding an output like this to see the results:

[[outputs.file]]
  files = ["stdout"]

I think the sample_frequency issue was related to a bug that should be resolved in the latest Telegraf.

Btw, you can probably get a faster response from me (or other helpful people) on the InfluxData community slack #telegraf channel.

@sjwang90 sjwang90 added the area/execd Issues related to execd or plugins that would be better suited to be used through execd label Aug 10, 2020
@ssoroka ssoroka closed this as completed Aug 17, 2020
@ssoroka
Copy link
Contributor

ssoroka commented Aug 17, 2020

I dug into this and was able to replicate your problems. I've patched the rand app to use the latest Telegraf version, and I'll dig into what was going on with the duration setting, which is still an outstanding issue for now. Let me know if you have any further issues.

@ashishkaransingh
Copy link
Author

No further issues on this, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/execd Issues related to execd or plugins that would be better suited to be used through execd
Projects
None yet
Development

No branches or pull requests

3 participants