@@ -16,7 +16,8 @@ INFLUXDB_META_FILE="$INFLUXDB_CONFIG_DIR/influxdb_meta"
1616# State file written immediately after /api/v2/setup so the script can resume
1717# if it is interrupted before the metadata file is fully written.
1818INFLUXDB_SETUP_STATE_FILE=" $INFLUXDB_CONFIG_DIR /influxdb_setup_state"
19- TELEGRAF_BASE=" /etc/telegraf/telegraf.base"
19+ INFLUXDB_FLAG=/etc/telegraf/INFLUXDB_ENABLED
20+ INFLUXDB_OUTPUT=/etc/telegraf/telegraf.outputs.influxdb
2021INFLUXDB_INIT_CONF=" $INFLUXDB_CONFIG_DIR /influxdb-init.conf"
2122
2223# Load tunable configuration (org, bucket, retention, wait parameters).
@@ -156,24 +157,21 @@ READ_TOKEN_RESPONSE=$(influx_post "/api/v2/authorizations" "{
156157READ_TOKEN=$( json_field " $READ_TOKEN_RESPONSE " " ['token']" ) || exit 1
157158
158159#
159- # Append the [[outputs.influxdb_v2]] stanza to telegraf.base so Telegraf
160- # knows where to ship metrics.
160+ # Write the [[outputs.influxdb_v2]] stanza to a dedicated telegraf output file
161+ # and enable it via the INFLUXDB_ENABLED flag. The flag is read by
162+ # delphix-telegraf-service to conditionally include this output.
161163#
162- if [[ ! -f " $TELEGRAF_BASE " ]]; then
163- log " WARNING: $TELEGRAF_BASE not found, skipping Telegraf output stanza."
164- elif ! grep -q " ^[[:space:]]*#\{0,1\}\[\[outputs\.influxdb_v2\]\]" " $TELEGRAF_BASE " ; then
165- cat >> " $TELEGRAF_BASE " << EOF
166-
164+ cat > " $INFLUXDB_OUTPUT " << EOF
167165[[outputs.influxdb_v2]]
168166 urls = ["http://127.0.0.1:8086"]
169167 token = "$WRITE_TOKEN "
170168 organization = "$INFLUXDB_ORG "
171169 bucket = "$INFLUXDB_BUCKET "
172170 namepass = ["cpu", "disk", "diskio", "mem", "net", "procstat", "processes", "swap", "system", "zfs"]
173171EOF
174- fi
175172# Enforce restrictive permissions so the write token is not world-readable.
176- chmod 640 " $TELEGRAF_BASE "
173+ chmod 640 " $INFLUXDB_OUTPUT "
174+ touch " $INFLUXDB_FLAG "
177175
178176#
179177# Persist org/bucket/admin credentials/tokens so DE APIs can expose them to DCT
0 commit comments