Commit 594b7fb0 authored by Robert Ricci's avatar Robert Ricci

Partial checkin of my new scripting framework. The only

user-noticeable difference so far is that un-monitor-libnetmon.sh
no longer has to be passed the pid and eid
parent 091a5e9a
#!/bin/sh
#
# Simple shell script to get some environment variables useful for pelab
# shell scripts
#
#
# Node/experiment info
#
export NICKNAME=`cat /var/emulab/boot/nickname`;
export HOSTNAME=`echo $NICKNAME | cut -d. -f1`;
export PROJECT=`echo $NICKNAME | cut -d. -f2`;
export EXPERIMENT=`echo $NICKNAME | cut -d. -f3`;
#
# Important directories
#
SCRIPT_LOCATION=`dirname $0`
export BASE="${SCRIPT_LOCATION}/../";
export STUB_DIR="${BASE}/stub/";
export NETMON_DIR="${BASE}/libnetmon/";
export MONITOR_DIR="${BASE}/monitor/";
export TMPDIR="/var/tmp/";
#!/bin/sh
. `dirname $0`/../common-env.sh
LIB_SO="libnetmon.so"
SOCK="${TMPDIR}/netmon.sock";
#
# Try once to build the library
#
if ! [ -e $NETMON_DIR/$LIB_SO ]; then
echo "Building $LIB_SO";
gmake -C $NETMON_DIR $LIB_SO
fi
#
# Okay, let the user take care of it
#
if ! [ -e $NETMON_DIR/$LIB_SO ]; then
echo "$NETMON_DIR/$LIB_SO missing - run 'gmake' in $NETMON_DIR to build it"
exit 1;
fi
#
# Export the magic juice that will make programs use libnetmon
#
export LD_LIBRARY_PATH=$NETMON_DIR
export LD_PRELOAD=$LIB_SO
export LIBNETMON_SOCKPATH=$SOCK
#export LIBNETMON_OUTPUTVERSION=2
#!/bin/sh
SCRIPT=`which $0`
SCRIPT_LOCATION=`dirname $SCRIPT`
LIB_LOCATION=$SCRIPT_LOCATION/../libnetmon/
LIB_SO=libnetmon.so
SOCK=/var/tmp/netmon.sock
if ! [ -x $LIB_LOCATION/$LIB_SO ]; then
echo "$LIB_LOCATION/$LIB_SO missing - run 'gmake' in $LIB_LOCATION to build it"
exit 1;
fi
export LD_LIBRARY_PATH=$LIB_LOCATION
export LD_PRELOAD=$LIB_SO
export LIBNETMON_SOCKPATH=$SOCK
#
# Load in the appropriate environment variables
#
. `dirname $0`/instrument-env.sh
echo "Instrumenting '$@' with libnetmon"
$@
exec $@
#!/bin/sh
#
# Script to run the monitor, collecting data from libnetmon
#
if [ $# != 3 ]; then
if [ $# != 4 ]; then
echo "Usage: $0 <project> <experiment> <my-ip> [stub-ip]"
#
# Grab common environment variables
#
. `dirname $0`/../common-env.sh
if [ $# != 1 ]; then
if [ $# != 2 ]; then
echo "Usage: $0 <my-ip> [stub-ip]"
exit 1;
fi
SIP=$4
fi
PID=$1
EID=$2
MIP=$3
PID=$PROJECT
EID=$EXPERIMENT
MIP=$1
NETMOND=netmond
SCRIPT=`which $0`
SCRIPT_LOCATION=`dirname $SCRIPT`
BIN_LOCATION=$SCRIPT_LOCATION/../libnetmon/
BIN=netmond
if ! [ -x "$NETMON_DIR/$NETMOND" ]; then
gmake -C $NETMON_DIR $NETMOND
fi
if ! [ -x $BIN_LOCATION/$BIN ]; then
echo "$BIN_LOCATION/$BIN missing - run 'gmake' in $BIN_LOCATION to build it"
if ! [ -x "$NETMON_DIR/$NETMOND" ]; then
echo "$NETMON_DIR/$NETMOND missing - run 'gmake' in $NETMOND_DIR to build it"
exit 1;
fi
echo "Starting up netmond for $PID/$EID $MIP $SIP";
$BIN_LOCATION/$BIN | python monitor.py ip-mapping.txt $PID/$EID $MIP $SIP
$NETMON_DIR/$NETMOND | python $MONITOR_DIR/monitor.py ip-mapping.txt $PID/$EID $MIP $SIP
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment