#!/bin/sh cat > /dev/null << __EOF__ Keep an eye of: *processes ran by "remote" users, *temperature and load average, *free memory and *SSH break-in attempts

This is a simple system monitor that checks various things

__EOF__ touch tmp.monitor chmod 0600 tmp.monitor || exit while : do clear cat tmp.monitor echo " **Procs**" > tmp.monitor top -bn1 | grep -E '(sshguest|www-data|agnes|COMMAND)' >> tmp.monitor N_PROCS=5 top -bn1 | head -n $(($N_PROCS + 7)) | tail -n $(($N_PROCS)) >> tmp.monitor echo ' **who**' >> tmp.monitor #who | grep -vE '^oskar +(:0|tty[0-9])|^guest +tty[0-9]' >> tmp.monitor who >>tmp.monitor echo ' **uptime**' >> tmp.monitor uptime >> tmp.monitor echo ' **Fail2ban**' >> tmp.monitor today=`date +%Y-%m-%d` lines=5 f="/var/log/fail2ban.log" echo Unban $(grep $today $f | grep Unban | wc -l) >> tmp.monitor grep $today $f | grep Unban | tail -n $lines >> tmp.monitor echo Ban $(grep $today $f | grep Ban | wc -l) >> tmp.monitor grep $today $f | grep Ban | tail -n $lines >> tmp.monitor echo ' **SSH**' >> tmp.monitor # 62.72.235.216 netstat --inet -W -n | grep -E '83\.245\.206\.247:22(22)? +[0-9]' | grep ESTABLISHED >> tmp.monitor echo ' **free**' >> tmp.monitor free -m >> tmp.monitor echo ' **Temp**' >> tmp.monitor sensors coretemp-isa-0000 | grep '°C' >> tmp.monitor echo ' **Disk space**' >> tmp.monitor df -H | grep -vE ' /(run|dev|sys)(/.*)?' >> tmp.monitor sleep 5 done