Page 1 of 2
how to get exact objectname for jmx monitor
Posted: Fri Nov 19, 2021 3:50 am
by sacom01
hi,
i found some parameters for monitoring jvm but when run jmx_check it getting error "objectName not found".
How to check exact the object name? I tried found in jConsole for check but same error.
one guy name SteveB told we can use jmx4perl but dont know how to run.
[root@dc-nagiosxi-uat01 ~]# jmx4perl
http://localhost:8080/jolokia \
> --target service:jmx:rmi:///jndi/rmi://[192.168.117.1]:[9002]/jmxrmi \
> --target-user [xxxx] \
> --target-password [xxxxx] \
> list > /tmp/jmxdump.txt
-bash: jmx4perl: command not found
Re: how to get exact objectname for jmx monitor
Posted: Fri Nov 19, 2021 3:45 pm
by kfanselow
Hi sacom01,
It looks like either jmx4perl isn't installed on your system or it's not in your search path:
-bash: jmx4perl: command not found
If it's not installed on your system it looks like it is available on CPAN:
https://metacpan.org/dist/jmx4perl/view ... s/jmx4perl
Beyond that there may be others here who can help you with the specifics of JMX - it's a little outside my experience set : ).
Thanks and Best Regards,
Keith
Re: how to get exact objectname for jmx monitor
Posted: Sun Nov 21, 2021 8:41 pm
by sacom01
hi,
if dont use jmx4perl, how to determine object name?
Re: how to get exact objectname for jmx monitor
Posted: Mon Nov 22, 2021 3:37 pm
by gsmith
Hi,
If you have the java jdk installed on your laptop/desktop there should be an application
in C:\Program Files\Java\jdk-16\bin called jconsole.exe that you can use to connect to the
machine that is running the jvm that you want to monitor.
Thanks
Re: how to get exact objectname for jmx monitor
Posted: Mon Nov 22, 2021 8:41 pm
by sacom01
hi,
os is Redhat7.
As i told, i used jconsole for find Objectname but unable to run jmx check.
[root@dc-nagiosxi-uat01 ~]# /usr/local/nagios/libexec/check_jmx -U service:jmx:rmi:///jndi/rmi://192.168.117.1:9002/jmxrmi -O "java.lang:type=GarbageCollector,name=PS MarkSweep" -A "CollectionCount" -u MB -w 100 -c 200 --username xxxx --password xxxxx
JMX CRITICAL - objectName not found [java.lang:type=GarbageCollector,name=PS MarkSweep]
Re: how to get exact objectname for jmx monitor
Posted: Tue Nov 23, 2021 11:37 am
by gsmith
Hi,
The problem is with the plugin, it doesn't like spaces like the one in "PS MarkSweep"
Remove the check_jmx and jmxquery.jar files from /usr/local/nagios/libexec and replace them
with the ones found in the plugin of
https://github.com/WillPlatnick/jmxquery
My results using original plugin files:
Code: Select all
[root@localhost libexec]# ./check_jmx -U service:jmx:rmi:///jndi/rmi://192.168.254.63:9010/jmxrmi -O java.lang:name="G1 Old Generation",type=GarbageCollector -A CollectionCount -w 10 -c 20
JMX CRITICAL java.lang:name=G1
now with plugin files referenced above:
Code: Select all
[root@localhost libexec]# ./check_jmx -U service:jmx:rmi:///jndi/rmi://192.168.254.63:9010/jmxrmi -O java.lang:name="G1 Old Generation",type=GarbageCollector -A CollectionCount -w 10 -c 20
JMX OK - CollectionCount=0 | CollectionCount=0
Thanks
Re: how to get exact objectname for jmx monitor
Posted: Tue Nov 23, 2021 9:57 pm
by sacom01
hi,
after replace 2 files check_jmx and jmxquery.jar, it was getting Authentication failed instead i provide username and pw:
[root@dc-nagiosxi-uat01 libexec]# ./check_jmx -U service:jmx:rmi:///jndi/rmi://192.168.117.1:9002/jmxrmi -O java.lang:name="Tenured Gen",type=MemoryPool -A "Usage.committed" -w 100 -c 200 --username xxxx--password xxxx
JMX CRITICAL - Authentication failed! Credentials required
i found different from old check_jmx and the new one :
The old one :
[root@dc-nagiosxi-uat01 libexec]# more check_jmx.bk/check_jmx
#!/bin/sh
#
# Nagios JMX plugin.
#
#JAVA_CMD=`which java`
JAVA_CMD='/home/nagios/jdk1.8.0_181/bin/java'
if [ -z $JAVA_CMD ]
then
if [ -x $JAVA_HOME/bin/java ]
then
JAVA_CMD=$JAVA_HOME/bin/java
else
echo JMX CRITICAL - java not found.
exit 2
fi
fi
DIR=`dirname $0`
$JAVA_CMD -jar $DIR/check_jmx.jar "$@"
The new one :
[root@dc-nagiosxi-uat01 libexec]# more check_jmx
#!/bin/sh
#
# Nagios plugin to monitor Java JMX (http://java.sun.com/jmx)attributes.
#
RDIR=`dirname $0`
java -jar $RDIR/jmxquery.jar "$@"
how to make it understand the authentication?
Re: how to get exact objectname for jmx monitor
Posted: Wed Nov 24, 2021 10:06 am
by gsmith
Hi
What are the arguments used to launch the jvm you are trying to monitor?
Thx
Re: how to get exact objectname for jmx monitor
Posted: Wed Nov 24, 2021 10:38 pm
by sacom01
hi,
-Djavax.management.builder.initial=
-Dcom.sun.management.jmxremote.ssl=false
-Djava.rmi.server.hostname=ho_xxxx_06
-Dcom.sun.management.jmxremote.port=9002
when i use the old check_jmx and jmxquery.jar, it's work fine.
Re: how to get exact objectname for jmx monitor
Posted: Mon Nov 29, 2021 1:46 am
by sacom01
hi bro,
any update to us?
thank you