I have a test script like below
cat test.sh
#!/bin/bash cat /etc/redhat-release|awk -F " " ‘{ print substr($0, index($0,$1)) }’ sudo /usr/sbin/dmidecode -t 4 | grep Version | head -1 | awk -F " " ‘{ print substr($0, index($0,$2)) }’ sudo /usr/sbin/dmidecode -t 1 | grep Product |awk -F “:” {‘print $2’}| awk -F " " ‘{ print substr($0, index($0,$1)) }’
the above will give output like below in the server.
./test.sh
Red Hat Enterprise Linux Server release 7 (Maipo)
Intel(R) Xeon(R) Gold 6136 CPU @ 3.00GHz
ProLiant DL360 Gen9
the problem is when i get the data in grafana it was like in a same line like below.
Red Hat Enterprise Linux Server release 7 (Maipo) Intel(R) Xeon(R) Gold 6136 CPU @ 3.00GHz ProLiant DL360 Gen9
but want to get the data like i get in the server like below
Red Hat Enterprise Linux Server release 7 (Maipo)
Intel(R) Xeon(R) Gold 6136 CPU @ 3.00GHz
ProLiant DL360 Gen9
can you please let me know how i should configure the exec module in telegraf to get the expected output.
my present exec module in telegraf (/etc/telegraf/telegraf.conf) configuration is like below.
[[inputs.exec]] commands = ["/tmp/test.sh"] name_suffix = “cpumodel” data_format = “value” data_type = “string”
Thanks in advance.