~gandelman-a/pyjuju/mysql

« back to all changes in this revision

Viewing changes to hooks/munin-relation-changed

  • Committer: Clint Byrum
  • Date: 2011-05-31 23:16:11 UTC
  • Revision ID: clint@ubuntu.com-20110531231611-i87cotv2bw20ky98
adding munin support

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 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`