не работает cgroup.memory[/,tasks]
fduchara opened this issue · 2 comments
выводит список всех процессов. вылечил так
!/bin/sh
Автор: Лесовский А.В.
Описание: Сбор данных о CGROUPS
CG_NAME="$1"
CG_PARAM="$2"
STAT_PARAM="$3"
NUMA_NODE="$4"
STAT_FILE="memory.stat"
NUMA_STAT="memory.numa_stat"
if [[ "$CG_PARAM" =~ "${STAT_FILE}" ]]
then
if [ $# -lt 3 ]; then echo "ZBX_NOTSUPPORTED"; exit; fi
grep -w $STAT_PARAM /sys/fs/cgroup/memory/$CG_NAME/memory.stat |cut -d' ' -f2 2> /dev/null || echo "ZBX_NOTSUPPORTED"
elif [[ "$CG_PARAM" =~ "${NUMA_STAT}" ]]
then
if [ $# -lt 4 ]; then echo "ZBX_NOTSUPPORTED"; exit; fi
grep -w $STAT_PARAM /sys/fs/cgroup/memory/$CG_NAME/memory.numa_stat |grep -oE N"$NUMA_NODE"=[0-9]+ |cut -d= -f2 2> /dev/null || echo "ZBX_NOTSUP$
else
if [ $# -lt 2 ]; then echo "ZBX_NOTSUPPORTED"; exit; fi
if [[ "$CG_PARAM" = "memory.oom_control" ]]
then
grep under_oom /sys/fs/cgroup/memory/$CG_NAME/memory.oom_control |cut -d" " -f2 2> /dev/null || echo "ZBX_NOTSUPPORTED"
else
if [[ "$CG_PARAM" = "tasks" ]]
then
cat /sys/fs/cgroup/memory/$CG_NAME/$CG_PARAM | wc -l 2> /dev/null || echo "ZBX_NOTSUPPORTED"
else
cat /sys/fs/cgroup/memory/$CG_NAME/$CG_PARAM 2> /dev/null || echo "ZBX_NOTSUPPORTED"
fi
fi
fi
I have a rough idea of what you are trying. Can you please send a PR of your UserScript? Please also make sure your script is complete an passes shellcheck tests. The one above is broken.
Sorry, this request was a very long time, I do not remember the context.
There was a problem that the script did not work on tsentos7.