How to monitor OWASP Juice-Shop in Grafana with Prometheus
Learn how to visualize OWASP Juice-Shop metrics
OWASP Juice-Shop
I install OWASP Juice-Shop and expose port 3001 because port 3000 has my Grafana instance.
docker pull bkimminich/juice-shop
docker run -p 3001:3000 bkimminich/juice-shop
Prometheus
I install Prometheus and add OWASP Juice-Shop as static config so Prometheus can scrape it.
docker pull prom/prometheus
code prometheus.yml
mkdir /tmp/prometheus
chown 65534:65534 /tmp/prometheus #change folder owner to nobody
docker run --name prometheus -v ./prometheus.yml:/etc/prometheus/prometheus.yml -v /tmp/prometheus:/prometheus -d -p 9090:9090 prom/prometheus
prometheus.yml
# my global config
global:
scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
# scrape_timeout is set to the global default (10s).
# Alertmanager configuration
alerting:
alertmanagers:
- static_configs:
- targets:
# - alertmanager:9093
# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
rule_files:
# - "first_rules.yml"
# - "second_rules.yml"
# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
scrape_configs:
# The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
- job_name: 'juiceshop_local'
# metrics_path defaults to '/metrics'
# scheme defaults to 'http'.
static_configs:
- targets: ['192.168.122.24:3001']
Under 192.168.122.24:9090/targets I check if OWASP Juice-Shop metrics are scraped.
Grafana
I create a new data source and select my prometheus server.
I import a new dashboard and use the json of the OWASP github repository.
And thats it!