63 lines
1.8 KiB
Plaintext
63 lines
1.8 KiB
Plaintext
#/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')
|
|
"
|