Skip to content

Commit

Permalink
Integrate mongodb prom exporter
Browse files Browse the repository at this point in the history
  • Loading branch information
Răzvan Burlăcioiu committed Mar 6, 2022
1 parent 912dc9d commit 7632362
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 1 deletion.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ docker-compose --profile monitoring up -d
docker-compose --profile perf up -d --scale wrk-injector--perf=5
```

# Prereqs
Install loki logging driver docker plugin
```
docker plugin install grafana/loki-docker-driver:2.4.1 --alias loki --grant-all-permissions
```

# Monitoring

App Metrics
Expand Down
6 changes: 6 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ services:
- /var/run/docker.sock:/var/run/docker.sock:ro
- /etc/machine-id:/etc/machine-id:ro
- /var/lib/dbus/machine-id:/var/lib/dbus/machine-id:ro
mongodb-exporter:
build: ./monitoring/mongodb_exporter/
command: ./mongodb_exporter-linux-amd64 -logtostderr -mongodb.uri mongodb://root:[email protected]:27017 -groups.enabled 'asserts,durability,background_flusshing,connections,extra_info,global_lock,index_counters,network,op_counters,op_counters_repl,memory,locks,metrics'
restart: always
ports:
- 9001:9001
loki:
image: grafana/loki:2.4.1
ports:
Expand Down
11 changes: 11 additions & 0 deletions monitoring/mongodb_exporter/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM alpine

#RUN apk update && apk add wget && \
# wget https://github.com/dcu/mongodb_exporter/releases/download/v1.0.0/mongodb_exporter-linux-amd64

# this is a big no no :) - don't commit binaries in git.
ADD mongodb_exporter-linux-amd64 /

RUN chmod 755 mongodb_exporter-linux-amd64

EXPOSE 9001
Binary file not shown.
6 changes: 5 additions & 1 deletion monitoring/prometheus/prometheus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ scrape_configs:
metrics_path: '/metrics'
static_configs:
- targets: ['host.docker.internal:8081']
- job_name: 'spring-monitoring-app'
- job_name: 'mongodb'
metrics_path: '/metrics'
static_configs:
- targets: ['host.docker.internal:9001']
- job_name: 'spring-hello-app'
metrics_path: '/actuator/prometheus'
static_configs:
- targets: ['host.docker.internal:8080']
Expand Down

0 comments on commit 7632362

Please sign in to comment.