dbadmin interface sets incorrect hostname on all telegraf subordinates
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Telegraf Charm |
Fix Released
|
Medium
|
Alvaro Uria |
Bug Description
When using the mysql:dbadmin interface to have telegraf poll mysql-specific metrics, the hostname across other telegraf subordinates changes to 'mysql/x'.
The issue lies in get_remote_
This is due to the removal of a test which used the IP address determine the correct unit.
https:/
From a debug session, we can see that the 'mysql' relation will be tested before the juju-info relation and will the return the mysql unit name:
(Pdb) hookenv.
dict_keys(['exec', 'haproxy', 'apache', 'mysql', 'postgresql', 'influxdb-api', 'juju-info', 'mongodb', 'elasticsearch', 'memcached'])
The workaround here is to remove the mysql:dbadmin relation.
Related branches
- Thomas Cuthbert (community): Approve
-
Diff: 147 lines (+79/-15)4 files modifiedlayer.yaml (+1/-0)
reactive/telegraf.py (+22/-5)
test_requirements.txt (+1/-0)
unit_tests/test_telegraf.py (+55/-10)
Shane, my bad
It looks I didn't understand correctly the following: relations_ of_type( rel_type)
"""
rels = hookenv.
"""
However, my quick test works as I expected:
"""
juju deploy ubuntu --to lxd:0
juju deploy mysql --to lxd:1
juju deploy telegraf
juju add-relation ubuntu telegraf:juju-info
juju add-relation mysql:db-admin telegraf:mysql
juju add-relation mysql:juju-info telegraf:juju-info
"""
"juju status --format yaml" shows /pastebin. ubuntu. com/p/KPQvMfgbg c/
https:/
And the "host" label in the /metrics page is: +\.){3} [0-9]+' | xargs -I@ bash -xc 'curl -s @:9103/metrics | egrep -o "host=\"[^\"]+\"" | sort -u' 122:9103/ metrics ubuntu- 0" 200:9103/ metrics mysql-0"
"""
$ juju machines | egrep -o '([0-9]
+ curl -s 10.66.111.
+ egrep -o 'host="[^"]+"'
+ sort -u
host="tgraf:
+ curl -s 10.66.111.
+ egrep -o 'host="[^"]+"'
+ sort -u
host="tgraf:
"""
Note: "tgraf" is the model name