Sunday, January 5, 2025

Enabling prometheus monitoring in docker component in Anchore

Optional: Enabling Prometheus Monitoring

Uncomment the following section at the bottom of the docker-compose.yaml file:

#  # Uncomment this section to add a prometheus instance to gather metrics. This is mostly for quickstart to demonstrate prometheus metrics exported

#  prometheus:

#    image: docker.io/prom/prometheus:latest

#    depends_on:

#      - api

#    volumes:

#      - ./anchore-prometheus.yml:/etc/prometheus/prometheus.yml:z

#    logging:

#      driver: "json-file"

#      options:

#        max-size: 100m

#    ports:

#      - "9090:9090"

#

For each service entry in the docker-compose.yaml, change the following to enable metrics in the API for each service

ANCHORE_ENABLE_METRICS=false

to

ANCHORE_ENABLE_METRICS=true

Download the example prometheus configuration into the same directory as the docker-compose.yaml file, with name anchore-prometheus.yml

curl -O https://engine.anchore.io/docs/quickstart/anchore-prometheus.yml

docker-compose up -d

You should see a new container started and can access prometheus via your browser on http://localhost:9090

references:

https://engine.anchore.io/docs/quickstart/


No comments:

Post a Comment