Skip to content

Commit f1345af

Browse files
committed
DLPX-96312 Removed curl and openssl
1 parent df102c9 commit f1345af

3 files changed

Lines changed: 44 additions & 26 deletions

File tree

debian/control

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ Standards-Version: 4.1.2
1313

1414
Package: performance-diagnostics
1515
Architecture: any
16-
Depends: python3-bpfcc, python3-minimal, python3-psutil, telegraf, docker.io, influxdb2, curl, openssl
16+
Depends: python3-bpfcc, python3-minimal, python3-psutil, telegraf, docker.io, influxdb2
1717
Description: eBPF-based Performance Diagnostic Tools
1818
A collection of eBPF-based tools for diagnosing performance issues.

influxdb/delphix-influxdb-init

Lines changed: 40 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
# Copyright (c) 2026 by Delphix. All rights reserved.
44
#
55
# One-time InfluxDB initialization: creates org, bucket, admin token,
6-
# a read-only token for DCT Smart Proxy, and appends the
7-
# [[outputs.influxdb_v2]] stanza to /etc/telegraf/telegraf.base.
6+
# a read-only token for DCT Smart Proxy, and writes the
7+
# [[outputs.influxdb_v2]] stanza to /etc/telegraf/telegraf.outputs.influxdb,
8+
# which is included by delphix-telegraf-service when INFLUXDB_ENABLED flag exists.
89
# Skips setup if InfluxDB is already initialized.
910
#
1011

@@ -100,10 +101,12 @@ if [[ -f "$INFLUXDB_SETUP_STATE_FILE" ]]; then
100101
key="${line%%=*}"
101102
value="${line#*=}"
102103
case "$key" in
103-
ADMIN_TOKEN) ADMIN_TOKEN="$value" ;;
104-
ORG_ID) ORG_ID="$value" ;;
105-
BUCKET_ID) BUCKET_ID="$value" ;;
104+
ADMIN_TOKEN) ADMIN_TOKEN="$value" ;;
105+
ORG_ID) ORG_ID="$value" ;;
106+
BUCKET_ID) BUCKET_ID="$value" ;;
106107
INFLUXDB_ADMIN_PASSWORD) INFLUXDB_ADMIN_PASSWORD="$value" ;;
108+
WRITE_TOKEN) WRITE_TOKEN="$value" ;;
109+
READ_TOKEN) READ_TOKEN="$value" ;;
107110
esac
108111
done <"$INFLUXDB_SETUP_STATE_FILE"
109112
else
@@ -134,29 +137,41 @@ else
134137
umask "$old_umask"
135138
fi
136139

137-
#
138-
# Create a write-only token for Telegraf.
139-
#
140-
WRITE_TOKEN_RESPONSE=$(influx_post "/api/v2/authorizations" "{
141-
\"orgID\": \"$ORG_ID\",
142-
\"description\": \"telegraf-write-token\",
143-
\"permissions\": [
144-
{\"action\": \"write\", \"resource\": {\"type\": \"buckets\", \"id\": \"$BUCKET_ID\", \"orgID\": \"$ORG_ID\"}}
145-
]
146-
}" "$ADMIN_TOKEN") || exit 1
147-
WRITE_TOKEN=$(json_field "$WRITE_TOKEN_RESPONSE" "['token']") || exit 1
140+
# Token creation is guarded so that on crash-resume (setup state exists but
141+
# meta file not yet written), we reuse already-created tokens rather than
142+
# creating orphaned duplicates in InfluxDB on each retry.
143+
WRITE_TOKEN="${WRITE_TOKEN:-}"
144+
READ_TOKEN="${READ_TOKEN:-}"
145+
146+
#
147+
# Create a write-only token for Telegraf (skipped if already persisted in state).
148+
#
149+
if [[ -z "$WRITE_TOKEN" ]]; then
150+
WRITE_TOKEN_RESPONSE=$(influx_post "/api/v2/authorizations" "{
151+
\"orgID\": \"$ORG_ID\",
152+
\"description\": \"telegraf-write-token\",
153+
\"permissions\": [
154+
{\"action\": \"write\", \"resource\": {\"type\": \"buckets\", \"id\": \"$BUCKET_ID\", \"orgID\": \"$ORG_ID\"}}
155+
]
156+
}" "$ADMIN_TOKEN") || exit 1
157+
WRITE_TOKEN=$(json_field "$WRITE_TOKEN_RESPONSE" "['token']") || exit 1
158+
printf 'WRITE_TOKEN=%s\n' "$WRITE_TOKEN" >>"$INFLUXDB_SETUP_STATE_FILE"
159+
fi
148160

149161
#
150-
# Create a read-only token for DCT Smart Proxy.
162+
# Create a read-only token for DCT Smart Proxy (skipped if already persisted in state).
151163
#
152-
READ_TOKEN_RESPONSE=$(influx_post "/api/v2/authorizations" "{
153-
\"orgID\": \"$ORG_ID\",
154-
\"description\": \"dct-read-token\",
155-
\"permissions\": [
156-
{\"action\": \"read\", \"resource\": {\"type\": \"buckets\", \"id\": \"$BUCKET_ID\", \"orgID\": \"$ORG_ID\"}}
157-
]
158-
}" "$ADMIN_TOKEN") || exit 1
159-
READ_TOKEN=$(json_field "$READ_TOKEN_RESPONSE" "['token']") || exit 1
164+
if [[ -z "$READ_TOKEN" ]]; then
165+
READ_TOKEN_RESPONSE=$(influx_post "/api/v2/authorizations" "{
166+
\"orgID\": \"$ORG_ID\",
167+
\"description\": \"dct-read-token\",
168+
\"permissions\": [
169+
{\"action\": \"read\", \"resource\": {\"type\": \"buckets\", \"id\": \"$BUCKET_ID\", \"orgID\": \"$ORG_ID\"}}
170+
]
171+
}" "$ADMIN_TOKEN") || exit 1
172+
READ_TOKEN=$(json_field "$READ_TOKEN_RESPONSE" "['token']") || exit 1
173+
printf 'READ_TOKEN=%s\n' "$READ_TOKEN" >>"$INFLUXDB_SETUP_STATE_FILE"
174+
fi
160175

161176
#
162177
# Write the [[outputs.influxdb_v2]] stanza to a dedicated telegraf output file

telegraf/delphix-telegraf-service

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,7 @@ if influxdb_is_enabled && [[ -f $INFLUXDB_OUTPUT ]]; then
5353
cat $INFLUXDB_OUTPUT >> $TELEGRAF_CONFIG
5454
fi
5555

56+
# Restrict permissions so the InfluxDB write token is not world-readable.
57+
chmod 640 $TELEGRAF_CONFIG
58+
5659
/usr/bin/telegraf -config $TELEGRAF_CONFIG

0 commit comments

Comments
 (0)