landscape-sysinfo for Centos OS

I have crated landscape-sysinfo for Centos. Its only beta version. Ans it looks like this:

Hostname: ange.vhost.lt IP address: 192.168.2.111
CPU load: 1.04 1.73 1.32
Uptime: 1 day, 12:06
Free memory: 811 MB Total memory: 32510 MB
Available updates: system up-to-date

Mail quere length: 48
Proccess number: 507

Active sessions: USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
root pts/1 192.168.2.100 17:07 8.00s 0.07s 0.07s -bash

and there is landscape-sysinfo-centos script:


#!/bin/bash
#Simple motd script for Centos 5/6
#created by Vitalijus Ryzakovas

b=`tput bold`
n=`tput sgr0`
echo "Checking for system updates:"
while ps aux | grep -e [y]um > /dev/null; do echo -n .;sleep 1; done &
up=`yum -e0 -d0 check-update | awk '{print $1}'`
reset
echo -e "${b}Hostname:${n} `hostname` \t\t IP address: `/sbin/ifconfig venet0:0 | grep "inet addr" | awk -F: '{print $2}' | awk '{print $1}'`"
echo -e "${b}CPU load:${n} `cat /proc/loadavg | cut -d" " -f1-3`"
echo -e "${b}Uptime:${n} `uptime | cut -d" " -f 4-7 | cut -d"," -f1-2`"
echo -e "Free memorry: `cat /proc/meminfo | grep MemFree | awk {'print int($2/1000)'}` MB \t\t Total memory: `cat /proc/meminfo | grep MemTotal | awk {'print int($2/1000)'}` MB"
echo -e "${b}Available updates:${n} `if [[ ! -n "${up}" ]]; then echo "system up-to-date"; else echo $up; fi`\n"
echo -e "Mail quere length: `exim -bpc`"
echo -e "Proccess number: `cat /proc/loadavg | cut -d"/" -f2| cut -d" " -f1`\n"
echo -e "${b}Active sessions:${n} `w | tail -n +2`"

you can create /usr/local/bin/landscape-sysinfo-centos
then just : chmod +x echo /usr/local/bin/landscape-sysinfo-centos >> /root/.bashrc

you can add this before

if [[ $- != *i* ]] ; then
# This will fix scp usage.
return
fi

Leave a Reply

Your email address will not be published. Required fields are marked *