Versions Compared

Key

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

Prometheus Exporter for Bitbucket exposes Bitbucket metrics as JVM and application statistics to Prometheus.

...

  • 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 Bitbucket so that it collects metrics and pulls it into Prometheus

  1. Use the following scrape_configs:

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

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


  2.  Select Prometheus Exporter for Bitbucket endpoint in the Prometheus Status >Targets page where all registered applications are listed, to get the Prometheus metrics.


    <<<Update screenshot with Bitbucket 


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


    Image Removed<<<Update screenshot with Bitbucket Image Added

Configuring a secret token (recommended)

...

  1. Log into your Bitbucket as Admin.
  2. Go to Administration and click Prometheus Exporter Settings. The Prometheus Exporter Settings page opens. 
  3. Generate or create a Token. We recommend to use 128 length symbol.
     

    Image Modified


  4. Use generated or created secret token in the following scrape_configs in the prometheus.yml configuration file: 

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


...

Expand
titlePrometheus Metrics Example
# HELP jvm_classes_loaded The number of classes that are currently loaded in the JVM
# TYPE jvm_classes_loaded gauge
jvm_classes_loaded 51233.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 51631.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 398.0
# 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",} 5983496.0
jvm_buffer_pool_used_bytes{pool="mapped",} 0.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",} 5983496.0
jvm_buffer_pool_capacity_bytes{pool="mapped",} 0.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",} 92.0
jvm_buffer_pool_used_buffers{pool="mapped",} 0.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",} 207.0
jvm_gc_collection_seconds_sum{gc="PS Scavenge",} 3.631
jvm_gc_collection_seconds_count{gc="PS MarkSweep",} 6.0
jvm_gc_collection_seconds_sum{gc="PS MarkSweep",} 2.688
# HELP jvm_threads_current Current thread count of a JVM
# TYPE jvm_threads_current gauge
jvm_threads_current 240.0
# HELP jvm_threads_daemon Daemon thread count of a JVM
# TYPE jvm_threads_daemon gauge
jvm_threads_daemon 217.0
# HELP jvm_threads_peak Peak thread count of a JVM
# TYPE jvm_threads_peak gauge
jvm_threads_peak 305.0
# HELP jvm_threads_started_total Started thread count of a JVM
# TYPE jvm_threads_started_total counter
jvm_threads_started_total 725.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
# HELP bitbucket_success_auth_count User Success Auth Count
# TYPE bitbucket_success_auth_count counter
bitbucket_success_auth_count{username="admin",} 11.0
# HELP bitbucket_failed_auth_count User Failed Auth Count
# TYPE bitbucket_failed_auth_count counter
bitbucket_failed_auth_count{username="admin",} 6.0
# HELP bitbucket_repo_push_count Repository Pushes Count
# TYPE bitbucket_repo_push_count counter
bitbucket_repo_push_count{project="AAA",repository="aaa",username="admin",} 1.0
bitbucket_repo_push_count{project="BBB",repository="bbb",username="admin",} 3.0
# HELP bitbucket_pull_request_open Opened Pull Requests Count
# TYPE bitbucket_pull_request_open counter
bitbucket_pull_request_open{project="BBB",repository="bbb",} 1.0
# HELP bitbucket_pull_request_merge Merged Pull Requests Count
# TYPE bitbucket_pull_request_merge counter
# HELP bitbucket_pull_request_decline Declined Pull Requests Count
# TYPE bitbucket_pull_request_decline counter
# HELP bitbucket_maintenance_expiry_days_gauge Maintenance Expiry Days Gauge
# TYPE bitbucket_maintenance_expiry_days_gauge gauge
bitbucket_maintenance_expiry_days_gauge 0.0
# HELP bitbucket_all_users_gauge All Users Gauge
# TYPE bitbucket_all_users_gauge gauge
bitbucket_all_users_gauge 2.0
# HELP bitbucket_active_users_gauge Active Users Gauge
# TYPE bitbucket_active_users_gauge gauge
bitbucket_active_users_gauge 12.0
# HELP bitbucket_total_projects_gauge Total Projects Gauge
# TYPE bitbucket_total_projects_gauge gauge
bitbucket_total_projects_gauge 3.0
# HELP bitbucket_total_repositories_gauge Total Repositories Gauge
# TYPE bitbucket_total_repositories_gauge gauge
bitbucket_total_repositories_gauge 3.0
# HELP bitbucket_total_pull_requests_gauge Total Pull Requests Gauge
# TYPE bitbucket_total_pull_requests_gauge gauge
bitbucket_total_pull_requests_gauge 1.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.4729308E8
jvm_memory_bytes_used{area="nonheap",} 4.37424104E8
# 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",} 8.84473856E8
jvm_memory_bytes_committed{area="nonheap",} 4.61058048E8
# 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",} 9.54728448E8
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",} 2.62144E8
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.42522752E8
jvm_memory_pool_bytes_used{pool="Metaspace",} 2.60484456E8
jvm_memory_pool_bytes_used{pool="Compressed Class Space",} 3.4416896E7
jvm_memory_pool_bytes_used{pool="PS Eden Space",} 1.41894424E8
jvm_memory_pool_bytes_used{pool="PS Survivor Space",} 1.1347144E7
jvm_memory_pool_bytes_used{pool="PS Old Gen",} 2.94051512E8
# 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.43654912E8
jvm_memory_pool_bytes_committed{pool="Metaspace",} 2.78867968E8
jvm_memory_pool_bytes_committed{pool="Compressed Class Space",} 3.8535168E7
jvm_memory_pool_bytes_committed{pool="PS Eden Space",} 3.20339968E8
jvm_memory_pool_bytes_committed{pool="PS Survivor Space",} 1.835008E7
jvm_memory_pool_bytes_committed{pool="PS Old Gen",} 5.45783808E8
# 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",} 3.20864256E8
jvm_memory_pool_bytes_max{pool="PS Survivor Space",} 1.835008E7
jvm_memory_pool_bytes_max{pool="PS Old Gen",} 7.16177408E8
# 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",} 6.6060288E7
jvm_memory_pool_bytes_init{pool="PS Survivor Space",} 1.048576E7
jvm_memory_pool_bytes_init{pool="PS Old Gen",} 1.75112192E8
# HELP process_cpu_seconds_total Total user and system CPU time spent in seconds.
# TYPE process_cpu_seconds_total counter
process_cpu_seconds_total 667.5
# 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.531513253034E9
# HELP process_open_fds Number of open file descriptors.
# TYPE process_open_fds gauge
process_open_fds 1018.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 5.371572224E9
# HELP process_resident_memory_bytes Resident memory size in bytes.
# TYPE process_resident_memory_bytes gauge
process_resident_memory_bytes 1.779105792E9
# 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


See also

_PE - Using Prometheus Exporter for Bitbucket