A module called pam_motd
is responsible for dynamically assembling the MOTD from any scripts located in it's configuration directory - /etc/update-motd.d
This is as simple as building a script that will output any contents/data that you'd like to see after successfully logging in to your machine.
Don't forget, the script must have exec permissions by the file owner (root).
No services or processes need to be restarted for a script to take affect.
For example, the following script will show the hostname, disk usage, memory usage, and uptime of the system:
bash -c "cat > /etc/update-motd.d/20-custom-login" <<'EOF'
#!/bin/bash
disk=`df -Ph / | tail -n +2`
diskSize=`echo "$disk" | awk '{print $2}'`
diskSpace=`echo "$disk" | awk '{print $3}'`
memory=`free -mt`
memoryTotal=`echo "$memory" | grep Mem | awk '{print $2" MB";}'`
memoryUsed=`echo "$memory" | grep Total | awk '{print $3" MB";}'`
echo -e '\0033\0143' #Clear the terminal
printf "\n\e[1;33mSystem Statistics:\e[0m"
echo "
Hostname..............: $(uname -n)
Disk Used.............: $diskSpace of $diskSize
Memory Used...........: $memoryUsed of $memoryTotal
System Uptime.........: $(uptime -p)
"
printf "\e[1;31m\nYou are logged in to a production machine.\nBe mindful of the commands you run!\e[0m"
printf "\n\n\n"
EOF && \
chmod 744 /etc/update-motd.d/20-custom-login