#!/bin/bash
# Shell script: temp.sh
# Autor: Santiago Crespo
cpu=$(cat /sys/class/thermal/thermal_zone0/temp)
echo "$(date) @ $(hostname)"
echo "-------------------------------------------"
echo "Temp.CPU => $((cpu/1000))'Cº"
# echo "Temp.GPU => $(/opt/vc/bin/vcgencmd measure_temp)"
echo "-------------------------------------------"
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_cur_freq | awk '{print "CPU " NR-1 ": " $1/1000 " MHz"}'
#vcgencmd measure_volts
#bastante util es conocer el espacio en disco para eso usamos df y el -h es human value
echo "-------------disk space -------------"
df -h -t ext4
echo "------------top 6 procesos que estan utilizando CPU-------------"
ps -Ao user,uid,comm,pid,pcpu,tty --sort=-pcpu | head -n 6
echo "-------------------last 5----------------"
last -5
#free -h
echo "-----------------Ip connected-------------"
netstat -tn 2>/dev/null | grep :443 | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -nr | head
#netstat -an | grep :443 | grep ESTABLISHED | wc -l
chmod 755 temp.sh
complemento para ubuntu server 26.04
#!/bin/bash
# Shell script: temp.sh
# Autor: Santiago Crespo
#cpu=$(cat /sys/class/thermal/thermal_zone0/temp)
sensors | grep -E "Tctl"
echo "$(date) @ $(hostname)"
# echo "-------------------------------------------"
# echo "Temp.CPU => $((cpu/1000))'Cº"
# echo "Temp.GPU => $(/opt/vc/bin/vcgencmd measure_temp)"
echo "-------------------------------------------"
# cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
grep MHz /proc/cpuinfo
#vcgencmd measure_volts
#bastante util es conocer el espacio en disco para eso usamos df y el -h es human value
#sudo dmesg | grep -i "amdgpu" | grep -i -E "vram|gtt|shared"
echo "-------------disk space -------------"
#df -h -t ext4
df -h -x tmpfs -x devtmpfs
echo "------------top 6 procesos que estan utilizando CPU-------------"
ps -Ao user,uid,comm,pid,pcpu,tty --sort=-pcpu | head -n 6
#echo "-------------------last 5----------------"
#last -5
#free -h
echo "-----------------Ip connected-------------"
netstat -tn 2>/dev/null | grep :443 | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -nr | head
#netstat -an | grep :443 | grep ESTABLISHED | wc -l
echo "----------------RAM-------------------------"
free -h