# Prometheus Client Service Output Plugin \[\[outputs.prometheus\_client\]\] no output for the defined scripts with \[\[inputs.exec\]\]

**URL:** <https://community.influxdata.com/t/prometheus-client-service-output-plugin-outputs-prometheus-client-no-output-for-the-defined-scripts-with-inputs-exec/4862>\
**Category:** Telegraf\
**Tags:** influxdb, telegraf\
**Created:** [April 22, 2018, 3:29pm UTC](https://community.influxdata.com/t/prometheus-client-service-output-plugin-outputs-prometheus-client-no-output-for-the-defined-scripts-with-inputs-exec/4862 "2018-04-22T15:29:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![fchiorascu](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/fchiorascu/32/995_2.png) [@fchiorascu](https://community.influxdata.com/u/fchiorascu)\
**Post date:** [April 22, 2018, 3:29pm UTC](https://community.influxdata.com/t/prometheus-client-service-output-plugin-outputs-prometheus-client-no-output-for-the-defined-scripts-with-inputs-exec/4862/1 "2018-04-22T15:29:14Z")

</div>

Hi,

**Issue:**  
`I'm searching a way to have the metrics collected by telegraf with the help of scripts and after this to expose on localhost:9373/metrics to have it in Prometheus. Kindly does someone have any idea why I don't have the metrics even if I've modified the scripts to give: 0, 1 instead of UP/ DOWN.`

**System:**  
telegraf-1.6.0-1.x86\_64  
influxdb-1.5.2-1.x86\_64

**Telegraf.conf:**

> [[outputs.prometheus\_client]]  
> listen = “:9373”  
> path = “/metrics”  
> expiration\_interval = “25s”  
> string\_as\_label = false

[[inputs.exec]]  
commands = [“/etc/telegraf/scripts/os\_version.sh”]  
name\_override = “os\_version”  
data\_format = “value”  
data\_type = “string”

[[inputs.exec]]  
commands = [“/etc/telegraf/scripts/os\_kernel.sh”]  
name\_override = “os\_kernel”  
data\_format = “value”  
data\_type = “string”

[[inputs.exec]]  
commands = [“/etc/telegraf/scripts/connector\_version.sh”]  
name\_override = “connector\_version”  
data\_format = “value”  
data\_type = “string”

[[inputs.exec]]  
commands = [“/etc/telegraf/scripts/connector\_status.sh”]  
name\_override = “connector\_status”  
data\_format = “value”  
data\_type = “string”

[[inputs.exec]]  
commands = [“/etc/telegraf/scripts/connector\_components.sh”]  
name\_override = “connector\_components\_status”  
data\_format = “value”  
data\_type = “string”

[[inputs.exec]]  
commands = [“/etc/telegraf/scripts/connector\_components\_version.sh”]  
name\_override = “connector\_components\_version”  
data\_format = “value”  
data\_type = “string”

**Telegraf --test output:**  
[root@server1]# /usr/bin/telegraf --config /etc/telegraf/telegraf.conf --test

- Plugin: inputs.exec, Collection 1

> os\_version,host=server1 value=“CentOS Linux 7.4.1708” 1524409762000000000

- Plugin: inputs.exec, Collection 1

> os\_kernel,host=server1 value=“3.10.0-514.6.2.el7.x86\_64” 1524409762000000000

- Plugin: inputs.exec, Collection 1

> connector\_version,host=server1 value=“89” 1524409762000000000

- Plugin: inputs.exec, Collection 1

> connector\_status,host=server1 value=“1” 1524409762000000000

- Plugin: inputs.exec, Collection 1

> connector\_components\_status,host=server1 value=“jedisConnectionOne\_status=1,redisCacheConnectionOne\_status=1,cazMqtt\_status=1,zoMqtt\_status=1,rabbitMQ\_status=1” 1524409762000000000

- Plugin: inputs.exec, Collection 1

> connector\_components\_version,host=server1 value=“jedisConnectionOne\_version=3.2.10,redisCacheConnectionOne\_version=3.2.10,rabbitMQ\_version=3.6.12” 1524409762000000000

[root@server1]# /usr/bin/curl -s localhost:9373/metrics | grep -v “^#”  
go\_gc\_duration\_seconds{quantile=“0”} 0.000198659  
go\_gc\_duration\_seconds{quantile=“0.25”} 0.000198659  
go\_gc\_duration\_seconds{quantile=“0.5”} 0.000199599  
go\_gc\_duration\_seconds{quantile=“0.75”} 0.000199599  
go\_gc\_duration\_seconds{quantile=“1”} 0.000199599  
go\_gc\_duration\_seconds\_sum 0.000398258  
go\_gc\_duration\_seconds\_count 2  
go\_goroutines 22  
go\_memstats\_alloc\_bytes 4.560744e+06  
go\_memstats\_alloc\_bytes\_total 6.054048e+06  
go\_memstats\_buck\_hash\_sys\_bytes 1.447994e+06  
go\_memstats\_frees\_total 14710  
go\_memstats\_gc\_sys\_bytes 442368  
go\_memstats\_heap\_alloc\_bytes 4.560744e+06  
go\_memstats\_heap\_idle\_bytes 802816  
go\_memstats\_heap\_inuse\_bytes 5.849088e+06  
go\_memstats\_heap\_objects 13049  
go\_memstats\_heap\_released\_bytes 0  
go\_memstats\_heap\_sys\_bytes 6.651904e+06  
go\_memstats\_last\_gc\_time\_seconds 1.5244097570822785e+09  
go\_memstats\_lookups\_total 138  
go\_memstats\_mallocs\_total 27759  
go\_memstats\_mcache\_inuse\_bytes 3472  
go\_memstats\_mcache\_sys\_bytes 16384  
go\_memstats\_mspan\_inuse\_bytes 47120  
go\_memstats\_mspan\_sys\_bytes 65536  
go\_memstats\_next\_gc\_bytes 8.387344e+06  
go\_memstats\_other\_sys\_bytes 753854  
go\_memstats\_stack\_inuse\_bytes 688128  
go\_memstats\_stack\_sys\_bytes 688128  
go\_memstats\_sys\_bytes 1.0066168e+07  
process\_cpu\_seconds\_total 0.09  
process\_max\_fds 1024  
process\_open\_fds 9  
process\_resident\_memory\_bytes 1.6125952e+07  
process\_start\_time\_seconds 1.52440975681e+09  
process\_virtual\_memory\_bytes 2.6406912e+08

Any recommendation/ idea?

Kind Regards,

---

<div class="post-metadata">

**Author:** ![daniel](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/daniel/32/142_2.png) [@daniel](https://community.influxdata.com/u/daniel)\
**Post date:** [April 23, 2018, 6:10pm UTC](https://community.influxdata.com/t/prometheus-client-service-output-plugin-outputs-prometheus-client-no-output-for-the-defined-scripts-with-inputs-exec/4862/2 "2018-04-23T18:10:52Z")

</div>

Prometheus doesn’t support string values, but it should work if switch the numeric exec plugins to use `data_type = "float"`. For the strings like “3.10.0-514.6.2.el7.x86\_64” it would probably make sense to turn these into tags, but to do this you would need to have your scripts output in “influx” line protocol format and you will need still need at least one numerical value.

---

<div class="post-metadata">

**Author:** ![fchiorascu](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/fchiorascu/32/995_2.png) [@fchiorascu](https://community.influxdata.com/u/fchiorascu)\
**Post date:** [April 23, 2018, 6:25pm UTC](https://community.influxdata.com/t/prometheus-client-service-output-plugin-outputs-prometheus-client-no-output-for-the-defined-scripts-with-inputs-exec/4862/3 "2018-04-23T18:25:46Z")

</div>

Many thanks Daniel.  
I’ve didn’t paid attention to data\_type, now I’ve figured out this aspect and yes Prometheus doesn’t know to work proper with strings.

[root@server1 ~]# /usr/bin/telegraf --config /etc/telegraf/telegraf.conf --test

- Plugin: inputs.exec, Collection 1

> connector\_version,host=server1 value=90 1524507664000000000

- Plugin: inputs.exec, Collection 1

> connector\_status,host=server1 value=1 1524507664000000000

[root@server1 ~]# /usr/bin/curl -s localhost:9373/romel | grep -v “^#”  
connector\_status{host=“server1”} 1  
connector\_version{host=“server1”} 90
