The charm tries to allow modifying outputs.prometheus_client.listen via the extra_configs setting: https://git.launchpad.net/charm-telegraf/tree/src/reactive/telegraf.py?h=stable/21.10#n1536
However, when I tried this, using the following config:
juju config telegraf extra_options='outputs: prometheus_client: listen: 10.131.59.185:9103'
The charm crashed as follows:
2022-06-08 04:42:12 WARNING config-changed File "/var/lib/juju/agents/unit-ubuntu-torrent-telegraf-0/charm/reactive/telegraf.py", line 1630, in generate_prometheus_output_config 2022-06-08 04:42:12 WARNING config-changed elif int(listen.split(":", 1)[1]) != prometheus_output_port: 2022-06-08 04:42:12 WARNING config-changed ValueError: invalid literal for int() with base 10: '9103"'
(Note the double-quote character after the four digit characters of 9103.)
This seems to be due to get_extra_configs's "JSONification": https://git.launchpad.net/charm-telegraf/tree/src/reactive/telegraf.py?h=stable/21.10#n489
You can see below that `json.dumps` does indeed wrap the value in quotes:
>>> import json, yaml >>> x = '''outputs: ... prometheus_client: ... listen: 10.131.59.185:9103 ... ''' >>> y = yaml.full_load(x) >>> y {'outputs': {'prometheus_client': {'listen': '10.131.59.185:9103'}}} >>> print(y['outputs']['prometheus_client']['listen']) 10.131.59.185:9103 >>> print(json.dumps(y['outputs']['prometheus_client']['listen'])) "10.131.59.185:9103" >>> _
This deployment is kind of weird, hence this weird configuration, but it would useful if it worked as it would allow me to get rid of some potentially expensive iptables on a high-traffic service.
The charm tries to allow modifying outputs. prometheus_ client. listen via the extra_configs setting: https:/ /git.launchpad. net/charm- telegraf/ tree/src/ reactive/ telegraf. py?h=stable/ 21.10#n1536
However, when I tried this, using the following config:
juju config telegraf extra_options= 'outputs: client:
prometheus_
listen: 10.131.59.185:9103'
The charm crashed as follows:
2022-06-08 04:42:12 WARNING config-changed File "/var/lib/ juju/agents/ unit-ubuntu- torrent- telegraf- 0/charm/ reactive/ telegraf. py", line 1630, in generate_ prometheus_ output_ config split(" :", 1)[1]) != prometheus_ output_ port:
2022-06-08 04:42:12 WARNING config-changed elif int(listen.
2022-06-08 04:42:12 WARNING config-changed ValueError: invalid literal for int() with base 10: '9103"'
(Note the double-quote character after the four digit characters of 9103.)
This seems to be due to get_extra_configs's "JSONification": https:/ /git.launchpad. net/charm- telegraf/ tree/src/ reactive/ telegraf. py?h=stable/ 21.10#n489
You can see below that `json.dumps` does indeed wrap the value in quotes:
>>> import json, yaml client' : {'listen': '10.131. 59.185: 9103'}} } 'outputs' ]['prometheus_ client' ]['listen' ]) dumps(y[ 'outputs' ]['prometheus_ client' ]['listen' ])) 59.185: 9103"
>>> x = '''outputs:
... prometheus_client:
... listen: 10.131.59.185:9103
... '''
>>> y = yaml.full_load(x)
>>> y
{'outputs': {'prometheus_
>>> print(y[
10.131.59.185:9103
>>> print(json.
"10.131.
>>> _
This deployment is kind of weird, hence this weird configuration, but it would useful if it worked as it would allow me to get rid of some potentially expensive iptables on a high-traffic service.