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

[inputs.exec]: Error in plugin: metric parse error #6113

Closed
beyondht2003 opened this issue Jul 12, 2019 · 1 comment
Closed

[inputs.exec]: Error in plugin: metric parse error #6113

beyondht2003 opened this issue Jul 12, 2019 · 1 comment

Comments

@beyondht2003
Copy link

beyondht2003 commented Jul 12, 2019

Relevant telegraf.conf:

System info:

Steps to reproduce:

  1. ...
    [[inputs.exec]]
    commands = [
    "/data/telegraf/test.sh"
    ]

test.sh file

#!/bin/sh
ias_pid=16781
heap=/nemo/jdk8/bin/jstat -gc $ias_pid|tail -n1
ias_m=echo "$heap"|awk -F " " '{print $9}'
tempv=echo "scale=0; $ias_m/1"|bc
#tempv=64100.1
echo "multi_proc,tag=tagvalue ias_m=$tempv"

  1. ...
    run test.sh directly
    [app@centos telegraf]$ ./test.sh
    multi_proc,tag=tagvalue ias_m=64896

but telegraf.log does not work, cannot read the value

[app@centos telegraf]$ tail -f /var/log/telegraf/telegraf.log
2019-07-12T06:42:08Z E! [inputs.exec]: Error in plugin: metric parse error: expected field at 1:31: "multi_proc,tag=tagvalue ias_m="

[app@centos telegraf]$ sudo -u telegraf ./test.sh
Could not attach to 16781
(standard_in) 1: syntax error
multi_proc,tag=tagvalue ias_m=
user telegraf doesnot support jstat?

Expected behavior:

Actual behavior:

[inputs.exec]: Error in plugin: metric parse error

Additional info:

@beyondht2003
Copy link
Author

#2215
Similar problem, I add telegraf to sudo and it works !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant