zottelbeyer / QNAP-collectdinfluxdbgrafana

A simple to use Grafana Dashboard for your QNAP NAS
66 stars 6 forks source link

Changed docker compose to use ip addresses and it broke something #15

Closed goku-son closed 2 years ago

goku-son commented 2 years ago

I use docker-compose with macvlan as opposed to host IP with ports. A install using your docker file worked just fine. I modified it to use macvlan and now it is now longer working. collectd produces the following error:


[2022-08-31 16:30:58] [notice] read-function of plugin `snmp-QNAP-collectd' failed. Will suspend it for 60.000 seconds.

If I change collectd to use hostmode again, I no longer get the errors, but the dashboard no longer updates. Perhaps because influx and grafana are still using external IPs.

Here is my current docker-compose:


version: '3'

services:

  collectd:
    container_name: qnap-collectd
    image: ghcr.io/zottelbeyer/qnap-collectd-ghcr:latest
    privileged: true
    hostname: qnap-collectd
    networks:
      mylan:
        ipv4_address: 10.0.100.120
#    network_mode: host
    volumes:
      - /:/rootfs/:ro
      - ./qnap-collectd/collectd.conf.d:/etc/collectd/collectd.conf.d/:ro
    restart: always

  influxdb:
    container_name: qnap-influxdb
    image: influxdb:1.8
    hostname: qnap-influxdb
    networks:
      mylan:
        ipv4_address: 10.0.100.121
    environment:
      INFLUXDB_USER: ${INFLUXDB_USERNAME}
      INFLUXDB_USER_PASSWORD: ${INFLUXDB_PASSWORD}
      INFLUXDB_DB: ${INFLUXDB_DATABASE}
    volumes:
      - ./influxdb/influxdb.conf:/etc/influxdb/influxdb.conf
      - ./influxdb/types.db:/usr/share/collectd/types.db
      - ./influxdb-data:/var/lib/influxdb
    restart: always

  grafana:
    container_name: qnap-grafana
    image: grafana/grafana:latest
    hostname: qnap-grafana
    user: "root"
    networks:
      mylan:
        ipv4_address: 10.0.100.122
    environment:
      GF_SECURITY_ADMIN_USER: ${GF_SECURITY_ADMIN_USER}
      GF_SECURITY_ADMIN_PASSWORD: ${GF_SECURITY_ADMIN_PASSWORD}
    volumes:
      - ./grafana/datasource.yaml:/etc/grafana/provisioning/datasources/datasource.yaml
      - ./grafana/dashboard.yaml:/etc/grafana/provisioning/dashboards/dashboard.yaml
      - ./grafana/QNAP-collectd.json:/var/lib/grafana/dashboards/QNAP-collectd.json
      - ./grafana-data:/var/lib/grafana
    restart: always

networks:
    mylan:
      external: true

Here are the settings from my qnap:

image

Any ideas on how I could get this to work using macvlan as opposed to host/bridge networking? Thanks in advance for any pointers.