1
0
Fork 0

Adding upstream version 1.34.4.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-05-24 07:26:29 +02:00
parent e393c3af3f
commit 4978089aab
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
4963 changed files with 677545 additions and 0 deletions

View file

@ -0,0 +1,50 @@
#!/bin/bash
# Remove legacy symlink, if it exists
if [[ -L /etc/init.d/telegraf ]]; then
rm -f /etc/init.d/telegraf
fi
# Add defaults file, if it doesn't exist
if [[ ! -f /etc/default/telegraf ]]; then
touch /etc/default/telegraf
fi
# Add .d configuration directory
if [[ ! -d /etc/telegraf/telegraf.d ]]; then
mkdir -p /etc/telegraf/telegraf.d
fi
# If 'telegraf.conf' is not present use package's sample (fresh install)
if [[ ! -f /etc/telegraf/telegraf.conf ]] && [[ -f /etc/telegraf/telegraf.conf.sample ]]; then
cp /etc/telegraf/telegraf.conf.sample /etc/telegraf/telegraf.conf
fi
# Set up log directories
LOG_DIR=/var/log/telegraf
mkdir -p $LOG_DIR
chown -R -L telegraf:telegraf $LOG_DIR
chmod 755 $LOG_DIR
STATE_DIR=/var/lib/telegraf
test -d "$STATE_DIR" || {
mkdir -p "$STATE_DIR"
chmod 770 "$STATE_DIR"
chown root:telegraf "$STATE_DIR"
}
STATE_FILE="$STATE_DIR/statefile"
test -f "$STATE_FILE" || {
touch "$STATE_FILE"
echo {} > "$STATE_FILE"
chown root:telegraf "$STATE_FILE"
chmod 660 "$STATE_FILE"
}
# Set up systemd service - check if the systemd directory exists per:
# https://www.freedesktop.org/software/systemd/man/sd_booted.html
if [[ -d /run/systemd/system ]]; then
cp -f /usr/lib/telegraf/scripts/telegraf.service /usr/lib/systemd/system/telegraf.service
systemctl enable telegraf
systemctl daemon-reload
fi