added files & variables for docker running
This commit is contained in:
@@ -16,3 +16,7 @@ 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
|
||||||
|
RUN rm entrypoint.sh
|
||||||
|
COPY entrypoint.sh /
|
||||||
|
COPY freebox-monit.py /usr/local/py
|
||||||
|
COPY telegraf.conf /etc/telegraf/telegraf.conf
|
26
entrypoint.sh
Normal file
26
entrypoint.sh
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
if [ "${1:0:1}" = '-' ]; then
|
||||||
|
set -- telegraf "$@"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check if the /usr/local/py/.credentials file exists
|
||||||
|
if [ -f "/usr/local/py/.credentials" ]; then
|
||||||
|
# If the file exists, continue with the execution
|
||||||
|
echo "The freebox is registered, continuing the execution."
|
||||||
|
else
|
||||||
|
# If the file doesn't exist, execute the command
|
||||||
|
echo "The Freebox isn't registered, registering. Please allow acces from your freebox's panel."
|
||||||
|
/usr/local/py/freebox-monit.py -r
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $EUID -ne 0 ]; then
|
||||||
|
exec "$@"
|
||||||
|
else
|
||||||
|
|
||||||
|
# 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"
|
||||||
|
|
||||||
|
exec setpriv --reuid telegraf --init-groups "$@"
|
||||||
|
fi
|
1099
freebox-monit.py
Executable file
1099
freebox-monit.py
Executable file
File diff suppressed because it is too large
Load Diff
47
telegraf.conf
Normal file
47
telegraf.conf
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
# Telegraf Configuration
|
||||||
|
[global_tags]
|
||||||
|
|
||||||
|
# Configuration for telegraf agent
|
||||||
|
[agent]
|
||||||
|
interval = 10s
|
||||||
|
round_interval = true
|
||||||
|
metric_batch_size = 1000
|
||||||
|
metric_buffer_limit = 10000
|
||||||
|
collection_jitter = 0s
|
||||||
|
flush_interval = 10s
|
||||||
|
precision = 0s
|
||||||
|
hostname =
|
||||||
|
omit_hostname = false
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# OUTPUT PLUGINS #
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
|
||||||
|
# Configuration for sending metrics to InfluxDB
|
||||||
|
[[outputs.influxdb]]
|
||||||
|
urls = [$INFLUXDB_URL]
|
||||||
|
database = $INFLUXDB_DATABASE
|
||||||
|
database_tag =
|
||||||
|
skip_database_creation = $INFLUXDB_SKIP_DATABASE_CREATION
|
||||||
|
retention_policy =
|
||||||
|
write_consistency = any
|
||||||
|
timeout = 30s
|
||||||
|
username = $INFLUXDB_USERNAME
|
||||||
|
password = $INFLUXDB_PASSWORD
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# INPUT PLUGINS #
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# INPUT PLUGINS FREEBOX #
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
# Read metrics from one or more commands that can output to stdout
|
||||||
|
[[inputs.exec]]
|
||||||
|
commands = [
|
||||||
|
python3 /usr/local/py/freebox-monit.py -$ARGS
|
||||||
|
]
|
||||||
|
timeout = 5s
|
||||||
|
data_format = influx
|
Reference in New Issue
Block a user