We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c730ad3 commit 9c23b3cCopy full SHA for 9c23b3c
system-metrics-collector
@@ -31,7 +31,7 @@ while true; do
31
SHARED_MEMORY=$(free -m | grep Mem | awk '{ print $5 }')
32
SYSTEM_DISK=$(df "$SYSTEM_DISK_LOCATION" | sed 1d | awk '{ printf("%6.2f%%\n", ($3/$2 * 100.0)) }')
33
DOCKER_DISK=$(df "$DOCKER_DISK_LOCATION" | sed 1d | awk '{ printf("%6.2f%%\n", ($3/$2 * 100.0)) }')
34
- CPU_USAGE=$(ps L | grep -q '%cpu' && ps -A -o %cpu | awk '{s+=$1} END {print s "%"}')
+ CPU_USAGE=$(ps L | grep -q '%cpu' && ps -A -o %cpu 2>/dev/null | awk '{s+=$1} END {print s "%"}')
35
echo "$(date) | cpu:$CPU_USAGE, mem:$MEMORY, system_disk:$SYSTEM_DISK, docker_disk:$DOCKER_DISK, shared_memory: $SHARED_MEMORY M" >> $OUTPUT
36
sleep 1
37
done
0 commit comments