bundlewrap/bundles/sshmon/files/check_oom_killer

15 lines
314 B
Text
Raw Normal View History

#!/bin/bash
journal="$(journalctl --since '12 hours ago' --no-hostname _TRANSPORT=kernel | grep -iF 'out of memory' -C1)"
if [[ -n "$journal" ]]
then
echo "CRITICAL - OOM killer killed processes:"
echo
echo "$journal"
exit 2
else
echo "OK - No OOM kills found in last 12 hours"
exit 0
fi