From c7034fc51b8b03745ab5b275cb2a5714efc021f8 Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin Date: Mon, 1 Jul 2019 14:01:10 +0300 Subject: [PATCH] lib/memory: attempt #3 to determine memory limit for LXC container Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/84 --- lib/memory/memory_linux.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/memory/memory_linux.go b/lib/memory/memory_linux.go index a30ae18ce..4c913cba1 100644 --- a/lib/memory/memory_linux.go +++ b/lib/memory/memory_linux.go @@ -48,7 +48,7 @@ func readLXCMemoryLimit(totalMem int) (int, error) { // This should properly determine the limit inside lxc container. // See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/84 cmd := exec.Command("/bin/sh", "-c", - `cat $(mount | grep cgroup | grep memory | cut -d" " -f3)$(cat /proc/self/cgroup | grep memory | cut -d: -f3)/memory.limit_in_bytes`) + `cat /sys/fs/cgroup/memory$(cat /proc/self/cgroup | grep memory | cut -d: -f3)/memory.limit_in_bytes`) data, err := cmd.Output() if err != nil { return 0, err