github.com/niedbalski/juju@v0.0.0-20190215020005-8ff100488e47/acceptancetests/repository/xenial/mysql/hooks/munin-relation-changed (about) 1 #!/bin/sh 2 3 set -ue 4 5 ip=`relation-get ip` 6 7 if [ -z "$ip" ] ; then 8 echo "Remote node must provide IP" 9 exit 0 10 fi 11 12 reip="^`echo $ip | sed -e 's,\.,\\.,g'`$" 13 14 # Make sure its installed 15 apt-get -y install munin-node libcache-cache-perl 16 17 if grep -q "^allow $reip$" /etc/munin/munin-node.conf ; then 18 echo $ip already has access. 19 else 20 echo "# added by $0 `date`" >> /etc/munin/munin-node.conf 21 echo allow $reip >> /etc/munin/munin-node.conf 22 service munin-node reload 23 fi 24 25 # now tell remote server about our IP 26 relation-set ip=`ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}'|head -n 1`