How to configure Bamboo to be monitored by Prometheus

Still need help?

The Atlassian Community is here for you.

Ask the community


Platform Notice: Data Center - This article applies to Atlassian products on the Data Center platform.

Note that this knowledge base article was created for the Data Center version of the product. Data Center knowledge base articles for non-Data Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

The steps outlined in this article are provided AS-IS. This means we've had reports of them working for some customers — under certain circumstances — yet are not officially supported, nor can we guarantee they'll work for your specific scenario.

You may follow through and validate them on your own non-prod environments prior to production or fall back to supported alternatives if they don't work out.

We also invite you to reach out to our Community for matters that fall beyond Atlassian's scope of support!

Summary

This article explains how to configure Bamboo to be monitored by Prometheus to monitor and collect metrics from the application.

Environment

The steps were tested on Bamboo 9.2.11 (Linux OS) and JMX exporter version 0.20.

Solution

1. In the <Bamboo-install/setenv.sh> file Modify the following line to enable Bamboo profiling:

: ${JVM_SUPPORT_RECOMMENDED_ARGS:="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.rmi.port=8099 -Dcom.sun.management.jmxremote.port=8099 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false  -Djava.net.preferIPv6Addresses=false"}

If you intend to do this using SSL, please use this instead:

: ${JVM_SUPPORT_RECOMMENDED_ARGS:="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.rmi.port=8099 -Dcom.sun.management.jmxremote.port=8099 -Dcom.sun.management.jmxremote.authenticate=false -Djavax.net.ssl.keyStore=<keystore_file_location> -Djavax.net.ssl.keyStorePassword=<keystore_password> -Djava.net.preferIPv6Addresses=false"}

2. Download the JMX exporter 0.20:

wget https://repo.maven.apache.org/maven2/io/prometheus/jmx/jmx_prometheus_javaagent/0.20.0/jmx_prometheus_javaagent-0.20.0.jar

3. Create a configuration directory for the JMX exporter:

sudo mkdir -p /opt/jmx_exporter

4. Move the download jar file to the new directory:

mv jmx_prometheus_javaagent-0.20.0.jar /opt/jmx_exporter

5. Create a configuration file with the below content:

cat /opt/jmx_exporter/config.yaml
rules:
  - pattern: ".*"

If this will done using SSL, please modify it as shown below:

cat > /opt/jmx_exporter/config.yaml << EOF
httpServer:
  ssl:
    keyStore:
      filename: <keystore_file>
      password: <keystore_password>
    certificate:
      alias: <keystore_alias>
rules:
  - pattern: ".*"
EOF

6. Inside <Bamboo-install/setenv.sh> add the following line:

JAVA_OPTS="-Xms${JVM_MINIMUM_MEMORY} -Xmx${JVM_MAXIMUM_MEMORY} ${JAVA_OPTS} ${JVM_REQUIRED_ARGS} ${JVM_SUPPORT_RECOMMENDED_ARGS} ${JVM_EC_RECOMMENDED_ARGS} ${BAMBOO_HOME_MINUSD}"
JAVA_OPTS="-javaagent:/opt/jmx_exporter/jmx_prometheus_javaagent-0.20.0.jar=8090:/opt/jmx_exporter/config.yaml $JAVA_OPTS" ### Add this line

7. Restart Bamboo.

8. Verify that you can access the metrics after the restart:

curl http://localhost:8090/metrics

If you are using SSL, verify that you can access the metrics using the command below instead:

curl https://localhost:8090/metrics

9. In the prometheus.yaml configuration file add the following:

scrape_configs:
  - job_name: 'bamboo_jmx'
    static_configs:
      - targets: ['<Bamboo_Server_IP>:8090'] ### Change To Bamboo IP

Optionally If you are using SSL, kindly use this instead:

...
 - job_name: 'bamboo_jmx'
    scrape_interval: 10s
    scheme: https
    static_configs:
      - targets: ['FQDN_BAMBOO_HOST:8090'].  ###Change to the Hostname of Bamboo present in the Certificate Subject alternative Names(SAN)

10. Restart the Prometheus service and check the target configuration from the Prometheus UI.


Last modified on Aug 2, 2024

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.