jamiebegin / metrics2mqtt

Publish cross-platorm system performance metrics to a MQTT broker.
MIT License
63 stars 10 forks source link

Create a Docker image #3

Closed bachya closed 4 years ago

bachya commented 4 years ago

This PR is a part of https://github.com/jamiebegin/metrics2mqtt/issues/2 and adds a docker folder that contains everything needed to build a Docker image of metrics2mqtt. It uses environment variables to define configuration parameters:

Raw usage:

$ docker run -it -v /proc:/proc -e MQTT_BROKER=localhost -e MQTT_USERNAME=username -e MQTT_PASSWORD=password123 -e COMMAND_OPTIONS_STRING='--cpu=60 --interval=10 --vm --du="/" -vvvvv' jamiebegin/metrics2mqtt:0.1.14

docker-compose usage:

---
version: "3"

services:

  metrics2mqtt:
    container_name: metrics2mqtt
    environment:
      COMMAND_OPTIONS_STRING: '--cpu=60 --interval=10 --vm --du="/" -vvvvv'
      MQTT_BROKER: localhost
      MQTT_PASSWORD: password123
      MQTT_USERNAME: username
    image: jamiebegin/metrics2mqtt:0.1.14
    restart: unless-stopped
    volumes:
      - /proc:/proc

Notes:

bachya commented 4 years ago

~Woops: didn't base this off of the correct branch (which I'm assuming should be develop). Will correct.~ Corrected.

jamiebegin commented 4 years ago

Very cool. Thank you!