Many fixes about variabilisation of the telegraf config for docker
This commit is contained in:
@@ -16,8 +16,9 @@ RUN python3 get-pip.py --prefix=/usr/local
|
|||||||
# Install Python dependencies
|
# Install Python dependencies
|
||||||
RUN python3 -m pip install requests
|
RUN python3 -m pip install requests
|
||||||
RUN pip install unidecode
|
RUN pip install unidecode
|
||||||
COPY entrypoint.sh /usr/local/py
|
RUN rm /entrypoint.sh
|
||||||
COPY freebox-monit.py /usr/local/py
|
ADD --chmod=1755 entrypoint.sh /
|
||||||
COPY telegraf.conf /etc/telegraf/telegraf.conf
|
ADD freebox-monit.py /usr/local/py/
|
||||||
|
ADD telegraf.conf /etc/telegraf/
|
||||||
|
|
||||||
ENTRYPOINT [/usr/local/py/entrypoint.sh]
|
ENTRYPOINT ["/entrypoint.sh"]
|
30
docker-compose.yml
Normal file
30
docker-compose.yml
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
version: "3"
|
||||||
|
services:
|
||||||
|
|
||||||
|
influxdb:
|
||||||
|
image: influxdb:1.8
|
||||||
|
hostname: influxdb_test
|
||||||
|
restart: always
|
||||||
|
environment:
|
||||||
|
INFLUX_DB: telegraf_test
|
||||||
|
INFLUXDB_USER: fbx
|
||||||
|
INFLUXDB_PASSWORD: fbx
|
||||||
|
|
||||||
|
fbx_telegraf:
|
||||||
|
image: freebox-exporter-test
|
||||||
|
container_name: fbx_telegraf_test
|
||||||
|
hostname: fbx_telegraf_test
|
||||||
|
environment:
|
||||||
|
- PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/bin:/sbin:/usr/local:/usr/src
|
||||||
|
- TZ=CET
|
||||||
|
- INFLUXDB_URL=http://influxdb_test:8086
|
||||||
|
- INFLUXDB_DATABASE=telegraf_test
|
||||||
|
- INFLUXDB_SKIP_DATABASE_CREATION=false
|
||||||
|
- INFLUXDB_USERNAME=fbx
|
||||||
|
- INFLUXDB_PASSWORD=fbx
|
||||||
|
- ARGS=SPHDIWX4
|
||||||
|
ports:
|
||||||
|
- 9125:8125/udp
|
||||||
|
- 9092:8092/udp
|
||||||
|
- 9094:8094
|
||||||
|
restart: unless-stopped
|
@@ -22,5 +22,5 @@ else
|
|||||||
# Allow telegraf to send ICMP packets and bind to privileged ports
|
# Allow telegraf to send ICMP packets and bind to privileged ports
|
||||||
setcap cap_net_raw,cap_net_bind_service+ep /usr/bin/telegraf || echo "Failed to set additional capabilities on /usr/bin/telegraf"
|
setcap cap_net_raw,cap_net_bind_service+ep /usr/bin/telegraf || echo "Failed to set additional capabilities on /usr/bin/telegraf"
|
||||||
|
|
||||||
exec setpriv --reuid telegraf --init-groups "$@"
|
exec setpriv --reuid telegraf --init-groups telegraf "$@"
|
||||||
fi
|
fi
|
||||||
|
@@ -3,14 +3,14 @@
|
|||||||
|
|
||||||
# Configuration for telegraf agent
|
# Configuration for telegraf agent
|
||||||
[agent]
|
[agent]
|
||||||
interval = 10s
|
interval = "10s"
|
||||||
round_interval = true
|
round_interval = true
|
||||||
metric_batch_size = 1000
|
metric_batch_size = 1000
|
||||||
metric_buffer_limit = 10000
|
metric_buffer_limit = 10000
|
||||||
collection_jitter = 0s
|
collection_jitter = "0s"
|
||||||
flush_interval = 10s
|
flush_interval = "10s"
|
||||||
precision = 0s
|
precision = "0s"
|
||||||
hostname =
|
hostname = ""
|
||||||
omit_hostname = false
|
omit_hostname = false
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
@@ -20,15 +20,15 @@
|
|||||||
|
|
||||||
# Configuration for sending metrics to InfluxDB
|
# Configuration for sending metrics to InfluxDB
|
||||||
[[outputs.influxdb]]
|
[[outputs.influxdb]]
|
||||||
urls = [$INFLUXDB_URL]
|
urls = ["${INFLUXDB_URL}"]
|
||||||
database = $INFLUXDB_DATABASE
|
database = "${INFLUXDB_DATABASE}"
|
||||||
database_tag =
|
database_tag = ""
|
||||||
skip_database_creation = $INFLUXDB_SKIP_DATABASE_CREATION
|
skip_database_creation = $INFLUXDB_SKIP_DATABASE_CREATION
|
||||||
retention_policy =
|
retention_policy = ""
|
||||||
write_consistency = any
|
write_consistency = "any"
|
||||||
timeout = 30s
|
timeout = "30s"
|
||||||
username = $INFLUXDB_USERNAME
|
username = "${INFLUXDB_USERNAME}"
|
||||||
password = $INFLUXDB_PASSWORD
|
password = "${INFLUXDB_PASSWORD}"
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# INPUT PLUGINS #
|
# INPUT PLUGINS #
|
||||||
@@ -41,7 +41,7 @@ password = $INFLUXDB_PASSWORD
|
|||||||
# Read metrics from one or more commands that can output to stdout
|
# Read metrics from one or more commands that can output to stdout
|
||||||
[[inputs.exec]]
|
[[inputs.exec]]
|
||||||
commands = [
|
commands = [
|
||||||
python3 /usr/local/py/freebox-monit.py -$ARGS
|
"python3 /usr/local/py/freebox-monit.py -$ARGS"
|
||||||
]
|
]
|
||||||
timeout = 5s
|
timeout = "5s"
|
||||||
data_format = influx
|
data_format = "influx"
|
||||||
|
Reference in New Issue
Block a user