2015-09-19 00:07:03 +02:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# Copyright (C) 2015 Cloudius Systems, Ltd.
|
|
|
|
|
2015-12-13 10:27:19 +01:00
|
|
|
JMX_PORT="7199"
|
|
|
|
API_ADDR=""
|
|
|
|
API_PORT=""
|
|
|
|
CONF_FILE=""
|
2015-09-19 00:07:03 +02:00
|
|
|
PARAM_HELP="-h"
|
|
|
|
PARAM_JMX_PORT="-jp"
|
|
|
|
PARAM_API_PORT="-p"
|
|
|
|
PARAM_ADDR="-a"
|
|
|
|
PARAM_LOCATION="-l"
|
|
|
|
LOCATION="target"
|
2015-12-13 10:27:19 +01:00
|
|
|
PARAM_FILE="-cf"
|
2016-03-01 18:52:26 +01:00
|
|
|
ALLOW_REMOTE="-r"
|
|
|
|
REMOTE=0
|
2015-09-19 00:07:03 +02:00
|
|
|
|
|
|
|
print_help() {
|
|
|
|
cat <<HLPEND
|
|
|
|
|
2015-12-13 10:27:19 +01:00
|
|
|
scylla-jmx [$PARAM_HELP] [$PARAM_API_PORT port] [$PARAM_ADDR address] [$PARAM_JMX_PORT port] [$PARAM_FILE file]
|
2015-09-19 00:07:03 +02:00
|
|
|
|
|
|
|
This script is used to run the jmx proxy
|
|
|
|
|
|
|
|
By default it would connect to the local API ($API_ADDR) and will listen on the JMX port ($JMX_PORT)
|
|
|
|
|
|
|
|
This script receives the following command line arguments:
|
|
|
|
|
|
|
|
$PARAM_HELP - print this help screen and exit
|
|
|
|
$PARAM_JMX_PORT <port> - The jmx port to open
|
|
|
|
$PARAM_API_PORT <port> - The API port to connect to
|
|
|
|
$PARAM_ADDR <address> - The API address to connect to
|
2015-12-13 10:27:19 +01:00
|
|
|
$PARAM_FILE <file> - A configuration file to use
|
2015-09-19 00:07:03 +02:00
|
|
|
$PARAM_LOCATION <location> - The location of the jmx proxy jar file
|
2016-03-01 18:52:26 +01:00
|
|
|
$ALLOW_REMOTE - When set allow remote jmx connectivity
|
2015-09-19 00:07:03 +02:00
|
|
|
HLPEND
|
|
|
|
}
|
|
|
|
|
|
|
|
while test "$#" -ne 0
|
|
|
|
do
|
|
|
|
case "$1" in
|
|
|
|
"$PARAM_API_PORT")
|
2015-12-13 10:27:19 +01:00
|
|
|
API_PORT="-Dapiport="$2
|
2015-09-19 00:07:03 +02:00
|
|
|
shift 2
|
|
|
|
;;
|
|
|
|
"$PARAM_ADDR")
|
2015-12-13 10:27:19 +01:00
|
|
|
API_ADDR="-Dapiaddress="$2
|
2015-09-19 00:07:03 +02:00
|
|
|
shift 2
|
|
|
|
;;
|
|
|
|
"$PARAM_PORT")
|
|
|
|
API_ADDR=$2
|
|
|
|
shift 2
|
|
|
|
;;
|
|
|
|
"$PARAM_JMX_PORT")
|
|
|
|
JMX_PORT=$2
|
|
|
|
shift 2
|
|
|
|
;;
|
|
|
|
"$PARAM_LOCATION")
|
|
|
|
LOCATION=$2
|
|
|
|
shift 2
|
|
|
|
;;
|
2015-12-13 10:27:19 +01:00
|
|
|
"$PARAM_FILE")
|
|
|
|
CONF_FILE="-Dapiconfig="$2
|
|
|
|
shift 2
|
|
|
|
;;
|
2016-03-01 18:52:26 +01:00
|
|
|
"$ALLOW_REMOTE")
|
|
|
|
REMOTE=1
|
|
|
|
shift 1
|
|
|
|
;;
|
2015-09-19 00:07:03 +02:00
|
|
|
"$PARAM_HELP")
|
|
|
|
print_help
|
|
|
|
exit 0
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
2016-03-01 18:52:26 +01:00
|
|
|
if [ $REMOTE -eq 1 ]; then
|
|
|
|
REMOTE="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=$JMX_PORT -Dcom.sun.management.jmxremote.rmi.port=$JMX_PORT -Dcom.sun.management.jmxremote.local.only=false"
|
|
|
|
else
|
|
|
|
REMOTE="-Dcassandra.jmx.local.port=$JMX_PORT"
|
|
|
|
fi
|
|
|
|
|
|
|
|
exec java $API_ADDR $API_PORT $CONF_FILE $REMOTE -Xmx256m -XX:+UseSerialGC -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -jar $LOCATION/scylla-jmx-1.0.jar
|