From 6eb065051cccbe07f626bcae5e9c9879abed219e Mon Sep 17 00:00:00 2001 From: d-stefanovic <83216231+d-stefanovic@users.noreply.github.com> Date: Mon, 28 Mar 2022 15:58:28 +0200 Subject: [PATCH] Added system metrics for shm (#312) * Added system metrics for shm * Added system metrics for shm --- system-metrics-collector | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/system-metrics-collector b/system-metrics-collector index fbd8e216..5c78a7bf 100644 --- a/system-metrics-collector +++ b/system-metrics-collector @@ -25,12 +25,15 @@ SYSTEM_DISK_LOCATION="/" DOCKER_DISK_LOCATION="/$([ -d /var/lib/docker ] && echo 'var/lib/docker')" OUTPUT="/tmp/system-metrics" +SHM_LOCATION_1="/dev/shm" +SHM_LOCATION_2="/run/shm" while true; do MEMORY=$(free | grep Mem | awk '{ printf("%6.2f%%\n", ($3/$2 * 100.0)) }') SYSTEM_DISK=$(df "$SYSTEM_DISK_LOCATION" | sed 1d | awk '{ printf("%6.2f%%\n", ($3/$2 * 100.0)) }') DOCKER_DISK=$(df "$DOCKER_DISK_LOCATION" | sed 1d | awk '{ printf("%6.2f%%\n", ($3/$2 * 100.0)) }') - echo "$(date) | mem: $MEMORY, system_disk: $SYSTEM_DISK, docker_disk: $DOCKER_DISK" >> $OUTPUT - + SHM_1=$(df "$SHM_LOCATION_1" | sed 1d | awk '{ printf("%6.2f%%\n", ($3/$2 * 100.0)) }') + SHM_2=$(df "$SHM_LOCATION_2" | sed 1d | awk '{ printf("%6.2f%%\n", ($3/$2 * 100.0)) }') + echo "$(date) | mem:$MEMORY, system_disk:$SYSTEM_DISK, docker_disk:$DOCKER_DISK, $SHM_LOCATION_1:$SHM_1, $SHM_LOCATION_2:$SHM_2" >> $OUTPUT sleep 1 done