File tree Expand file tree Collapse file tree 4 files changed +43
-3
lines changed
iotstack_defaults/additions Expand file tree Collapse file tree 4 files changed +43
-3
lines changed Original file line number Diff line number Diff line change @@ -7,9 +7,23 @@ RUN apt update && apt install -y rsync
77# where IOTstack template files are stored
88ENV IOTSTACK_DEFAULTS_DIR="iotstack_defaults"
99
10- # make a copy of the default config file
11- RUN mkdir -p /${IOTSTACK_DEFAULTS_DIR} && \
12- cp /etc/telegraf/telegraf.conf /${IOTSTACK_DEFAULTS_DIR}/
10+ # copy template files to image
11+ COPY ${IOTSTACK_DEFAULTS_DIR} /${IOTSTACK_DEFAULTS_DIR}
12+
13+ # 1. copy the default configuration file that ships with the image as
14+ # a baseline reference for the user, and make it read-only.
15+ # 2. strip comment lines and blank lines from the baseline reference to
16+ # use as the starting point for the IOTstack default configuration.
17+ # 3. edit the IOTstack default configuration to insert an appropriate
18+ # URL for influxdb running in another container in the same stack.
19+ ENV BASELINE_CONFIG=/${IOTSTACK_DEFAULTS_DIR}/telegraf-reference.conf
20+ ENV IOTSTACK_CONFIG=/${IOTSTACK_DEFAULTS_DIR}/telegraf.conf
21+ RUN cp /etc/telegraf/telegraf.conf ${BASELINE_CONFIG} && \
22+ chmod 444 ${BASELINE_CONFIG} && \
23+ grep -v -e "^[ ]*#" -e "^[ ]*$" ${BASELINE_CONFIG} >${IOTSTACK_CONFIG} && \
24+ sed -i '/^\[\[ outputs.influxdb\]\] /a\ \ urls = ["http://influxdb:8086"]' ${IOTSTACK_CONFIG}
25+ ENV BASELINE_CONFIG=
26+ ENV IOTSTACK_CONFIG=
1327
1428# replace the docker entry-point script with a self-repairing version
1529ENV IOTSTACK_ENTRY_POINT="entrypoint.sh"
Original file line number Diff line number Diff line change 1+ # Read metrics about docker containers
2+ # Credit: @tablatronix
3+ [[inputs.docker]]
4+ endpoint = "unix:///var/run/docker.sock"
5+ gather_services = false
6+ container_names = []
7+ source_tag = false
8+ container_name_include = []
9+ container_name_exclude = []
10+ timeout = "5s"
11+ perdevice = false
12+ total = true
13+ docker_label_include = []
14+ docker_label_exclude = []
15+ tag_env = ["HEAP_SIZE"]
Original file line number Diff line number Diff line change 1+ # Read metrics from MQTT topic(s)
2+ # Credit: https://github.com/gcgarner/IOTstack/blob/master/.templates/telegraf/telegraf.conf
3+ [[inputs.mqtt_consumer]]
4+ servers = ["tcp://mosquitto:1883"]
5+ topics = [
6+ "telegraf/host01/cpu",
7+ "telegraf/+/mem",
8+ "sensors/#",
9+ ]
10+ data_format = "json"
Original file line number Diff line number Diff line change 1010 - " 8125:8125/udp"
1111 volumes :
1212 - ./volumes/telegraf/:/etc/telegraf
13+ - /var/run/docker.sock:/var/run/docker.sock:ro
1314 depends_on :
1415 - influxdb
1516 - mosquitto
You can’t perform that action at this time.
0 commit comments