Code Monkey home page Code Monkey logo

docker_monitor's Introduction

Custom components for Home Assistant

maintainer

About

This repository contains the docker monitor component I developed for my own Home-Assistant setup. Feel free to use the component and report bugs if you find them. If you want to contribute, please report a bug or pull request and I will reply as soon as possible. Please star & watch my project such I can see how many people like my components and for you to stay in the loop as updates come along.

Docker Monitor

The Docker monitor allows you to monitor statistics and turn on/off containers. The monitor can connected to a daemon through the url parameter. When home assistant is used within a Docker container, the daemon can be mounted as follows -v /var/run/docker.sock:/var/run/docker.sock. The monitor is based on Glances and ha-dockermon and combines (in my opinion the best of both integrated in HA :)).

Events

The monitor can listen for events on the Docker event bus and can fire an event on the Home Assistant Bus. The monitor will use the following event:

  • {name}_container_event with name the same set in the configuration.

The event will contain the following data:

  • Container: Container name
  • Image: Container image
  • Status: Container satus
  • Id: Container ID (long)

Configuration

To use the docker_monitor in your installation, add the following to your configuration.yaml file:

# Example configuration.yaml entry
docker_monitor:
  hosts:
    - url: unix://var/run/docker.sock
      name: Docker
      event: true
      monitored_conditions:
        - version
      containers:
        homeassistant_homeassistant_1:
          switch: False
          sensors:
            - status
            - uptime
            - cpu_percentage_usage
            - memory_usage
            - memory_percentage_usage
            - network_total_up
            - network_total_down
        homeassistant_database_1:
          switch: False
          sensors:
            - status
            - uptime
            - cpu_percentage_usage
            - memory_usage
            - memory_percentage_usage
            - network_total_up
            - network_total_down
        homeassistant_mosquitto_1:
          switch: True
          sensors:
            - status
            - uptime
            - cpu_percentage_usage
            - memory_usage
            - memory_percentage_usage
            - network_total_up
            - network_total_down

Configuration variables

Parameter Type Description
name string (Required) Client name of Docker daemon. Defaults to Docker.
url string (Required) Host URL of Docker daemon. Defaults to unix://var/run/docker.sock.
event boolean (Optional) Listen for events from Docker. Defaults to false.
scan_interval time_period (Optional) Update interval. Defaults to 10 seconds.
monitored_conditions list (Optional) Array of conditions to be monitored. Defaults to all conditions
containers list (Required) Array of containers to monitor. Defaults to all containers.
Monitored Conditions Description Unit
version Docker version -
containers_total Total number of containers -
containers_paused Number of paused containers -
containers_running Number of running containers -
containers_stopped Number of stopped containers -
images_total Total number of images -
Container Conditions Description Unit
status Container status -
uptime Container start time -
image Container image -
cpu_percentage_usage CPU usage %
memory_usage Memory usage MB
memory_percentage_usage Memory usage %
network_total_up Network total upstream MB
network_total_down Network total downstream MB

Credits

docker_monitor's People

Contributors

ceerbeerus avatar obelix05 avatar rubendijk avatar sanderhuisman avatar walthowd avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.