Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Prometheus Exporter for Bamboo exposes Bamboo metrics : as JVM and issue statistics to Prometheus.

Note

Be aware, this plugin publicly exposes some sensitive data by default. The metrics page exposes the username of who last logged in, who last edited issues in every project and some more usernames. You should enable token protection to make sure the public cannot view usernames.

To enable Prometheus Exporter for Bamboo to collect metrics and pull them to Prometheus:

...

Register the application endpoint in the Prometheus server. 

...

titleprometheus.yml

...

Setting up Prometheus Exporter for Bamboo

When you download the Prometheus installation package you can see a sample configuration in the prometheus.yml file.
There are three blocks of configuration in this file: global, rule_files, and scrape_configs:

  • Global controls the Prometheus server's global configuration.
  • Rule_files specifies the location of any rules that you want the Prometheus server to load.
  • Scrape_configs controls what resources Prometheus monitors.

 To enable Prometheus Exporter for Bamboo so that it collects metrics and pulls it into Prometheus: 

  1. Use the following scrape_configs:

    Code Block
    titleprometheus.yml
    scrape_configs:
      - job_name: 'bamboo'
        scheme: https #change to http if don't you have https
        metrics_path: '/<your_bamboo_context_path>/plugins/servlet/prometheus/metrics'
        static_configs:
          - targets: ['myhost:1990']
    Go to Prometheus UI 

    For a complete specification of configuration options, see the Prometheus configuration documentation.


  2.  Select Prometheus Exporter for Bamboo endpoint in the Prometheus Status >Targets page where all registered applications listed and from which you can take the metrics.

  3. Select your application endpoint to get the Prometheus metrics format.

  4. Now, you can build variety of dashboards with the selected metrics.

...

  1. applications are listed, to get the Prometheus metrics.


    Image Added<<<Update screenshot with Bamboo


  2. Build any of the available dashboards with the selected metrics.


    Image Added<<<Update screenshot with Bamboo

Configuring a secret token (recommended)


Note

Note that this plugin publicly exposes some sensitive data by default. The metrics page exposes the usernames for who logged in last, who was the last editing issues in every project and so on. We recommend that you enable token protection to make sure the public cannot view usernames.

To configure a secret token:

  1. Log into your Bamboo as Admin.
  2. In the cog wheel menu, select Bamboo administration.
  3. Locate Go to Bamboo Administration > Manage apps, and click Prometheus Exporter Settings. 
    The Prometheus Exporter Settings page opens. 
  4. Fill in the fields on this page. Use the following scrape URL: /plugins/servlet/prometheus/metrics?token=secrettokenGenerate or create a Token. We recommend to use 128 length symbol.
     

    Now, register the application endpoint in the Prometheus server.
  5. Use generated or created secret token in the following scrape_configs in the prometheus.yml configuration file: 

    Code Block
    titleprometheus.yml
      - job_name: 'bamboo'
        scheme: https #change to http if don't you have https
        metrics_path: '/<your_bamboo_context_path>/plugins/servlet/prometheus/metrics?token=secrettoken'
        params:
             token: ['1234567890'] # i'd reccomend use 128 symbol lenght long [A-Za-z0-9]
        static_configs:
          - targets: ['myhost:1990']

    That's it.

Prometheus metrics example

Expand
titlePrometheus Metrics Example
# HELP jvm_buffer_pool_used_bytes Used bytes of a given JVM buffer pool.
# TYPE jvm_buffer_pool_used_bytes gauge
jvm_buffer_pool_used_bytes{pool="direct",} 129536.0
jvm_buffer_pool_used_bytes{pool="mapped",} 8543.0
# HELP jvm_buffer_pool_capacity_bytes Bytes capacity of a given JVM buffer pool.
# TYPE jvm_buffer_pool_capacity_bytes gauge
jvm_buffer_pool_capacity_bytes{pool="direct",} 129536.0
jvm_buffer_pool_capacity_bytes{pool="mapped",} 8543.0
# HELP jvm_buffer_pool_used_buffers Used buffers of a given JVM buffer pool.
# TYPE jvm_buffer_pool_used_buffers gauge
jvm_buffer_pool_used_buffers{pool="direct",} 17.0
jvm_buffer_pool_used_buffers{pool="mapped",} 4.0
# HELP jvm_gc_collection_seconds Time spent in a given JVM garbage collector in seconds.
# TYPE jvm_gc_collection_seconds summary
jvm_gc_collection_seconds_count{gc="PS Scavenge",} 824.0
jvm_gc_collection_seconds_sum{gc="PS Scavenge",} 8.763
jvm_gc_collection_seconds_count{gc="PS MarkSweep",} 9.0
jvm_gc_collection_seconds_sum{gc="PS MarkSweep",} 3.99
# HELP jvm_info JVM version info
# TYPE jvm_info gauge
jvm_info{version="1.8.0_171-b11",vendor="Oracle Corporation",runtime="Java(TM) SE Runtime Environment",} 1.0
# HELP process_cpu_seconds_total Total user and system CPU time spent in seconds.
# TYPE process_cpu_seconds_total counter
process_cpu_seconds_total 777.4
# HELP process_start_time_seconds Start time of the process since unix epoch in seconds.
# TYPE process_start_time_seconds gauge
process_start_time_seconds 1.531684541741E9
# HELP process_open_fds Number of open file descriptors.
# TYPE process_open_fds gauge
process_open_fds 447.0
# HELP process_max_fds Maximum number of open file descriptors.
# TYPE process_max_fds gauge
process_max_fds 1048576.0
# HELP process_virtual_memory_bytes Virtual memory size in bytes.
# TYPE process_virtual_memory_bytes gauge
process_virtual_memory_bytes 4.801265664E9
# HELP process_resident_memory_bytes Resident memory size in bytes.
# TYPE process_resident_memory_bytes gauge
process_resident_memory_bytes 1.426763776E9
# HELP jvm_classes_loaded The number of classes that are currently loaded in the JVM
# TYPE jvm_classes_loaded gauge
jvm_classes_loaded 40833.0
# HELP jvm_classes_loaded_total The total number of classes that have been loaded since the JVM has started execution
# TYPE jvm_classes_loaded_total counter
jvm_classes_loaded_total 41090.0
# HELP jvm_classes_unloaded_total The total number of classes that have been unloaded since the JVM has started execution
# TYPE jvm_classes_unloaded_total counter
jvm_classes_unloaded_total 257.0
# HELP bamboo_error_count Errors Count
# TYPE bamboo_error_count counter
# HELP bamboo_finished_build_count Finished Builds Count
# TYPE bamboo_finished_build_count counter
# HELP bamboo_canceled_build_count Canceled Builds Count
# TYPE bamboo_canceled_build_count counter
# HELP bamboo_finished_deploys_count Finished Deploys Count
# TYPE bamboo_finished_deploys_count counter
# HELP bamboo_build_queue_timeout_count Build Queue Timeout Count
# TYPE bamboo_build_queue_timeout_count counter
# HELP bamboo_maintenance_expiry_days_gauge Maintenance Expiry Days Gauge
# TYPE bamboo_maintenance_expiry_days_gauge gauge
bamboo_maintenance_expiry_days_gauge 532.0
# HELP bamboo_license_expiry_days_gauge License Expiry Days Gauge
# TYPE bamboo_license_expiry_days_gauge gauge
bamboo_license_expiry_days_gauge 0.0
# HELP bamboo_allowed_users_gauge Allowed Users Gauge
# TYPE bamboo_allowed_users_gauge gauge
bamboo_allowed_users_gauge 5.0
# HELP bamboo_all_agents_gauge All Agents Gauge
# TYPE bamboo_all_agents_gauge gauge
bamboo_all_agents_gauge 2.0
# HELP bamboo_active_agents_gauge Active Agents Gauge
# TYPE bamboo_active_agents_gauge gauge
bamboo_active_agents_gauge 1.0
# HELP bamboo_busy_agents_gauge Busy Agents Gauge
# TYPE bamboo_busy_agents_gauge gauge
bamboo_busy_agents_gauge 0.0
# HELP jvm_memory_bytes_used Used bytes of a given JVM memory area.
# TYPE jvm_memory_bytes_used gauge
jvm_memory_bytes_used{area="heap",} 4.79939832E8
jvm_memory_bytes_used{area="nonheap",} 3.85195728E8
# HELP jvm_memory_bytes_committed Committed (bytes) of a given JVM memory area.
# TYPE jvm_memory_bytes_committed gauge
jvm_memory_bytes_committed{area="heap",} 5.30055168E8
jvm_memory_bytes_committed{area="nonheap",} 4.02653184E8
# HELP jvm_memory_bytes_max Max (bytes) of a given JVM memory area.
# TYPE jvm_memory_bytes_max gauge
jvm_memory_bytes_max{area="heap",} 5.30055168E8
jvm_memory_bytes_max{area="nonheap",} -1.0
# HELP jvm_memory_bytes_init Initial bytes of a given JVM memory area.
# TYPE jvm_memory_bytes_init gauge
jvm_memory_bytes_init{area="heap",} 1.34217728E8
jvm_memory_bytes_init{area="nonheap",} 2555904.0
# HELP jvm_memory_pool_bytes_used Used bytes of a given JVM memory pool.
# TYPE jvm_memory_pool_bytes_used gauge
jvm_memory_pool_bytes_used{pool="Code Cache",} 1.29630208E8
jvm_memory_pool_bytes_used{pool="Metaspace",} 2.2751936E8
jvm_memory_pool_bytes_used{pool="Compressed Class Space",} 2.804616E7
jvm_memory_pool_bytes_used{pool="PS Eden Space",} 1.5238952E8
jvm_memory_pool_bytes_used{pool="PS Survivor Space",} 4449416.0
jvm_memory_pool_bytes_used{pool="PS Old Gen",} 3.23100896E8
# HELP jvm_memory_pool_bytes_committed Committed bytes of a given JVM memory pool.
# TYPE jvm_memory_pool_bytes_committed gauge
jvm_memory_pool_bytes_committed{pool="Code Cache",} 1.30809856E8
jvm_memory_pool_bytes_committed{pool="Metaspace",} 2.40648192E8
jvm_memory_pool_bytes_committed{pool="Compressed Class Space",} 3.1195136E7
jvm_memory_pool_bytes_committed{pool="PS Eden Space",} 1.67247872E8
jvm_memory_pool_bytes_committed{pool="PS Survivor Space",} 4718592.0
jvm_memory_pool_bytes_committed{pool="PS Old Gen",} 3.58088704E8
# HELP jvm_memory_pool_bytes_max Max bytes of a given JVM memory pool.
# TYPE jvm_memory_pool_bytes_max gauge
jvm_memory_pool_bytes_max{pool="Code Cache",} 2.5165824E8
jvm_memory_pool_bytes_max{pool="Metaspace",} -1.0
jvm_memory_pool_bytes_max{pool="Compressed Class Space",} 1.073741824E9
jvm_memory_pool_bytes_max{pool="PS Eden Space",} 1.68296448E8
jvm_memory_pool_bytes_max{pool="PS Survivor Space",} 4718592.0
jvm_memory_pool_bytes_max{pool="PS Old Gen",} 3.58088704E8
# HELP jvm_memory_pool_bytes_init Initial bytes of a given JVM memory pool.
# TYPE jvm_memory_pool_bytes_init gauge
jvm_memory_pool_bytes_init{pool="Code Cache",} 2555904.0
jvm_memory_pool_bytes_init{pool="Metaspace",} 0.0
jvm_memory_pool_bytes_init{pool="Compressed Class Space",} 0.0
jvm_memory_pool_bytes_init{pool="PS Eden Space",} 3.407872E7
jvm_memory_pool_bytes_init{pool="PS Survivor Space",} 5242880.0
jvm_memory_pool_bytes_init{pool="PS Old Gen",} 8.9653248E7
# HELP jvm_threads_current Current thread count of a JVM
# TYPE jvm_threads_current gauge
jvm_threads_current 142.0
# HELP jvm_threads_daemon Daemon thread count of a JVM
# TYPE jvm_threads_daemon gauge
jvm_threads_daemon 107.0
# HELP jvm_threads_peak Peak thread count of a JVM
# TYPE jvm_threads_peak gauge
jvm_threads_peak 158.0
# HELP jvm_threads_started_total Started thread count of a JVM
# TYPE jvm_threads_started_total counter
jvm_threads_started_total 296.0
# HELP jvm_threads_deadlocked Cycles of JVM-threads that are in deadlock waiting to acquire object monitors or ownable synchronizers
# TYPE jvm_threads_deadlocked gauge
jvm_threads_deadlocked 0.0
# HELP jvm_threads_deadlocked_monitor Cycles of JVM-threads that are in deadlock waiting to acquire object monitors
# TYPE jvm_threads_deadlocked_monitor gauge
jvm_threads_deadlocked_monitor 0.0

See also

_PE - Using Prometheus Exporter for Bamboo