Networking with Telegraf and Docker

So far I have InfluxDB V1 and Grafana running in docker compose. I have Telegraf running on bare metal feeding data into the Influx container about the system and the docker environment.

My dilemma is as follows: I want to use InfluxDB Listener plugin to listen for metrics coming from a remote server across the internet.

Apparently I have to bind this listener to a port. This is where I’m lost. Currently my other exposed services are reverse proxied by a Traefik container. It intercepts requests to my server and routes them to the appropriate docker container.

My question is: how can I get it to route to Telegraf if it is running on bare metal? I am trying to keep my configuration as simple as possible, so adding ANOTHER network layer to reverse proxy telegraf seems a bit much.

Ideally to simplify things I could run telegraf in a docker container as well. I have yet to find a working example that allows me to monitor the docker environment as well as the host filesystem. Any info on that would be greatly appreciated, as I can reverse proxy and deploy the services with docker.

Telegraf config:

# OUTPUTS                                                  
  url = "" # required.
  database = "telegraf" # required.
  precision = "s"                            
# INPUTS                                    
  endpoint = "unix:///var/run/docker.sock"
  container_names = []                                 
  timeout = "5s"                
  perdevice = true
  ## Whether to report for each container total blkio and network stats or not
  total = false                         
  ## docker labels to include and exclude as tags.  Globs accepted.
  ## Note that an empty array for both will include all labels as tags
  docker_label_include = []                                        
  docker_label_exclude = []
  # Docker Endpoint
  #   To use TCP, set endpoint = "tcp://[ip]:[port]"
  #   To use environment variables (ie, docker-machine), set endpoint = "ENV"
  endpoint = "unix:///var/run/docker.sock"
  percpu = true
  totalcpu = true
  # filter all fields beginning with 'time_'
  fielddrop = ["time_*"]

    # tagpass conditions are OR, not AND.
    # If the (filesystem is ext4 or xfs) OR (the path is /opt or /home)
    # then the metric passes                                          
    fstype = [ "ext4", "xfs" ]
    # Globs can also be used on the tag values                      
    path = [ "/opt", "/home*" ]



# Collect response time of a TCP or UDP connection
  ## Protocol, must be "tcp" or "udp"
  ## NOTE: because the "udp" protocol does not respond to requests, it requires
  ## a send/expect string pair (see below).
  protocol = "tcp"
  ## Server address (default localhost)
  address = "localhost:80"










  ## servers to query
  servers = [""]


It is possible to monitor the host filesystem with Telegraf in a docker container, this should make it easier to wire in the listening port to your current setup. You just need to mount some host paths into the container and setup some environment variables: