Hello!
In this article I will tell you how to monitor Atlassian Confluence with the Prometheus Exporter for Confluence app, Prometheus and Grafana. We will run Confluence, Prometheus and Grafana in docker. We will take metrics not only from the Prometheus for Confluence app, but also from cadviser and node-exporter. It will let us to get such metrics as container cpu usage, container memory usage and so.
It will be a tutorial. To follow this tutorial you need Git, Docker and Python installed. You can watch this video about this tutorial for more details.
Here is the file structure after we have created all files from this article:
- tutorial
- confluence
docker-compose.yml
- dc-app-performance-toolkit
- monitoring
docker-compose.yml
- data
- prometheus
- config
prometheus.yml
We will run a Confluence docker from Idalko. Make a docker-compose.yml file:
version: '3'
services:
confluence:
image: idalko/atlassian-confluence
environment:
- DISABLE_NOTIFICATIONS=TRUE
- JVM_MINIMUM_MEMORY=2G
- JVM_MAXIMUM_MEMORY=4G
- CONF_ARGS=-Datlassian.plugins.enable.wait=300
volumes:
- ./data/confluence:/opt/atlassian/confluence/data
ports:
- 8090:8090
restart: always
confluencedb:
image: postgres:9.6
environment:
- POSTGRES_PASSWORD=secret
- POSTGRES_USER=confluence
- POSTGRES_DB=confluence
volumes:
- ./data/db:/var/lib/postgresql/data
restart: always
Run it in terminal:
docker-compose up
Connect to the following url in your browser and setup Confluence:
http://localhost:8090
Choose your own database and provide the following parameters:
hostname = confluencedb
port = 5432
database name = 5432
username = confluence
password = confluence
After Confluence is up install the Prometheus Exporter for Confluence app.
You need to make sure that you have spaces with pages and blogs in your Confluence instance. You can either use your own data or generate data with Data Generator for Confluence.
Create the following docker-compose.yml file:
version: '3'
services:
prometheus:
image: prom/prometheus:latest
container_name: monitoring_prometheus
restart: unless-stopped
volumes:
- ./data/prometheus/config:/etc/prometheus/
- ./data/prometheus/data:/prometheus
command:
- '--config.file=/etc/prometheus/prometheus.yml'
expose:
- 9090
ports:
- 9090:9090
links:
- cadvisor:cadvisor
- node-exporter:node-exporter
node-exporter:
image: prom/node-exporter:latest
container_name: monitoring_node_exporter
restart: unless-stopped
ports:
- 9100:9100
expose:
- 9100
cadvisor:
image: google/cadvisor:latest
container_name: monitoring_cadvisor
restart: unless-stopped
volumes:
- /:/rootfs:ro
- /var/run:/var/run:rw
- /sys:/sys:ro
- /var/lib/docker/:/var/lib/docker:ro
ports:
- 8080:8080
expose:
- 8080
grafana:
image: grafana/grafana:latest
container_name: monitoring_grafana
restart: unless-stopped
links:
- prometheus:prometheus
volumes:
- ./data/grafana:/var/lib/grafana
ports:
- 3000:3000
environment:
- GF_SECURITY_ADMIN_PASSWORD=admin
- GF_USERS_ALLOW_SIGN_UP=false
add to the hosts file on your PC the following line:
127.0.0.1 host.docker.internal
We need it for this case:
If we want to call a url on our localhost inside a docker, we can not call it with localhost. In this case the localhost will call the localhost of the docker. That is why we will call a url on our locahost with host.docker.internal alias.
Create prometheus.yml in data/prometheus/config folder:
global:
scrape_interval: 15s
evaluation_interval: 15s
scrape_configs:
- job_name: 'prometheus'
static_configs:
- targets: ['localhost:9090','cadvisor:8080','node-exporter:9100']
- job_name: 'confluence'
scheme: http
metrics_path: '/plugins/servlet/prometheus/metrics'
static_configs:
- targets: ['host.docker.internal:8090']
Now run:
docker-compose up
After it go to Grafana by connecting to:
http://localhost:3000
And set up Prometheus data source and add a dashboard from this json. The Prometheus url is http://prometheus:9090
Clone this Bitbucket repo:
git clone https://github.com/atlassian/dc-app-performance-toolkit.git
Install proper dependencies following this Readme file.
Change in the dc-app-performance-toolkit/app/confluence.yml file:
env:
application_hostname: localhost
application_protocol: http
application_port: 8090
application_postfix:
admin_login: admin
admin_password: admin
concurrency: 5
test_duration: 1m
Run the tests with:
bzt confluence.yml
Alexey Matveev
software developer
MagicButtonLabs
Philippines
1,574 accepted answers
0 comments