diff --git a/puppet/zulip/files/nagios_plugins/zulip_app_frontend/check_worker_memory b/puppet/zulip/files/nagios_plugins/zulip_app_frontend/check_worker_memory index b40634d01c..a3b863e80a 100755 --- a/puppet/zulip/files/nagios_plugins/zulip_app_frontend/check_worker_memory +++ b/puppet/zulip/files/nagios_plugins/zulip_app_frontend/check_worker_memory @@ -9,9 +9,10 @@ if [ -z "$processes" ]; then echo "No workers running" exit 0 fi -ps -o vsize,size,pid,user,command --sort -vsize $processes > "$datafile" +mapfile -t processes <<< "$processes" +ps -o vsize,size,pid,user,command --sort -vsize "${processes[@]}" > "$datafile" cat "$datafile" -top_worker=$(cat "$datafile" | head -n2 | tail -n1) +top_worker=$(head -n2 "$datafile" | tail -n1) top_worker_memory_usage=$(echo "$top_worker" | cut -f1 -d" ") rm -f "$datafile" if [ "$top_worker_memory_usage" -gt 800000 ]; then