├── .env ├── LICENCE ├── README.md ├── docker-compose.yml ├── entrypoint.sh └── telegraf └── telegraf.conf /.env: -------------------------------------------------------------------------------- 1 | DOCKER_INFLUXDB_INIT_MODE=setup 2 | 3 | ## Environment variables used during the setup and operation of the stack 4 | # 5 | 6 | # Primary InfluxDB admin/superuser credentials 7 | # 8 | DOCKER_INFLUXDB_INIT_USERNAME=changeme 9 | DOCKER_INFLUXDB_INIT_PASSWORD=changeme 10 | DOCKER_INFLUXDB_INIT_ADMIN_TOKEN=changeme 11 | 12 | # Primary InfluxDB organization & bucket definitions 13 | # 14 | DOCKER_INFLUXDB_INIT_ORG=changeme 15 | DOCKER_INFLUXDB_INIT_BUCKET=changeme 16 | 17 | # Primary InfluxDB bucket retention period 18 | # 19 | # NOTE: Valid units are nanoseconds (ns), microseconds(us), milliseconds (ms) 20 | # seconds (s), minutes (m), hours (h), days (d), and weeks (w). 21 | DOCKER_INFLUXDB_INIT_RETENTION=4d 22 | 23 | 24 | # InfluxDB port & hostname definitions 25 | # 26 | DOCKER_INFLUXDB_INIT_PORT=8086 27 | DOCKER_INFLUXDB_INIT_HOST=influxdb 28 | 29 | # Telegraf configuration file 30 | # 31 | # Will be mounted to container and used as telegraf configuration 32 | TELEGRAF_CFG_PATH=./telegraf/telegraf.conf 33 | 34 | # Grafana port definition 35 | GRAFANA_PORT=3000 36 | -------------------------------------------------------------------------------- /LICENCE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Hunter Johnston 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | ![Logo](https://user-images.githubusercontent.com/64506580/159311466-f720a877-6c76-403a-904d-134addbd6a86.png) 3 | 4 | 5 | # Telegraf, InfluxDB, Grafana (TIG) Stack 6 | 7 | Gain the ability to analyze and monitor telemetry data by deploying the TIG stack within minutes using [Docker](https://docs.docker.com/engine/install/) and [Docker Compose](https://docs.docker.com/compose/install/). 8 | 9 | 10 | 11 | 12 | ## ⚡️ Getting Started 13 | 14 | Clone the project 15 | 16 | ```bash 17 | git clone https://github.com/huntabyte/tig-stack.git 18 | ``` 19 | 20 | Navigate to the project directory 21 | 22 | ```bash 23 | cd tig-stack 24 | ``` 25 | 26 | Change the environment variables define in `.env` that are used to setup and deploy the stack 27 | ```bash 28 | ├── telegraf/ 29 | ├── .env <--- 30 | ├── docker-compose.yml 31 | ├── entrypoint.sh 32 | └── ... 33 | ``` 34 | 35 | Customize the `telegraf.conf` file which will be mounted to the container as a persistent volume 36 | 37 | ```bash 38 | ├── telegraf/ 39 | │ ├── telegraf.conf <--- 40 | ├── .env 41 | ├── docker-compose.yml 42 | ├── entrypoint.sh 43 | └── ... 44 | ``` 45 | 46 | Start the services 47 | ```bash 48 | docker-compose up -d 49 | ``` 50 | ## Docker Images Used (Official & Verified) 51 | 52 | [**Telegraf**](https://hub.docker.com/_/telegraf) / `1.19` 53 | 54 | [**InfluxDB**](https://hub.docker.com/_/influxdb) / `2.1.1` 55 | 56 | [**Grafana-OSS**](https://hub.docker.com/r/grafana/grafana-oss) / `8.4.3` 57 | 58 | 59 | 60 | ## Contributing 61 | 62 | Contributions are always welcome! 63 | 64 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: "3" 2 | 3 | services: 4 | influxdb: 5 | image: influxdb:2.1.1 6 | volumes: 7 | - influxdb-storage:/var/lib/influxdb2:rw 8 | env_file: 9 | - .env 10 | entrypoint: ["./entrypoint.sh"] 11 | restart: on-failure:10 12 | ports: 13 | - ${DOCKER_INFLUXDB_INIT_PORT}:8086 14 | 15 | telegraf: 16 | image: telegraf:1.19 17 | volumes: 18 | - ${TELEGRAF_CFG_PATH}:/etc/telegraf/telegraf.conf:rw 19 | env_file: 20 | - .env 21 | depends_on: 22 | - influxdb 23 | 24 | grafana: 25 | image: grafana/grafana-oss:8.4.3 26 | volumes: 27 | - grafana-storage:/var/lib/grafana:rw 28 | depends_on: 29 | - influxdb 30 | ports: 31 | - ${GRAFANA_PORT}:3000 32 | 33 | volumes: 34 | grafana-storage: 35 | influxdb-storage: 36 | -------------------------------------------------------------------------------- /entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Protects script from continuing with an error 4 | set -eu -o pipefail 5 | 6 | # Ensures environment variables are set 7 | export DOCKER_INFLUXDB_INIT_MODE=$DOCKER_INFLUXDB_INIT_MODE 8 | export DOCKER_INFLUXDB_INIT_USERNAME=$DOCKER_INFLUXDB_INIT_USERNAME 9 | export DOCKER_INFLUXDB_INIT_PASSWORD=$DOCKER_INFLUXDB_INIT_PASSWORD 10 | export DOCKER_INFLUXDB_INIT_ORG=$DOCKER_INFLUXDB_INIT_ORG 11 | export DOCKER_INFLUXDB_INIT_BUCKET=$DOCKER_INFLUXDB_INIT_BUCKET 12 | export DOCKER_INFLUXDB_INIT_RETENTION=$DOCKER_INFLUXDB_INIT_RETENTION 13 | export DOCKER_INFLUXDB_INIT_ADMIN_TOKEN=$DOCKER_INFLUXDB_INIT_ADMIN_TOKEN 14 | export DOCKER_INFLUXDB_INIT_PORT=$DOCKER_INFLUXDB_INIT_PORT 15 | export DOCKER_INFLUXDB_INIT_HOST=$DOCKER_INFLUXDB_INIT_HOST 16 | 17 | # Conducts initial InfluxDB using the CLI 18 | influx setup --skip-verify --bucket ${DOCKER_INFLUXDB_INIT_BUCKET} --retention ${DOCKER_INFLUXDB_INIT_RETENTION} --token ${DOCKER_INFLUXDB_INIT_ADMIN_TOKEN} --org ${DOCKER_INFLUXDB_INIT_ORG} --username ${DOCKER_INFLUXDB_INIT_USERNAME} --password ${DOCKER_INFLUXDB_INIT_PASSWORD} --host http://${DOCKER_INFLUXDB_INIT_HOST}:8086 --force 19 | --------------------------------------------------------------------------------