Unverified Commit 391eac9b authored by zq0757's avatar zq0757 Committed by GitHub

[Feature][admin] Added jmx monitoring (#1475)

* The auto-sh script of dinky solves the problem of hosting datasophon when starting or stopping dinky service when integrating datasophon with dinky. * Add jmx monitoring * Add jmx monitoring Co-authored-by: 's avatarzhagnqiao <zhangqiao@aistrong.com>
parent e1db9a22
......@@ -207,10 +207,33 @@
<groupId>com.dlink</groupId>
<artifactId>dlink-process</artifactId>
</dependency>
<dependency>
<groupId>io.prometheus.jmx</groupId>
<artifactId>jmx_prometheus_javaagent</artifactId>
<version>0.16.1</version>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}-${project.version}</finalName>
<resources>
<resource>
<filtering>true</filtering>
<directory>src/main/resources</directory>
<excludes>
<exclude>static/**</exclude>
</excludes>
</resource>
<resource>
<filtering>false</filtering>
<directory>src/main/resources</directory>
<includes>
<include>static/**</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
......@@ -297,23 +320,5 @@
</executions>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<excludes>
<exclude>static/**</exclude>
</excludes>
</resource>
<resource>
<directory>src/main/resources</directory>
<filtering>false</filtering>
<includes>
<include>static/**</include>
</includes>
</resource>
</resources>
</build>
</project>
---
lowercaseOutputLabelNames: true
lowercaseOutputName: true
whitelistObjectNames: ["java.lang:type=OperatingSystem"]
blacklistObjectNames: []
rules:
- pattern: 'java.lang<type=OperatingSystem><>(committed_virtual_memory|free_physical_memory|free_swap_space|total_physical_memory|total_swap_space)_size:'
name: os_$1_bytes
type: GAUGE
attrNameSnakeCase: true
- pattern: 'java.lang<type=OperatingSystem><>((?!process_cpu_time)\w+):'
name: os_$1
type: GAUGE
attrNameSnakeCase: true
\ No newline at end of file
......@@ -13,6 +13,9 @@ CLASS_PATH="./lib/*:config:html:./plugins/*:./plugins/flink${FLINK_VERSION}/*"
#fi
PIDFILE="dinky.pid"
#JMX路径
APP_HOME="$(cd `dirname $0`; pwd)"
JMX="-javaagent:$APP_HOME/lib/jmx_prometheus_javaagent-0.16.1.jar=10087:$APP_HOME/config/jmx/jmx_exporter_config.yaml"
#检查PID path 是否存在
PIDPATH="$(cd "$(dirname "$0")";pwd)/run"
if [ -d ${PIDPATH} ];then
......@@ -46,7 +49,7 @@ fi
# 如果输入格式不对,给出提示!
tips() {
echo ""
echo "WARNING!!!......Tips, please use command: sh auto.sh [start|stop|restart|status]. For example: sh auto.sh start "
echo "WARNING!!!......Tips, please use command: sh auto.sh [start|startWithJmx|stop|restart|status]. For example: sh auto.sh start "
echo ""
exit 1
}
......@@ -67,6 +70,20 @@ start() {
fi
}
# 启动方法(含jmx启动)
startWithJmx() {
pid=$(cat ${PIDPATH}/${PIDFILE})
if [ -z $pid ]; then
nohup java -Ddruid.mysql.usePingMethod=false -Xms512M -Xmx2048M -XX:PermSize=512M -XX:MaxPermSize=1024M -XX:+HeapDumpOnOutOfMemoryError -Xverify:none ${JMX} -cp ${CLASS_PATH} com.dlink.Dlink >/dev/null 2>&1 &
echo $! >${PIDPATH}/${PIDFILE}
echo "........................................Start Dlink Successfully........................................"
else
echo "Dlink pid $pid is in ${PIDPATH}/${PIDFILE}, Please stop first !!!"
fi
}
# 停止方法
stop() {
pid=$(cat ${PIDPATH}/${PIDFILE})
......@@ -109,6 +126,9 @@ case "$1" in
"start")
start
;;
"startWithJmx")
startWithJmx
;;
"stop")
stop
;;
......
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