born2beroot/monitoring.sh
Danny Jonker ead8202504 missing
2023-08-22 23:14:00 +02:00

16 lines
1.0 KiB
Bash
Executable File

#!/bin/bash
printf "Architecture: " && uname -a
printf "Physical CPUs: " && grep 'cpu cores' /proc/cpuinfo | uniq | cut -d' ' -f 3
printf "Virtual CPUs: " && grep -c processor /proc/cpuinfo
printf "Memory Usage: " && free -m | grep Mem | awk '{ printf("%dMB/%dMB ", $3, $2) }' && free | grep Mem | awk '{ printf("%.2f%% used\n", $3*100/$2) }'
printf "Disk Usage: " && df -h | awk '$NF=="/"{printf "root Free %s ", $4}' && df -h | awk '$NF=="/home"{printf "Used %s, ", $5}' && df -h | awk '$NF=="/home"{printf "home Free %s ", $4}' && df -h | awk '$NF=="/home"{printf "Used %s\n", $5}'
printf "CPU Load: " && top -bn1 | grep load | awk '{printf "%.2f%%\n", $(NF-2)}'
printf "Last Boot: " && uptime -s
printf "LVM active: Well yes, Else you would not be able to boot.\n"
printf "Active Connections: " && netstat -natp | grep ESTAB | wc -l
printf "Active Users: " && who | sed '1d' | wc -l
printf "IP: " && hostname -I
printf "MAC: " && cat /sys/class/net/enp0s3/address
printf "Sudo Uses: " && cat /var/log/sudo/sudo.log | grep TTY | wc -l
exit