first commit

This commit is contained in:
Roy
2025-06-23 21:19:51 +02:00
commit a4f9ea11f3
69 changed files with 4857 additions and 0 deletions

62
scripts/motd Normal file
View File

@ -0,0 +1,62 @@
#/usr/local/bin/dynmotd
#!/bin/bash
USER=$(whoami)
HOSTNAME=$(uname -n)
MEMORY1=$(free -t -h | grep "Mem" | awk '{print $3;}')
MEMORY2=$(free -h | grep "Mem" | awk '{print $2;}')
PSA=$(ps -Afl | wc -l)
# time of day
DATE=$(date +"%F %H:%M:%S")
#System uptime
uptime=$(cat /proc/uptime | cut -f1 -d.)
upDays=$((uptime/60/60/24))
upHours=$((uptime/60/60%24))
upMins=$((uptime/60%60))
upSecs=$((uptime%60))
#System load
LOAD1=`cat /proc/loadavg | awk {'print $1'}`
LOAD5=`cat /proc/loadavg | awk {'print $2'}`
LOAD15=`cat /proc/loadavg | awk {'print $3'}`
#Host engine
ENGINE=$(hosted-engine --vm-status|grep "Engine status")
RUNNING_VMS=$(virsh -r list | awk '{print$2 " "$3}'|grep -v "Name State"| column -t)
#Some Colors
BRED='\033[1;31m'
RED='\033[0;31m'
NC='\033[0m' # No Color
#has the server been rebooted indicator
if [ $upDays -eq "0" ]; then
echo -e "${BRED}SERVER HAS BEEN REBOOTED $upHours hours AGO ${NC}";
fi
echo "
- System uptime.......: $upDays days $upHours hours $upMins minutes $upSecs seconds
- Current time........: $DATE
- Current user........: $USER
- Hostname............: $HOSTNAME
- Release.............: `cat /etc/redhat-release`
- Users...............: Currently `users | wc -w` user(s) logged on
- CPU usage...........: $LOAD1, $LOAD5, $LOAD15 (1, 5, 15 min)
- Memory used.........: $MEMORY1 of $MEMORY2
- Swap in use.........: `free -m | tail -n 1 | awk '{print $3}'` MB
- Processes...........: $PSA running
- VM's on this HV.....:
$RUNNING_VMS
- Host engine status..:
$ENGINE
==================================== volume status vm ===============================
$(gluster volume status vm clients|grep 'Brick\|Clients')
==================================== volume status engine ===========================
$(gluster volume status engine clients|grep 'Brick\|Clients')
"