From 66788d1bc2261c19041ca377d1d924cfcbe0d7aa Mon Sep 17 00:00:00 2001 From: Robert Ricci Date: Wed, 9 Aug 2006 23:29:12 +0000 Subject: [PATCH] Add scripts to run the magent, analogous to the scripts to run the old version of the stub. --- pelab/common-env.sh | 2 ++ pelab/magent/auto-magent.sh | 38 +++++++++++++++++++++++++++++++++++++ pelab/magent/run-magent.sh | 26 +++++++++++++++++++++++++ 3 files changed, 66 insertions(+) create mode 100644 pelab/magent/auto-magent.sh create mode 100644 pelab/magent/run-magent.sh diff --git a/pelab/common-env.sh b/pelab/common-env.sh index 02161b30c..dffbcfd26 100755 --- a/pelab/common-env.sh +++ b/pelab/common-env.sh @@ -78,6 +78,7 @@ export PROJECT=`echo $NICKNAME | cut -d. -f3`; SCRIPT_LOCATION=`dirname $0` export BASE="${SCRIPT_LOCATION}/../"; export STUB_DIR="${BASE}/stub/"; +export MAGENT_DIR="${BASE}/magent/"; export NETMON_DIR="${BASE}/libnetmon/"; export MONITOR_DIR="${BASE}/monitor/"; export TMPDIR="/var/tmp/"; @@ -93,6 +94,7 @@ export IPMAP="/var/tmp/ip-mapping.txt" # export NETMOND="netmond" export STUBD="stubd" +export MAGENT="magent" export MONITOR="monitor.py" export GENIPMAP="gen-ip-mapping.pl" export NETMON_LIB="libnetmon.so" diff --git a/pelab/magent/auto-magent.sh b/pelab/magent/auto-magent.sh new file mode 100644 index 000000000..0e11e8e95 --- /dev/null +++ b/pelab/magent/auto-magent.sh @@ -0,0 +1,38 @@ +#!/bin/sh + +ARGS=$* + +. `dirname $0`/../common-env.sh + +# +# Start up our own measurement agent +# +echo $SH ${MAGENT_DIR}/run-magent.sh $ARGS +$SH ${MAGENT_DIR}/run-magent.sh $ARGS & +MAGENTPID=$! +# Kill the agent if we get killed - TODO: harsher kill? +trap "$AS_ROOT kill $MAGENTPID; $AS_ROOT killall $MAGENT" EXIT + +# +# Give it time to come up +# +sleep 1 + +# +# Wait for all of the agents to start +# +echo "Waiting for measurement agents to become ready"; +barrier_wait "stub"; + +# +# Wait for all the monitors to come up +# +echo "Waiting for monitors to become ready"; +barrier_wait "monitor"; + +echo "Running!"; + +# +# Wait for our agent to finish +# +wait diff --git a/pelab/magent/run-magent.sh b/pelab/magent/run-magent.sh new file mode 100644 index 000000000..27774b887 --- /dev/null +++ b/pelab/magent/run-magent.sh @@ -0,0 +1,26 @@ +#!/bin/sh +# +# Script to run the monitoring agent +# + +# +# Let common-env know what role we're playing +# +export HOST_ROLE="stub" + +# +# Grab common environment variables +# +. `dirname $0`/../common-env.sh + +# +# Have libnetmon export to a seperate file +# +export LIBNETMON_OUTPUTFILE="/local/logs/libnetmon.out" + +# +# Just run the stub! +# +echo "Running PID $$" +echo "Starting magent on $PLAB_IFACE ($PLAB_IP) Extra arguments: $*" +exec $AS_ROOT $NETMON_DIR/instrument-standalone.sh $MAGENT_DIR/$MAGENT --interface=$PLAB_IFACE $* -- GitLab