Replace with B2 archive contents
This commit is contained in:
52
scripts/status.sh
Executable file
52
scripts/status.sh
Executable file
@@ -0,0 +1,52 @@
|
||||
#!/bin/bash
|
||||
# Status check for runaway process killer
|
||||
|
||||
echo "============================================"
|
||||
echo "Runaway Process Killer - Status"
|
||||
echo "============================================"
|
||||
echo ""
|
||||
|
||||
echo "=== Services ==="
|
||||
echo -n "earlyoom: "
|
||||
systemctl is-active earlyoom 2>/dev/null || echo "not running"
|
||||
|
||||
echo -n "monit: "
|
||||
systemctl is-active monit 2>/dev/null || echo "not running"
|
||||
|
||||
echo ""
|
||||
echo "=== Current System Load ==="
|
||||
echo -n "CPU: "
|
||||
top -bn1 | grep "Cpu(s)" | awk '{print $2 "% user, " $4 "% system"}'
|
||||
|
||||
echo -n "RAM: "
|
||||
free -h | awk '/Mem:/ {printf "%s used / %s total (%.1f%% used)\n", $3, $2, $3/$2*100}'
|
||||
|
||||
echo -n "Swap: "
|
||||
free -h | awk '/Swap:/ {if ($2 != "0B") printf "%s used / %s total\n", $3, $2; else print "disabled"}'
|
||||
|
||||
echo ""
|
||||
echo "=== Configuration ==="
|
||||
if [ -f /etc/monit/conf.d/cpu-killer ]; then
|
||||
CYCLES=$(grep "for.*cycles" /etc/monit/conf.d/cpu-killer | grep -oP '\d+(?= cycles)')
|
||||
echo "CPU threshold: ${CYCLES} minutes at 95%+"
|
||||
else
|
||||
echo "CPU threshold: NOT CONFIGURED"
|
||||
fi
|
||||
|
||||
if [ -f /etc/default/earlyoom ]; then
|
||||
RAM_PCT=$(grep -oP '(?<=-m )\d+' /etc/default/earlyoom)
|
||||
echo "RAM threshold: <${RAM_PCT}% free memory"
|
||||
else
|
||||
echo "RAM threshold: NOT CONFIGURED"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "=== Recent Kill Events ==="
|
||||
echo "CPU kills (last 24h):"
|
||||
journalctl --since "24 hours ago" 2>/dev/null | grep "cpu-killer" | tail -3 || echo " None"
|
||||
|
||||
echo ""
|
||||
echo "RAM kills (last 24h):"
|
||||
journalctl -u earlyoom --since "24 hours ago" 2>/dev/null | grep -E "SIGTERM|SIGKILL" | tail -3 || echo " None"
|
||||
|
||||
echo ""
|
||||
Reference in New Issue
Block a user