Comment 1 for bug 1799563

Revision history for this message
Brian Murray (brian-murray) wrote :

I've added the following hook to the daisy retracer charm:

 $ ls -lh hooks/juju-info-relation-joined
-rwxrwxr-x 1 bdmurray bdmurray 369 Nov 8 14:08 hooks/juju-info-relation-joined
[ 3:33PM 10881 ] [ bdmurray@impulse:~/source-trees/daisy-plucker-charms/xenial/daisy-retracer ]
 $ cat hooks/juju-info-relation-joined
#!/bin/bash

. $(dirname $0)/common

CONF=/etc/telegraf/telegraf.d/retracer.conf
echo "[[inputs.exec]]\n" > $CONF
echo " commands = [\n" >> $CONF
for arch in ${ARCHITECTURES}; do
  echo "\"${CODE_LOCATION}/tools/retracer_check.sh $arch\",\n" >> $CONF
done
echo " ]\n" >> $CONF
echo " timeout = \"5s\"\n" >> $CONF
echo " data_format = \"influx\"\n" >> $CONF

However it is never run on the unit despite the juju-info relationship being joined.

ubuntu@juju-3a2dd5-stg-error-tracker-9:~$ sudo grep juju-info /var/log/juju/unit-retracer-app-0.log
2018-11-14 18:23:44 INFO juju.worker.uniter.relation relations.go:495 joining relation "telegraf-retracer-app:juju-info retracer-app:juju-info"
2018-11-14 18:23:45 INFO juju.worker.uniter.relation relations.go:531 joined relation "telegraf-retracer-app:juju-info retracer-app:juju-info"
...

Do you have any ideas about how I can get the telegraf configuration file setup the way you'd like?