Skip to content

Commit 0709b1c

Browse files
Merge pull request #97 from delphix/dlpx/pr/aleksei-bokov/f1b9eb87-bb26-47c1-8e00-0c1545d89708
APIGW-10925 Extend support bundle data with historical docker stats
2 parents 1340e41 + 188e57d commit 0709b1c

File tree

8 files changed

+92
-4
lines changed

8 files changed

+92
-4
lines changed

.github/workflows/flake8.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
- name: Set up Python
1111
uses: actions/setup-python@v1
1212
with:
13-
python-version: 3.6
13+
python-version: "3.10"
1414
- name: flake8
1515
run: |
1616
python -m pip install --upgrade pip

cmd/nfs_threads.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ def print_line(interval):
153153
if e1 or e2 or e3:
154154
return
155155

156-
while(not sleep(interval)):
156+
while not sleep(interval):
157157
nextCpuTime, e1 = cpu_time(pids)
158158
nextPackets, nextEnqueued, nextWoken, e2 = pool_stats()
159159
nextRB, nextWB, nextRO, nextWO, nextMeta, e3 = nfs_stats()

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-bcc, python3-minimal, python3-psutil, telegraf
16+
Depends: python3-bcc, python3-minimal, python3-psutil, telegraf, docker.io
1717
Description: eBPF-based Performance Diagnostic Tools
1818
A collection of eBPF-based tools for diagnosing performance issues.

debian/postinst

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/bash
2+
3+
USER="telegraf"
4+
GROUP="docker"
5+
6+
# Ensure user and group exist
7+
if ! id "$USER" &>/dev/null; then
8+
echo "Error: User '$USER' does not exist" >&2
9+
exit 1
10+
fi
11+
12+
if ! getent group "$GROUP" &>/dev/null; then
13+
echo "Error: Group '$GROUP' does not exist" >&2
14+
exit 1
15+
fi
16+
17+
# Add user to the group if not already a member
18+
if ! groups "$USER" | grep -q "\b$GROUP\b"; then
19+
if usermod -a -G "$GROUP" "$USER"; then
20+
echo "User '$USER' added to group '$GROUP'."
21+
else
22+
echo "Error: Failed to add user '$USER' to group '$GROUP'" >&2
23+
exit 1
24+
fi
25+
fi
26+
27+
exit 0

debian/prerm

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/bash
2+
3+
USER="telegraf"
4+
GROUP="docker"
5+
6+
# Ensure user and group exist
7+
if ! id "$USER" &>/dev/null; then
8+
echo "Error: User '$USER' does not exist" >&2
9+
exit 1
10+
fi
11+
12+
if ! getent group "$GROUP" &>/dev/null; then
13+
echo "Error: Group '$GROUP' does not exist" >&2
14+
exit 1
15+
fi
16+
17+
# Remove user from the group
18+
if groups "$USER" | grep -q "\b$GROUP\b"; then
19+
if gpasswd -d "$USER" "$GROUP"; then
20+
echo "User '$USER' removed from group '$GROUP'."
21+
else
22+
echo "Error: Failed to remove user '$USER' from group '$GROUP'" >&2
23+
exit 1
24+
fi
25+
fi
26+
27+
exit 0

telegraf/delphix-telegraf-service

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
11
#!/bin/bash
22
BASE_CONFIG=/etc/telegraf/telegraf.base
33
DOSE_INPUTS=/etc/telegraf/telegraf.inputs.dose
4+
DCT_INPUTS=/etc/telegraf/telegraf.inputs.dct
45
PLAYBOOK_INPUTS=/etc/telegraf/telegraf.inputs.playbook
56
PLAYBOOK_FLAG=/etc/telegraf/PLAYBOOK_ENABLED
67
TELEGRAF_CONFIG=/etc/telegraf/telegraf.conf
78

89

10+
function engine_is_dct() {
11+
/usr/bin/get-appliance-variant | grep -q "dct" >/dev/null
12+
[[ "$?" == "0" ]]
13+
}
14+
915
function engine_is_object_based() {
1016
zdb -C | grep "type: 'object_store'" >/dev/null
1117
[[ "$?" == "0" ]]
@@ -23,6 +29,12 @@ if engine_is_object_based; then
2329
else
2430
cat $DOSE_INPUTS $BASE_CONFIG > $TELEGRAF_CONFIG
2531
fi
32+
elif engine_is_dct; then
33+
if playbook_is_enabled; then
34+
cat $PLAYBOOK_INPUTS $DCT_INPUTS $BASE_CONFIG > $TELEGRAF_CONFIG
35+
else
36+
cat $DCT_INPUTS $BASE_CONFIG > $TELEGRAF_CONFIG
37+
fi
2638
else
2739
if playbook_is_enabled; then
2840
cat $PLAYBOOK_INPUTS $BASE_CONFIG > $TELEGRAF_CONFIG

telegraf/telegraf.base

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
rotation_max_size = "50MB"
1919
rotation_max_archives = 9
2020
data_format = "json"
21-
namedrop = ["*estat_*", "agg_*", "zfs", "zpool*", "zcache*"]
21+
namedrop = ["*estat_*", "agg_*", "zfs", "zpool*", "zcache*", "docker*"]
2222

2323
# Define output file for ZFS related metrics
2424
[[outputs.file]]

telegraf/telegraf.inputs.dct

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
####################### Docker/DCT services Metrics ################################
2+
[[inputs.docker]]
3+
endpoint = "unix:///var/run/docker.sock"
4+
interval = "60s"
5+
timeout = "10s"
6+
namepass = [
7+
"docker_container_cpu",
8+
"docker_container_mem",
9+
"docker_container_blkio",
10+
"docker_container_status"
11+
]
12+
docker_label_exclude = ["com.docker.compose.*", "resty*"]
13+
14+
[[outputs.file]]
15+
files = ["/var/log/telegraf/metrics_docker.json"]
16+
rotation_max_size = "30MB"
17+
rotation_max_archives = 5
18+
data_format = "json"
19+
namepass = ["docker*"]
20+
21+
####################### End of Docker/DCT services Metrics #######################
22+

0 commit comments

Comments
 (0)