Glances Container Monitoring

The Glances Integration does not include monitoring individual containers on a remote host. I therefore setup RestAPI sensors for each of my containers. Heres what I put in my configuration.yaml for each container. Once that was done I just setup some template cards.


  - platform: rest
    name: container-lms
    resource: http://<IP Address>:61208/api/4/containers/name/value/lms # were lms is the container name.
    method: GET
    value_template: >       
      {% if value_json.lms is defined and value_json.lms|length > 0 %} # captures if the container is deleted and recreated or using Podman Quadlets in my case.
        {{ value_json.lms[0].status }}
      {% else %}
         exited
      {% endif %}
    json_attributes:
      - lms
    scan_interval: 30