~ibm-demo/charms/trusty/mediawiki/trunk

« back to all changes in this revision

Viewing changes to hooks/munin-relation-changed

  • Committer: Clint Byrum
  • Date: 2012-06-28 00:02:47 UTC
  • Revision ID: clint@ubuntu.com-20120628000247-2xdxjgz8pz2480um
removing old broken munin bits

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
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
 
fi
23
 
 
24
 
service munin-node reload
25
 
 
26
 
# Ubuntu package already enables all plugins at install time.
27
 
 
28
 
# now tell remote server about our IP
29
 
relation-set ip=`ifconfig  | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}'|head -n 1`