Skip to content
Browse files

Merge commit 'b86c9a739a0547ec4bb7b3ac939235231182bac4'

  • Loading branch information...
2 parents 220df2c + b86c9a7 commit bd336cbd3e53d25244e277f3af476cf16b237a34 Simple Geebus committed Dec 29, 2010
Showing with 22 additions and 0 deletions.
  1. +22 −0 bin/flume
View
22 bin/flume
@@ -36,6 +36,7 @@ function usage {
echo " master_nowatch Start a Flume Master server (no watchdog)"
echo " class <class> Run specified fully qualified class using Flume environment (no watchdog)"
echo " ex: flume com.cloudera.flume.agent.FlumeNode "
+ echo " status Show the status of the physical node for the localhost"
echo " classpath Dump the classpath used by the java executables"
echo " shell Start the flume shell"
echo " killmaster Kill a running master"
@@ -86,6 +87,8 @@ function append_jars_onto_classpath() {
# name of script
BINPATH=`dirname $0`
+JMX_PORT=8181
+
if [ -f "${BINPATH}/flume-env.sh" ]; then
source "$BINPATH/flume-env.sh"
fi
@@ -99,6 +102,7 @@ JOPTS+="-Dflume.log.file=${FLUME_LOGFILE:-flume.log} "
JOPTS+="-Dflume.root.logger=${FLUME_ROOT_LOGGER:-INFO,console} "
JOPTS+="-Dzookeeper.root.logger=${ZOOKEEPER_ROOT_LOGGER:-ERROR,console} "
JOPTS+="-Dwatchdog.root.logger=${WATCHDOG_ROOT_LOGGER:-INFO,console} "
+JOPTS+="-Dcom.sun.management.jmxremote.port=${JMX_PORT} -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false"
if [ "$cygwin" == false ] ; then
# unix and "unix-like" setup
@@ -287,6 +291,24 @@ elif [ "$CMD" = "killmaster" ] ; then
elif [ "$CMD" = "class" ]; then
# Just do a java class with the environment setup
exec java $JOPTS $UOPTS "$@"
+elif [ "$CMD" = "status" ]; then
+ # Ugly, but it works!
+ JMX_JAR=`find /usr/lib/flume -name jmx*`
+ JMX_OUTPUT=`pwd`/flume_output
+ JMX_COMMAND=`pwd`/flume_commands
+
+ echo beans > $JMX_COMMAND
+ java -jar $JMX_JAR -l localhost:$JMX_PORT -i $JMX_COMMAND -o $JMX_OUTPUT
+ BEANS=`cat $JMX_OUTPUT | grep "type=pn-" | tr "\n" " "`
+ rm $JMX_COMMAND
+ for bean in $BEANS
+ do
+ echo bean $bean >> $JMX_COMMAND
+ echo "get *" >> $JMX_COMMAND
+ done
+ java -jar $JMX_JAR -l localhost:$JMX_PORT -i $JMX_COMMAND -o $JMX_OUTPUT
+ cat $JMX_OUTPUT
+ rm $JMX_OUTPUT $JMX_COMMAND
elif [ "$CMD" = "classpath" ]; then
echo $CLASSPATH
else

0 comments on commit bd336cb

Please sign in to comment.
Something went wrong with that request. Please try again.