JMX on JIRA

Abhi Vaishnav
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 9, 2014

Hello Atlassian administrators,

Has anybody used JMX to monitor JIRA performance?

I have added the JVM extra args: -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=#### -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=true -Dcom.sun.management.jmxremote.password.file=../conf/jmxremote.password -Dcom.sun.management.jmxremote.access.file=../conf/jmxremote.access

Our server is hosted on an AWS instance and I have all the ports necessary ports open.

I can telnet into that port but can't connect (secure or insecure) using jconsole from the same computer.

My password has a '$' in it; could that be interfering? Any ideas how to debug this? I don't see logs for JMX...

8 answers

1 accepted

1 vote
Answer accepted
Abhi Vaishnav
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 25, 2014

Hi All,

I had to add the -Dcom.sun.management.jmxremote.rmi.port and force it to use IPv4 (-Djava.net.preferIPv4Stack=true).

Setting both of those up let us setup a non-SSL connection between jconsole and the JIRA server.

Thank you for all your help.

0 votes
Daniel Holmes July 31, 2020

We are using this plugin which helps to eliminate some of the under the covers config items  https://marketplace.atlassian.com/apps/1213211/jolokia-monitoring-agent

0 votes
Mohd Arif July 29, 2020

It should be added as ${CATALINA_OPTS} not is java recommended variables in sentenv.sh or setenv.bat

=================================================

### Zabbix JMX Parameter ####
CATALINA_OPTS="-Dcom.sun.management.jmxremote ${CATALINA_OPTS}"
CATALINA_OPTS="-Dcom.sun.management.jmxremote.port=XXXX ${CATALINA_OPTS}"
CATALINA_OPTS="-Dcom.sun.management.jmxremote.rmi.port=XXXX ${CATALINA_OPTS}"
CATALINA_OPTS="-Dcom.sun.management.jmxremote.ssl=false ${CATALINA_OPTS}"
CATALINA_OPTS="-Dcom.sun.management.jmxremote.authenticate=true ${CATALINA_OPTS}"
CATALINA_OPTS="-Dcom.sun.management.jmxremote.access.file=/data/zabbix/jmx/jmx.access ${CATALINA_OPTS}"
CATALINA_OPTS="-Dcom.sun.management.jmxremote.password.file=/data/zabbix/jmx/jmx.password ${CATALINA_OPTS}"
CATALINA_OPTS="-Djava.rmi.server.hostname=XXXXX ${CATALINA_OPTS}"
export CATALINA_OPTS

======================================================

Note: 

# CATALINA_OPTS (Optional) Java runtime options used when the "start","run" or "debug" command is executed. Include here and not in JAVA_OPTS all options, that should only be used by Tomcat itself, not by the stop process, the version command etc.
Examples are heap size, GC logging, JMX ports etc.

0 votes
Abhi Vaishnav
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 20, 2015

Sorry about the crappy formatting, I made a typo in my {code} and Atlassian is not letting me edit the entry...

0 votes
Abhi Vaishnav
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 20, 2015

Hey Zhen Zhang, This is what my JVM_EXTRA_ARGS line looks like:

JVM_EXTRA_ARGS="-XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps -verbose:gc -Xloggc:/apps/atlassian/jira-data-507/log/atlassian-jira-gc-$(date +%Y-%m-%d_%H%M).log -XX:+UseParNewGC -XX:+UseAdaptiveGCBoundary -XX:NewSize=2048m -XX:+UseCompressedOops -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=8090 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=true -Dcom.sun.management.jmxremote.access.file=/apps/atlassian/jira-server/conf/jmxremote.access -Dcom.sun.management.jmxremote.password.file=/apps/atlassian/jira-server/conf/jmxremote.password -Djava.net.preferIPv4Stack=true -Dcom.sun.management.jmxremote.rmi.port=8090"

 

You setup the JVM_EXTRA_ARGS line in <JIRA_INSTALL>/bin/setenv.sh (.bat depending on what platform you are on). Hope that helps.

Mohd Arif July 28, 2020

=======================================================

Error: JMX connector server communication error: service:jmx:rmi://ip-X-X-X-X.eu-central-1.compute.internal:18086
sun.management.AgentConfigurationError: java.rmi.server.ExportException: Port already in use: XXXX; nested exception is:
java.net.BindException: Address already in use (Bind failed)
at sun.management.jmxremote.ConnectorBootstrap.exportMBeanServer(ConnectorBootstrap.java:800)
at sun.management.jmxremote.ConnectorBootstrap.startRemoteConnectorServer(ConnectorBootstrap.java:468)
at sun.management.Agent.startAgent(Agent.java:262)
at sun.management.Agent.startAgent(Agent.java:452)
Caused by: java.rmi.server.ExportException: Port already in use: 18086; nested exception is:
java.net.BindException: Address already in use (Bind failed)
at sun.rmi.transport.tcp.TCPTransport.listen(TCPTransport.java:346)
at sun.rmi.transport.tcp.TCPTransport.exportObject(TCPTransport.java:254)
at sun.rmi.transport.tcp.TCPEndpoint.exportObject(TCPEndpoint.java:411)
at sun.rmi.transport.LiveRef.exportObject(LiveRef.java:147)
at sun.rmi.server.UnicastServerRef.exportObject(UnicastServerRef.java:236)
at sun.management.jmxremote.ConnectorBootstrap$PermanentExporter.exportObject(ConnectorBootstrap.java:199)
at javax.management.remote.rmi.RMIJRMPServerImpl.export(RMIJRMPServerImpl.java:146)
at javax.management.remote.rmi.RMIJRMPServerImpl.export(RMIJRMPServerImpl.java:122)
at javax.management.remote.rmi.RMIConnectorServer.start(RMIConnectorServer.java:404)
at sun.management.jmxremote.ConnectorBootstrap.exportMBeanServer(ConnectorBootstrap.java:796)
... 3 more
Caused by: java.net.BindException: Address already in use (Bind failed)
at java.net.PlainSocketImpl.socketBind(Native Method)
at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:387)
at java.net.ServerSocket.bind(ServerSocket.java:375)
at java.net.ServerSocket.<init>(ServerSocket.java:237)
at java.net.ServerSocket.<init>(ServerSocket.java:128)
at sun.rmi.transport.proxy.RMIDirectSocketFactory.createServerSocket(RMIDirectSocketFactory.java:45)
at sun.rmi.transport.proxy.RMIMasterSocketFactory.createServerSocket(RMIMasterSocketFactory.java:345)
at sun.rmi.transport.tcp.TCPEndpoint.newServerSocket(TCPEndpoint.java:666)
at sun.rmi.transport.tcp.TCPTransport.listen(TCPTransport.java:335)
... 12 more
The stop command failed. Attempting to signal the process to stop through OS signal.
Tomcat stopped.

=========================================================

While stopping the Jira i get this error every time.. are you also getting this error?

However it stopped the Jira completely and then Jira will start without any issue.

I am just wondering why I am getting this error while stopping the jira only?

0 votes
zhen zhang
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 13, 2015

Hi @Abhi Vaishnav , I am also studying how to monitor Jira performance with JMX. It seems you have already successfully connected Jira with JMX. Could you please let me know how to add extra args to JVM? where is the JVM file location? thanks in advance!

0 votes
Danilo Conrad
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 20, 2014

Hi Abhi,

You might check the related answer post below for some additional settings which might be missing:

https://answers.atlassian.com/questions/88110/how-to-access-objects-exposed-via-jmx-monitoring-plugin-for-jira-using-a-java-client

In addition to that, you may also consider using a plugin for monitoring, such as Java Melody.

I hope this information helps.

Cheers,

Danilo

0 votes
Boris Georgiev _Appfire_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 11, 2014

I think you might be missing the "com.sun.management.jmxremote" property, so try adding it and see if it will work.

http://docs.oracle.com/javase/7/docs/technotes/guides/management/agent.html

Abhi Vaishnav
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 20, 2014

Boris, I have this property.

I can connect to it using the jmxsh command line utility from the server itself (so it connects to it self). However, when I try to connect from any other server, only the JMX clients are rejected... any ideas how to debug this?

Suggest an answer

Log in or Sign up to answer