Skip to content

Instantly share code, notes, and snippets.

View hilbix's full-sized avatar
🐢
I may be slow to respond.

Valentin Hilbig hilbix

🐢
I may be slow to respond.
View GitHub Profile
@hilbix
hilbix / kswapd-check.sh
Created March 28, 2013 15:27
Bash/AWK script to detect 100% CPU on kswapd processes, caused by a known Linux kernel issue on RHEL 5.5 (and CentOS) kernel 2.6.18-194.el5. Returns 0 if no problem, and usually 2 when the problem hits. (Note: It will return 1 on first invocation. Better safe than sorry.)
#!/bin/bash
PIDFILE=/tmp/kswapd-check.pids
scanpids()
{
cat -s /proc/[1-9]*/stat 2>/dev/null |
awk 'BEGIN {
want["(kswapd0)"]=1;
want["(kswapd1)"]=1;