#!/bin/bash

# Install ganglia
# TODO: Remove this once the AMI has ganglia by default

GANGLIA_PACKAGES="ganglia ganglia-web ganglia-gmond ganglia-gmetad"

if ! rpm --quiet -q $GANGLIA_PACKAGES; then
  yum install -q -y $GANGLIA_PACKAGES;
fi
for node in $SLAVES $OTHER_MASTERS; do
  ssh -t -t $SSH_OPTS root@$node "if ! rpm --quiet $GANGLIA_PACKAGES; then yum install -q -y $GANGLIA_PACKAGES; fi" & sleep 0.3
done
wait

#!/bin/bash

# Install ganglia
# TODO: Remove this once the AMI has ganglia by default
yum install -q -y ganglia ganglia-gmetad ganglia-gmond ganglia-web
for node in $SLAVES $OTHER_MASTERS; do
  ssh -t -t $SSH_OPTS root@$node "yum install -q -y ganglia ganglia-gmetad ganglia-gmond ganglia-web" & sleep 0.3
done
wait

--- 
+++ 
@@ -2,8 +2,13 @@
 
 # Install ganglia
 # TODO: Remove this once the AMI has ganglia by default
-yum install -q -y ganglia ganglia-gmetad ganglia-gmond ganglia-web
+
+GANGLIA_PACKAGES="ganglia ganglia-web ganglia-gmond ganglia-gmetad"
+
+if ! rpm --quiet -q $GANGLIA_PACKAGES; then
+  yum install -q -y $GANGLIA_PACKAGES;
+fi
 for node in $SLAVES $OTHER_MASTERS; do
-  ssh -t -t $SSH_OPTS root@$node "yum install -q -y ganglia ganglia-gmetad ganglia-gmond ganglia-web" & sleep 0.3
+  ssh -t -t $SSH_OPTS root@$node "if ! rpm --quiet $GANGLIA_PACKAGES; then yum install -q -y $GANGLIA_PACKAGES; fi" & sleep 0.3
 done
 wait
Check if ganglia is already installed
