Browse code

Merge pull request #1 from dtroyer/master

Add munin to stack.sh

Jesse Andrews authored on 2011/09/15 02:58:40
Showing 2 changed files
... ...
@@ -10,3 +10,4 @@ lsof # useful when debugging
10 10
 openssh-server
11 11
 vim-nox
12 12
 locate # useful when debugging
13
+munin
... ...
@@ -35,13 +35,14 @@ KEYSTONE_DIR=$DEST/keystone
35 35
 NOVACLIENT_DIR=$DEST/python-novaclient
36 36
 API_DIR=$DEST/openstackx
37 37
 NOVNC_DIR=$DEST/noVNC
38
+MUNIN_DIR=$DEST/openstack-munin
38 39
 
39 40
 # Specify which services to launch.  These generally correspond to screen tabs
40 41
 ENABLED_SERVICES=${ENABLED_SERVICES:-g-api,g-reg,key,n-api,n-cpu,n-net,n-sch,n-vnc,dash}
41 42
 
42 43
 # Use the first IP unless an explicit is set by ``HOST_IP`` environment variable
43 44
 if [ ! -n "$HOST_IP" ]; then
44
-    HOST_IP=`LC_ALL=C ifconfig  | grep -m 1 'inet addr:'| cut -d: -f2 | awk '{print $1}'`
45
+    HOST_IP=`LC_ALL=C /sbin/ifconfig  | grep -m 1 'inet addr:'| cut -d: -f2 | awk '{print $1}'`
45 46
 fi
46 47
 
47 48
 # Nova network configuration
... ...
@@ -113,12 +114,15 @@ git_clone https://github.com/cloudbuilders/python-novaclient.git $NOVACLIENT_DIR
113 113
 # openstackx is a collection of extensions to openstack.compute & nova 
114 114
 # that is *deprecated*.  The code is being moved into python-novaclient & nova.
115 115
 git_clone https://github.com/cloudbuilders/openstackx.git $API_DIR
116
+# openstack-munin is a collection of munin plugins for monitoring the stack
117
+git_clone https://github.com/cloudbuilders/openstack-munin.git $MUNIN_DIR
116 118
 
117 119
 # Initialization
118 120
 # ==============
119 121
 
120 122
 # setup our checkouts so they are installed into python path
121 123
 # allowing ``import nova`` or ``import glance.client``
124
+cd $NOVA_DIR; sudo python setup.py develop
122 125
 cd $NOVACLIENT_DIR; sudo python setup.py develop
123 126
 cd $KEYSTONE_DIR; sudo python setup.py develop
124 127
 cd $GLANCE_DIR; sudo python setup.py develop
... ...
@@ -178,6 +182,30 @@ sudo mysql -uroot -p$MYSQL_PASS -e "GRANT ALL PRIVILEGES ON *.* TO '$MYSQL_USER'
178 178
 sudo sed -i 's/127.0.0.1/0.0.0.0/g' /etc/mysql/my.cnf
179 179
 sudo service mysql restart
180 180
 
181
+# Munin
182
+# -----
183
+
184
+# allow connections from other hosts
185
+sudo sed -i -e '/Allow from localhost/s/localhost.*$/all/' /etc/munin/apache.conf
186
+
187
+cat >/tmp/nova <<EOF
188
+[keystone_*]
189
+user `whoami`
190
+
191
+[nova_*]
192
+user `whoami`
193
+EOF
194
+sudo mv /tmp/nova /etc/munin/plugin-conf.d/nova
195
+
196
+# configure Munin for Nova plugins
197
+PLUGINS="keystone_stats nova_floating_ips nova_instance_launched nova_instance_ nova_instance_timing nova_services"
198
+for i in $PLUGINS; do
199
+  sudo cp -p $MUNIN_DIR/$i /usr/share/munin/plugins
200
+  sudo ln -sf /usr/share/munin/plugins/$i /etc/munin/plugins
201
+done
202
+sudo mv /etc/munin/plugins/nova_instance_ /etc/munin/plugins/nova_instance_launched
203
+sudo restart munin-node
204
+
181 205
 # Glance
182 206
 # ------
183 207