diff --git a/.gitignore b/.gitignore index 2e5f83a..21dcd5b 100644 --- a/.gitignore +++ b/.gitignore @@ -55,3 +55,4 @@ audiobookshelf/audiobooks/ audiobookshelf/config/ audiobookshelf/metadata/ audiobookshelf/podcasts/ +system-monitoring/grafana/storage/ diff --git a/system-monitoring/README.md b/system-monitoring/README.md deleted file mode 100644 index 94f9ff5..0000000 --- a/system-monitoring/README.md +++ /dev/null @@ -1,8 +0,0 @@ -# System monitoring using telegraf and influxdb - -1. Run the compose `docker-compose up -d` -2. Open [http://localhost:8086](http://localhost:8086) in the browser -3. Create a username and password, name your organization `tgm` and your first bucket `telegraf-bucket` -4. Choose quick start -> add data source -> Telegraf -5. Create a token and paste it in `telegraf/telegraf.conf` -6. Restart stack using `docker-compose up -d` diff --git a/system-monitoring/docker-compose.yaml b/system-monitoring/docker-compose.yaml index 6735370..c8e145b 100644 --- a/system-monitoring/docker-compose.yaml +++ b/system-monitoring/docker-compose.yaml @@ -10,8 +10,15 @@ services: - ./influxdb/config:/etc/influxdb2 restart: unless-stopped image: influxdb:2.1.1 - networks: - - proxy + environment: + - DOCKER_INFLUXDB_INIT_MODE=setup + - DOCKER_INFLUXDB_INIT_USERNAME=schueler + - DOCKER_INFLUXDB_INIT_PASSWORD=example-password + - DOCKER_INFLUXDB_INIT_ORG=telegraf + - DOCKER_INFLUXDB_INIT_BUCKET=telegraf-bucket + - DOCKER_INFLUXDB_INIT_ADMIN_TOKEN=t3S9_jBwHAUNwB4J_SD6p_hjBKmtFsrE1pKlx8CIm2vOkIV46-TrtmAncHzg9yHB6xIoqkvJRxWD_UiDjd_wnw== + # networks: + # - proxy # https://www.influxdata.com/time-series-platform/telegraf/ telegraf: container_name: telegraf @@ -20,9 +27,33 @@ services: - influxdb volumes: - ./telegraf/telegraf.conf:/etc/telegraf/telegraf.conf:ro - networks: - - proxy + - /var/run/docker.sock:/var/run/docker.sock:ro + - /sys:/rootfs/sys:ro + - /proc:/rootfs/proc:ro + - /etc:/rootfs/etc:ro + environment: + HOST_PROC: /rootfs/proc + HOST_SYS: /rootfs/sys + HOST_ETC: /rootfs/etc +# networks: +# - proxy + grafana: + container_name: grafana + image: grafana/grafana:latest + environment: + - GF_AUTH_ANONYMOUS_ORG_ROLE=Admin + - GF_AUTH_ANONYMOUS_ENABLED=true + - GF_AUTH_BASIC_ENABLED=false + - GF_PATHS_PROVISIONING=/etc/grafana/provisioning + - GF_INSTALL_PLUGINS=grafana-simple-json-datasource + ports: + - 3033:3000/tcp + volumes: + - ./grafana/provisioning:/etc/grafana/provisioning + - ./grafana/storage:/var/lib/grafana + # networks: + # - proxy -networks: - proxy: - external: true +# networks: +# proxy: +# external: true diff --git a/system-monitoring/grafana/provisioning/datasources/datasources.yml b/system-monitoring/grafana/provisioning/datasources/datasources.yml new file mode 100644 index 0000000..c8ad5ee --- /dev/null +++ b/system-monitoring/grafana/provisioning/datasources/datasources.yml @@ -0,0 +1,15 @@ +apiVersion: 1 + +datasources: + - name: InfluxDB + type: influxdb + access: proxy + url: http://influxdb:8086 + isDefault: true + jsonData: + version: Flux + organization: telegraf + defaultBucket: telegraf-bucket + tlsSkipVerify: true + secureJsonData: + token: t3S9_jBwHAUNwB4J_SD6p_hjBKmtFsrE1pKlx8CIm2vOkIV46-TrtmAncHzg9yHB6xIoqkvJRxWD_UiDjd_wnw== diff --git a/system-monitoring/telegraf/telegraf.conf b/system-monitoring/telegraf/telegraf.conf index 6e2dabb..fadcc0e 100644 --- a/system-monitoring/telegraf/telegraf.conf +++ b/system-monitoring/telegraf/telegraf.conf @@ -14,8 +14,8 @@ [[outputs.influxdb_v2]] urls = ["http://influxdb:8086"] - token = "FILL_ME_IN_AFTER_CREATING" - organization = "tgm" + token = "t3S9_jBwHAUNwB4J_SD6p_hjBKmtFsrE1pKlx8CIm2vOkIV46-TrtmAncHzg9yHB6xIoqkvJRxWD_UiDjd_wnw==" + organization = "telegraf" bucket = "telegraf-bucket"