Archive for the ‘System Administration’ Category


I am downloading 3.9 G ISO image from my portal using wget and axel command

# du -sh test.iso

3.9G   test.iso

 

#time axel http://192.168.10.10/OS/test.iso

real   0m41.131s

user   0m2.572s

sys     0m30.477s

Downloading 3.9 GB iso image axel command taking 41 seconds

 

#time wget http://192.168.10.10/OS/test.iso

real   0m51.111s

user   0m2.382s

sys     0m30.022s

Downloading 3.9GB iso image wget command taking 51 seconds

Advertisements

Script

Run script in Local Machine save as “Server Performance.sh”

#!/bin/bash
clear

##variable Decalation Part
ip=$1
#SCRIPT STARTED

echo -e “\n\t\t\t $ip Server Performance\n\n ”
echo -e “\tNetwork Status\n”

# SERVER REACHABLE STATUS

COUNT=`ping -c2 $ip | grep received |awk ‘{print $4}’`

#check whether server is reachable Status
if [ $COUNT -eq 2 ]
then
echo -e “Reachable : Server is up”
else
echo -e “Reachable : Server is down”
fi

#Server Firwall Status

IT=`iptables -L | wc -l`

if [ $IT -eq 8 ]
then
echo -e “Firewall : Disabled \n”
else
echo -e “FIRWALL   : Enabled \n”
fi

echo -e “\tPhysical Status\n ”

#Server CPU Usage calculations

CU=`mpstat | awk ‘$12 ~ /[0-9.]+/ { print 100 – $12″%” }’`

echo -e “CPU Usage (%) : $CU”

# Server Memory Usage calculations
MU=`free -m | grep Mem | awk ‘{print $3/$2*100.0}’|cut -d”.” -f1`
U=`free -m | grep Mem | awk ‘{print $3}’`
F=`free -m | grep Mem | awk ‘{print $4}’`
C=`free -m | grep Mem | awk ‘{print $7}’`
echo -e “Memory Used (MB) : $U ”
R=`df -h | grep -w / | awk ‘{print $4}’|cut -d % -f1`
echo -e “Memory Free (MB) : $F ”
echo -e “Memory Clear (MB) : $C ”
echo -e “Disk Usage / (%) : $R ”

echo -e “\n\tProcess Status”
echo -e “\nTop 3 Memory Eating Process\n ”
ps axo rss,comm,pid | awk ‘{ proc_list[$2]++; proc_list[$2 “,”1] += $1; } END { for (proc in proc_list) { printf(“%d\t%s\n”, proc_list[proc “,” 1],proc); }}’ | sort -n | tail -n 3 | sort -rn | awk ‘{$1/=1024;printf “%.0fMB\t”,$1}{print $2}’

 

Output

Screenshot_4

Screenshot_8

Get Server Performance report from Remote Server run below script and save as “SPRM.sh”

#!/bin/bash
ip=$1
port=$2
user=$3
pass=$4

sshpass -p “$pass” scp -P $port /root/ServerPerformence.sh $user@$ip:/root/

clear

sshpass -p “$pass” ssh -p $port -o StrictHostKeyChecking=no $user@$ip “bash /root/ServerPerformence.sh $ip”

 

Output

Screenshot_7

Screenshot_9

 


Shell script to check whether MySQL Data Base  is up or down.

1.If it is down i Will get mail alert

2.In cronjob make it as every 2 mins to run

22

23


 

12 3 4 5 6 7 8 9 10


First take output of below commands

1  2

3

4

 

Patch activity started….

6 7 8 9 10 11 12 13 14 15 16 17


 

up up1


Rpm-Forge Repo setup

Repository Link 

## RHEL/CentOS 6 32 Bit OS ##
http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.i686.rpm

## RHEL/CentOS 6 64 Bit OS ##
http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm
Screenshot_1  Screenshot_3 Screenshot_4

EPEL  Repo setup

Repository Link 
http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm 
http://rpms.famillecollet.com/enterprise/remi-release-6.rpm

Screenshot_5 Screenshot_6 Screenshot_7 Screenshot_8