AtlassianPlugin - adrianrm/javamelody GitHub Wiki

Atlassian JIRA, Confluence and Bamboo Plugin

Attention: The plugin managers may say that the latest javamelody versions are incompatible, but in fact they are certainly compatible as displayed on the plugin history page.

For Bitbucket, see the next chapter. For information on the data center use case with several nodes, see the Atlassian Data Center chapter.

If you want to monitor a JIRA, Confluence or a Bamboo server, you can install JavaMelody easily with a JIRA/Confluence/Bamboo plugin. For this, download the jira-confluence-javamelody.jar file of the plugin and copy the file:

  • in the atlassian-jira-software-x.x.x/atlassian-jira/WEB-INF/lib directory for JIRA,
  • in atlassian-bamboo-x.x.x/atlassian-bamboo/WEB-INF/lib for Bamboo (or in Bamboo/webapp/WEB-INF/lib for older Bamboo)
  • or upload the file with the "Manage apps" or "Plugin manager" in the "Administration" menu for Confluence.

Restart the server.

To uninstall before an upgrade, stop the server and remove the jira-confluence-javamelody.jar file from:

  • the atlassian-jira-software-x.x.x/atlassian-jira/WEB-INF/lib directory for JIRA,
  • atlassian-bamboo-x.x.x/atlassian-bamboo/WEB-INF/lib for Bamboo (or in Bamboo/webapp/WEB-INF/lib for older Bamboo)
  • or click the "Uninstall" button next to "Disable" in the "Manage apps" or "Plugin manager" in the "Administration" menu for Confluence. (If the "Uninstall" button is not available, remove the jira-confluence-javamelody.jar file from atlassian-confluence-x.x.x/confluence/WEB-INF/lib)

After the install, you can open the report from the address http://<host>:<port>/monitoring (the "Monitoring" link is also available in the "Administration" menu or "Manage add-ons" page). That's it in general.

Note: The jdbc connections and the SQL requests are monitored in JIRA, Confluence and Bamboo if a jdbc datasource from jndi is used, instead of the default direct jdbc connection.

To configure Confluence with a datasource, see this or this. (Beware: If you're using Confluence 5.8 or later, use maxTotal instead of maxActive.)

To configure Bamboo with a datasource, see this. Alternatively for Bamboo, it is possible to replace the default hsqldb driver by the following in bamboo-home/bamboo.cfg.xml:

<property name="hibernate.connection.driver">org.hsqldb.jdbcDriver</property>
<property name="hibernate.connection.driver_class">net.bull.javamelody.JdbcDriver</property>

To configure JIRA with a datasource, replace in the jira-home/dbconfig.xml file "<jdbc-datasource>...</jdbc-datasource>" with "<jndi-datasource><jndi-name>java:comp/env/jdbc/JiraDS</jndi-name></jndi-datasource>" (take a backup before), and add a Resource element for a datasource inside the Context element of the Tomcat's "JIRA/conf/server.xml" file:

...
<Context ... > 
	...
	<!-- If you're using JIRA 6.4 or below; change maxTotal to maxActive -->
	<Resource name="jdbc/JiraDS" auth="Container" type="javax.sql.DataSource"
		username="[enter db username]"
		password="[enter db password]"
		driverClassName="com.mysql.jdbc.Driver"
		url="jdbc:mysql://localhost/jiradb?useUnicode=true&amp;characterEncoding=UTF8"
		maxTotal="20"
		maxIdle="10"
		validationQuery="select 1"
	/>
</Context>
...

Or see this example of datasource from Atlassian. The values in your Resource element should be inspired by the values that were just removed from your dbconfig.xml file. And so the jndi datasource will be automatically monitored after restart.

The data files will be stored by default in /temp/javamelody/. If you want to use another storage directory, add a "javamelody.storage-directory" system property (in /bin/setenv.sh or in /conf/catalina.properties). For example:

	... -Djavamelody.storage-directory=/my/path

You can configure other parameters, see Optional parameters.

In JIRA, Confluence and Bamboo, you can also send weekly, daily or monthly reports in pdf format by mail to one or several people. This is explained in the chapter Weekly, daily or monthly reports by mail.

For example, for JIRA:

Copy the "javax.mail-1.5.6.jar", "javax.mail-api-1.5.6.jar" and "activation-1.1.1.jar" files from the "JIRA/atlassian-jira/WEB-INF/lib/" directory to the "JIRA/lib/" directory. And add the following Resource and Parameter lines inside the Context element of the "JIRA/conf/server.xml" file:

...
<Context ... > 
	...
	<Resource name="mail/JavaMelodySession" auth="Container" type="javax.mail.Session"
		mail.smtp.host="mailhost.foo.bar"
		mail.smtp.user="someLoginIfNeeded"
		mail.from="[email protected]"
	/>
	<Parameter name='javamelody.admin-emails' value='[email protected],[email protected]' override='false'/>
	<Parameter name='javamelody.mail-session' value='java:comp/env/mail/JavaMelodySession' override='false'/>
	<Parameter name='javamelody.mail-periods' value='day,week,month' override='false'/>
</Context>
...

Read Weekly, daily or monthly reports by mail for more parameters if needed.

Bitbucket

If you want to monitor a Bitbucket server, you can install JavaMelody easily with the same plugin as for JIRA/Confluence/Bamboo. For this, download the jira-confluence-javamelody.jar file of the plugin and copy the file in the $BITBUCKET_HOME/shared/plugins/installed-plugins/ directory.

But unlike in JIRA/Confluence/Bamboo, the access to the monitoring page is not restricted to the administrator, because there is no easy access to the user from the http session and Bitbucket's AuthenticationContext does not give access to the user given the order of servlet filters, so it is recommended to add basic authentication. For example, with a system property like -Djavamelody.authorized-users=admin:pwd.

Restart the server.

Then you can open the report from the address http://<host>:<port>/monitoring.

Note that the jdbc connections and the SQL requests are not monitored in Bitbucket, because a datasource from JNDI can't be used in Bitbucket. (The javamelody SpringDataSourceBeanPostProcessor may have helped like in the javamelody spring-boot-starter.)

The plugin does not work as is in Fisheye when using "Manage add-ons", because of pluginsVersion="1" instead of "2" in the atlassian-plugin.xml file in the plugin.

Atlassian Data Center

You can use the same JavaMelody monitoring plugin with Atlassian Data Center: JIRA Data Center, Confluence Data Center and Bitbucket Data Center. For that, install the plugin in your data center, as said above for a single server. (Officialy approved as a data center compliant add-on by Atlassian since February 2019, but can not yet be published as such, DCHELP-697.)

For information on the behavior of the plugin when used in a data center with several nodes, the plugin behaves on each node of a cluster like it would on a single server environment, independently of the other nodes. So the data displayed in the monitoring reports is the data for a single node. And the data is stored on the hard drive for each node separately. (You can use the storage directory parameter as said above to configure where you want to store the data. It is recommended to store the data outside of the "shared home" of the data center.)

Given the load balancing between nodes, the statistics in the monitoring reports of one node are probably equivalent to the statistics of the other nodes. (To be sure, you can get the monitoring reports of the other nodes by using the URL of each node in your browser bypassing your load balancer or by changing manually the load balancer routing cookie in you browser, for example ROUTEID=.2 instead of ROUTEID=.1)

But if you want instead a single monitoring report aggregating the data of all the nodes and a single storage directory to store the data on another server, you may want to install the optional collect server, after installing the plugin in data center, and be sure to read the Security with a collecter server chapter in that case.

Privacy policy

The javamelody plugin for JIRA / Confluence / Bamboo / Bitbucket plugin does not read or store user data: the plugin only stores, on the hard disk drive of the application's server, the statistics and metrics of the application.

The access to the plugin reports, which may display sensitive data such as attributes of current http sessions, is restricted to the application's administrator. (For Bitbucket, configuration is needed.)

⚠️ **GitHub.com Fallback** ⚠️