今日のワンライナー:meminfoを調べる
某サーバのメモリ使用量に納得がいかないので、わかりやすく表示するワンライナーを書いた。
# cat /proc/meminfo |perl -E 'while(<>){m!^(.+):\s*(\d+)! and $h{$1}=$2} END { @active=qw/MemFree Active(file) Inactive(file) Unevictable Active(anon) Inactive(anon) SReclaimable SUnreclaim KernelStack PageTables VmallocUsed/; map { say "$_\t$h{$_}"; $total+=$h{$_} } @active; say "--"; say "MemTotal\t$h{MemTotal}";say "*Unknown\t".($h{MemTotal}-$total) }' MemFree 237356 Active(file) 355420 Inactive(file) 171960 Unevictable 15692 Active(anon) 43040 Inactive(anon) 62300 SReclaimable 48644 SUnreclaim 25252 KernelStack 1624 PageTables 7384 VmallocUsed 0 -- MemTotal 993172 *Unknown 24500
Unknownが700MBぐらいになるサーバあって悩んでいます。
以下の記事を参考にさせていただきました。