-
Notifications
You must be signed in to change notification settings - Fork 0
/
monitoring
29 lines (27 loc) · 1.85 KB
/
monitoring
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
GNU nano 5.4 monitoring.sh
# 1 - The architecture of your operating system and its kernel version;
# 2 - The number of physical processors;
# 3 - The number of virtual processors;
# 4 - The current available RAM on your server and its utilization rate as a percentage;
# 5 - The current available memory on your server and its utilization rate as a percentage;
# 6 - The current utilization rate of your processors as a percentage;
# 7 - The date and time of the last reboot;
# 8 - Whether LVM is active or not;
# 9 - The number of active connections;
# 10 - The number of users using the server;
# 11 - The IPv4 address of your server and its MAC (Media Access Control) address;
# 12 - The number of commands executed with the sudo program.
wall "
# Architecture: $(uname -a)
# CPU physical: $(nproc)
# vCPU: $(cat /proc/cpuinfo | grep processor | wc -l)
# Memory Usage: $(free -m | sed -n 2p | awk '{print $3 }')/$(free -m | sed -n 2p | awk '{print $2 }') MB ($(free -m | awk 'NR == 2 {printf "%.2f", $3/$2*100}')%)
# Disk usage: $(df -m | grep "/dev/" | grep -v "/boot" | awk '{du += $3} END {print du}')/$(df -m | grep "/dev/" | grep -v "/boot/" | awk '{disk_u += $3} {disk_t += $2} END {printf("%d"), disk_u/disk_t*100}')%
# CPU load: $[100-$(vmstat | sed -n 3p | awk '{print $15}')]%
# Last boot: $(who -b | awk '{print $3}') $(who -b | awk '{print $4}')
# LVM use: $(if [ $(lsblk | grep "lvm" | wc -l) -gt 0 ]; then echo yes; else echo no; fi)
# Connections TCP: $(cat /proc/net/sockstat | grep TCP | awk '{print $3}') ESTABLISHED
# User log: $(who | wc -l)
# Network: $(hostname -I) ($(ip link | grep "link/ether" | awk '{print $2}'))
# Sudo: $(grep 'COMMAND=' /var/log/sudo/sudo_logs | wc -l) cmd
"