Topic: Statistics on SSH Login: Server Info

Upon logging into my server I like see an overview of some very basic system statistics including:

  • Hard drive temperatures


  • Disk space

  • Memory Usage

  • Uptime and load

I've been using the ugly script  below and calling it from my ~/.bashrc so it gets loaded automatically upon login.  Anyone else do something similar or have recommended improvements?

As of now the output looks something like this:

Disks temps:
/
194 Temperature_Celsius     0x001a   040   054   000    Old_age   Always       -       40 (0 18 0 0)
/redundant
194 Temperature_Celsius     0x0022   110   094   000    Old_age   Always       -       40

Disk space:
/dev/sda1             109G  7.6G   96G   8% /
/dev/sdb1             1.8T  473G  1.4T  27% /redundant
/dev/sdc1             459G   88G  348G  21% /backups

Memory:
             total       used       free     shared    buffers     cached
Mem:           881        482        399          0         72        251
-/+ buffers/cache:        158        723
Swap:         1722        240       1482

Uptime and load:
 14:28:24 up 21:03,  3 users,  load average: 1.95, 2.10, 2.11

And here's the script that produces it:

echo "Disks temps:"
echo "/"
sudo smartctl -a /dev/sda | grep "Temperature_Celsius"
echo "/redundant"
sudo smartctl -a -d usbjmicron,1 /dev/sdb | grep "Temperature_Celsius"
echo ""
echo "Disk space:"
df -h | grep /dev/sd
echo ""
echo "Memory:"
free -m
echo ""
echo "Uptime and load:"
uptime
IRC: PizzaAndWine     Script bits: Incremental Backup | Sleep Timer

Re: Statistics on SSH Login: Server Info

Hi,

On my system I display /home and /data usage only if they are greater than 50 %, and I change the colour too, depending on the value.
the script :

#------------------------------------------////
# System Information:
#------------------------------------------////
clear
GREEN='\e[0;32m'
YELLOW='\e[1;33m'
RED='\e[1;31m'

sdata="$(df -h | grep /dev/md1 | awk '{print $5}' | cut -c1-2)"
shome="$(df -h | grep /dev/md0 | awk '{print $5}' | cut -c1-2)"


tdata="/data : "
if [ $sdata -lt 50 ]; then
    tdata=""
else
    if [ $sdata -lt 75 ]; then
        couleurD=$YELLOW
    else
        couleurD=$RED
    fi
    tdata=" /data : $couleurD$sdata %"
fi

thome="/home : "
if [ $shome -lt 50 ]; then
    thome=""
else
    if [ $shome -lt 75 ]; then
        couleurH=$YELLOW
    else
        couleurH=$RED
    fi
    thome=" /home : $couleurD$shome %"
fi    

tMem="$(free -m | grep Mem | awk '{print $2}')"
uMem="$(free -m | grep /ca | awk '{print $3}')"
pMem=$((100*$uMem/$tMem))

if [ $pMem -lt 15 ]; then
    couleurM=$GREEN
elif [ $pMem -lt 30 ]; then
    couleurM=$YELLOW
else
    couleurM=$RED
fi
echo -e "\e[1;35m`date '+%d/%m'`$GREEN$tdata$GREEN$thome$GREEN  Mem : $couleurM$pMem %$GREEN"

and the output :

http://pix.toile-libre.org/upload/thumb/1291740385.png

Re: Statistics on SSH Login: Server Info

have you tried messing with conky-cli ?

you just need to add 'out_to_console yes' to your conkyrc, don't know how it handles bars and graphics and stuff but might be useful.

- - - - - - - - Wiki Pages - - - - - - -
#! install guide           *autostart programs, modify the menu & keybindings
configuring Conky       *installing scripts

Re: Statistics on SSH Login: Server Info

Like the coloring -- good idea to remind me to pay attention if something is off.

Haven't played with conky-cli....though I was craving access to a number of its commands so i'll be looking into it. -- thanks for the tip!

IRC: PizzaAndWine     Script bits: Incremental Backup | Sleep Timer

Re: Statistics on SSH Login: Server Info

Sometimes, I use :

ssh -X conky

It can be useful too !