Commit 23660690 authored by Robert Ricci's avatar Robert Ricci

Change run-monitor-libnetmon.sh to run netmond, instead of the

application directly.

Add a new script, instrument.sh, that runs your app with libnetmon,
which will connect to netmond, and thus to the monitor.

Change both to allow them to be run from arbitrary directories - you
no longer have to cd into the monitor directory to run them.
parent 21da5416
#!/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
echo "Instrumenting '$@' with libnetmon"
$@
#!/bin/sh #!/bin/sh
LIB_LOCATION=../libnetmon/
LIB_SO=libnetmon.so if [ $# != 2 ]; then
if ! [ -x $LIB_LOCATION/$LIB_SO ]; then echo "Usage: $0 pid eid"
echo "$LIB_LOCATION/$LIB_SO missing - run 'gmake' in $LIB_LOCATION to build it"
exit 1; exit 1;
fi fi
export LD_LIBRARY_PATH=$LIB_LOCATION PID=$1
export LD_PRELOAD=$LIB_SO EID=$2
SCRIPT=`which $0`
SCRIPT_LOCATION=`dirname $SCRIPT`
BIN_LOCATION=$SCRIPT_LOCATION/../libnetmon/
BIN=netmond
PID=shift if ! [ -x $BIN_LOCATION/$BIN ]; then
EID=shift echo "$BIN_LOCATION/$BIN missing - run 'gmake' in $BIN_LOCATION to build it"
exit 1;
fi
echo "$0 running $@"; echo "Starting up netmond for $PID $EID";
$@ | python monitor.py ip-mapping.txt $PID $EID $BIN_LOCATION/$BIN | python monitor.py ip-mapping.txt $PID $EID
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