0

I am running a server with several docker (unfortunately I cannot use podman because it is mailcow and this does not fully support podman yet) in one docker-compose file.

I have added cadvisor to the docker-compose.yaml:

cadvisor:
        image: gcr.io/cadvisor/cadvisor
        ports:
          - target: 8080
            published: 8080
            mode: host
        volumes:
          - /:/rootfs:ro
          - /var/run:/var/run:ro
          - /sys:/sys:ro
          - /var/lib/docker/:/var/lib/docker:ro
          - /dev/disk/:/dev/disk:ro
        deploy:
          resources:
            limits:
              cpus: '1'
              memory: 1G
            reservations:
              cpus: '0.25'
              memory: 512M

and start the container. On the same machine there is also directly (= not in a container) running prometheus exporter (on a different port).

On another machine (monitor) am running Prometheus (directly), Grafana(directly) and Alertmanager(podman). In Grafana I can see the metrics of all individual containers of the docker-compose.yaml`. (Of curse I could also create alerting rules there.)

In the prometheus.yaml (of 'monitor` machine) I have:

  - job_name: 'docker-mailcow'
    static_configs:
      - targets:
        - 10.x.x.x:8080

and I the Prometheus GUI under "targets" I can see the target under docker-mailcowwith state "up".

In the Alertmanager settings I have a general alert for all targets which are not "up". Because I want to include the state of each container from the docker-compose.yaml I need to have the state of each individual container in the Prometheus target view. Is this possible / how to do this?

Do I need to add to the client or the Monitormachine?

2
  • Are you looking for something like this stackoverflow.com/a/78284655/21363224 ?
    – markalex
    Commented Jun 20 at 10:01
  • No - setting up additional alert rules for individual or all containers would only be second solution for me. I want to appear the container as individual target `Prometheus target view so that my existing alerting rules are automatically also applied for them.
    – LeifSec
    Commented Jun 21 at 11:11

0