diff --git a/misc/start-jar.sh b/misc/start-jar.sh
index b6ec133..d35f33c 100644
--- a/misc/start-jar.sh
+++ b/misc/start-jar.sh
@@ -2,12 +2,10 @@
PID=`ps -ef | grep echo-sshd-server.jar | grep -v grep | awk '{print $2}'`
if [ -z "$PID" ]
then
- nohup authbind /opt/jdk-17/bin/java -jar echo-sshd-server.jar conf > logs/exec.log 2>&1 &
+ nohup authbind /opt/graalvm-jdk-17/bin/java -Dcom.sun.management.jmxremote -Djava.rmi.server.hostname=127.0.0.1 -Dcom.sun.management.jmxremote.port=2020 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -jar echo-sshd-server.jar conf > logs/exec.log 2>&1 &
sleep 1
PID=`ps -ef | grep echo-sshd-server.jar | grep -v grep | awk '{print $2}'`
echo "started echo-sshd-server.jar pid: $PID"
else
echo "already exist echo-sshd-server.jar pid: $PID"
fi
-
-
diff --git a/pom.xml b/pom.xml
index 1d66410..d0f4e0d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
4.0.0
com.example.sshd
echo-sshd-server
- 1.4.6
+ 1.5.0
ECHO SSH SERVER
Learning Apache Mina SSHD library
diff --git a/src/main/java/com/example/sshd/service/JmxClientService.java b/src/main/java/com/example/sshd/service/JmxClientService.java
new file mode 100644
index 0000000..e3ddad6
--- /dev/null
+++ b/src/main/java/com/example/sshd/service/JmxClientService.java
@@ -0,0 +1,87 @@
+package com.example.sshd.service;
+
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.Set;
+
+import javax.management.Attribute;
+import javax.management.MBeanAttributeInfo;
+import javax.management.MBeanInfo;
+import javax.management.MBeanServerConnection;
+import javax.management.ObjectName;
+import javax.management.openmbean.CompositeData;
+import javax.management.remote.JMXConnector;
+import javax.management.remote.JMXConnectorFactory;
+import javax.management.remote.JMXServiceURL;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
+
+@Service
+public class JmxClientService {
+
+ private static final Logger logger = LoggerFactory.getLogger(ReplyService.class);
+
+ public String process(String[] args) {
+ // Example
+ // 1st parameter: service:jmx:rmi:///jndi/rmi://127.0.0.1:2020/jmxrmi
+ // 2nd parameter: java.lang:type=Memory
+
+ StringBuilder output = new StringBuilder();
+ try {
+ if (args.length > 2) {
+ Runtime.getRuntime().freeMemory();
+ System.out.println("Connection to JMX kafka...");
+ JMXServiceURL url = new JMXServiceURL(args[1]);
+ JMXConnector jmxc = JMXConnectorFactory.connect(url, null);
+ MBeanServerConnection mbsc = jmxc.getMBeanServerConnection();
+
+ ObjectName mbeanName = new ObjectName(args[2]);
+
+ MBeanInfo info = mbsc.getMBeanInfo(mbeanName);
+ MBeanAttributeInfo[] attribute = info.getAttributes();
+
+ logger.info("[process] args.length: {}", args.length);
+ if (args.length > 3) {
+ for (MBeanAttributeInfo attr : attribute) {
+ List alist = mbsc.getAttributes(mbeanName, new String[] { attr.getName() }).asList();
+ if (args[3].equals(attr.getName())) {
+ Optional