Page 2 of 2
Re: JMX Connection refused
Posted: Fri Nov 12, 2021 1:28 pm
by gsmith
Hi,
I was able to get this running.
On my remote machine I have some java code running, and I started it using:
Code: Select all
java -Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.port=9999 -Dcom.sun.management.jmxremote.local.only=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=192.168.254.63 testCode
And on my Nagios server I ran:
Code: Select all
java -jar check_jvm.jar -s "service:jmx:rmi:///jndi/rmi://192.168.254.63:9999/jmxrmi" -C "Uptime" -w 10 -c 20
This resulted in:
Code: Select all
[root@gs-rhel8-23-84 libexec]# java -jar check_jvm.jar -s "service:jmx:rmi:///jndi/rmi://192.168.254.63:9999/jmxrmi" -C "Uptime" -w 10 -c 20
Uptime returned CRITICAL with 2.92 minutes | other_uptime=175206ms;10;20;;
Whoops, looks like you wanted to use check_jvm....I used this:
Code: Select all
[root@gs-rhel8-23-84 libexec]# /usr/local/nagios/libexec/check_jmx -U service:jmx:rmi:///jndi/rmi://192.168.254.63:9999/jmxrmi -O java.lang:type=Memory -A HeapMemoryUsage -K used -I HeapMemoryUsage -J used -vvvv -w 4248302272 -c 5498760192
And it resulted in:
Code: Select all
JMX OK HeapMemoryUsage.used=8388608{committed=268435456;init=268435456;max=4263510016;used=8388608}
Here are the permissions on the files from Nagios Exchange:
Code: Select all
[root@gs-rhel8-23-84 libexec]# pwd
/usr/local/nagios/libexec
[root@gs-rhel8-23-84 libexec]# ls -l *jmx*
-rwxr-xr-x 1 root nagios 156 Nov 12 11:47 check_jmx
-rwxr-xr-x 1 root nagios 13225 Nov 12 11:47 jmxquery.jar
[root@gs-rhel8-23-84 libexec]#
See if the above gets you going, I suspect the fix is the:
-Dcom.sun.management.jmxremote.local.only=false
JVM option
Thanks
Re: JMX Connection refused
Posted: Mon Nov 15, 2021 4:28 am
by sacom01
i tried :
Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.port=9000 -Dcom.sun.management.jmxremote.local.only=false -Djava.rmi.server.hostname=ho_as_01
but unable to start jvm, no log appear on jvm log, just one row log
[11/15/21 15:48:39:510 ICT] 000000f7 AdminHelper A ADMN1020I: An attempt is made to stop the dev2_srv01 server. (User ID = de
faultWIMFileBasedRealm/wasadmin)
Re: JMX Connection refused
Posted: Mon Nov 15, 2021 10:12 am
by gsmith
Hi
your args:
Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.port=9000
-Dcom.sun.management.jmxremote.local.only=false
-Djava.rmi.server.hostname=ho_as_01
my args:
java
-Dcom.sun.management.jmxremote=true
-Dcom.sun.management.jmxremote.port=9999
-Dcom.sun.management.jmxremote.local.only=false
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false
-Djava.rmi.server.hostname=192.168.254.63
Looks like you are missing the:
-Dcom.sun.management.jmxremote=true
argument.
Please see if that fixes it.
Thanks
Re: JMX Connection refused
Posted: Mon Nov 15, 2021 9:06 pm
by sacom01
i tried as your suggest but no luck
-Dcom.sun.management.jmxremote=true
-Dcom.sun.management.jmxremote.port=9000
-Dcom.sun.management.jmxremote.local.only=false
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false
-Djava.rmi.server.hostname=192.168.xxx.xxx
Re: JMX Connection refused
Posted: Tue Nov 16, 2021 10:17 am
by gsmith
Hi
At the beginning of this thread you were using an option:
Code: Select all
-Djavax.management.builder.initial=
Could you please try adding it back to the options as the first item:
Code: Select all
-Djavax.management.builder.initial=
-Dcom.sun.management.jmxremote=true
-Dcom.sun.management.jmxremote.port=9000
-Dcom.sun.management.jmxremote.local.only=false
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false
-Djava.rmi.server.hostname=192.168.xxx.xxx
What are the errors in the JVM log?
What application is failing to start?
Thanks
Re: JMX Connection refused
Posted: Tue Nov 16, 2021 9:00 pm
by sacom01
-Djavax.management.builder.initial=
-Dcom.sun.management.jmxremote=true
-Dcom.sun.management.jmxremote.port=9000
-Dcom.sun.management.jmxremote.local.only=false
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false
-Djava.rmi.server.hostname=192.168.xxx.xxx
I tried but no luck. same error. Only this log appear:
[11/17/21 8:52:30:926 ICT] 00000107 AdminHelper A ADMN1020I: An attempt is made to stop the xxxx_srv01 server. (User ID = def
aultWIMFileBasedRealm/wasadmin)
[11/17/21 8:52:30:982 ICT] 00000076 ServerCollabo A WSVR0023I: Server xxxx_srv01 is stopping
[11/17/21 8:52:31:002 ICT] 00000076 TCPChannel I TCPC0002I: TCP Channel TCP_3 has stopped listening on host * (IPv4) port 9154
.
[11/17/21 8:52:31:003 ICT] 00000076 TCPChannel I TCPC0002I: TCP Channel TCP_2 has stopped listening on host * (IPv4) port 9187
.
[11/17/21 8:52:31:004 ICT] 00000076 TCPChannel I TCPC0002I: TCP Channel TCP_1 has stopped listening on host * (IPv4) port 9171
.
[11/17/21 8:52:31:004 ICT] 00000076 TCPChannel I TCPC0002I: TCP Channel TCP_4 has stopped listening on host * (IPv4) port 9418
Re: JMX Connection refused
Posted: Wed Nov 17, 2021 11:05 am
by gsmith
Hi
Let's do a sanity check. Please change the jvm options to
-Djavax.management.builder.initial=
-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.port=9000
and see if the application (WebSphere ?) starts.
Thanks
Re: JMX Connection refused
Posted: Wed Nov 17, 2021 8:37 pm
by sacom01
with that parameter, able to start jvm but gotting time out when check jmx
[root@dc-nagiosxi-uat01 nagios-jmx-plugin-1.2.3]# /usr/local/nagios/libexec/check_jmx -U service:jmx:rmi:///jndi/rmi://192.168.104.250:9000/jmxrmi -O java.lang:type=Memory -A HeapMemoryUsage -K used -I HeapMemoryUsage -J used -vvvv -w 4248302272 -c 5498760192
JMX CRITICAL - Error opening RMI connection: Connection refused to host: 192.168.104.250; nested exception is:
java.net.ConnectException: Connection timed out (Connection timed out)
[root@dc-nagiosxi-uat01 libexec]# telnet 192.168.104.250 9000
Trying 192.168.104.250...
Connected to 192.168.104.250.
Escape character is '^]'.
Re: JMX Connection refused
Posted: Thu Nov 18, 2021 2:39 pm
by gsmith
OK - good.
Now add this option
Code: Select all
-Dcom.sun.management.jmxremote.local.only=false
Does the jvm start? Does check_jmx work?
Add this if the jvm started but check_jmx didn't
Code: Select all
-Djava.rmi.server.hostname=192.168.xxx.xxx
If the jvm didn't start try:
Code: Select all
-Djava.rmi.server.hostname=<hostname>
where <hostname> is the what you get when you run the "hostname" command
Thanks
Re: JMX Connection refused
Posted: Fri Nov 19, 2021 4:30 am
by sacom01
that's all what we need :
Djavax.management.builder.initial=
-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.port=9000
-Djava.rmi.server.hostname=ho_xx_01
[root@dc-nagiosxi-uat01 libexec]# /usr/local/nagios/libexec/check_jmx -U service:jmx:rmi:///jndi/rmi://192.168.104.250:9000/jmxrmi -O java.lang:type=OperatingSystem -A SystemLoadAverage -w 100 -c 200
JMX OK - SystemLoadAverage = 11.056289672851562 | 'SystemLoadAverage'=11.056289672851562;100;200;;
Able to check jvm.
many thanks.