Archive for the ‘Server Performance Report’ Category


File 1 – Store List of server IP in /root/serverlist

Write a script to generate server performance report of CPU , Memory, Disk IO & Network at particular range of time using SAR command

script name : perfor-report1.sh

#!/bin/bash

for ip in `awk -F: ‘{print $1}’ /root/serverlist`
do
echo -e “\n CPU Performance of $ip \n”

ssh $ip ‘sar -f /var/log/sa/sa15 -s 18:33:02 -e 19:40:31’
echo -e “\n Memory Performance of $ip \n”
ssh $ip ‘sar -r -f /var/log/sa/sa15 -s 18:33:02 -e 19:40:31’
echo -e “\n Disk IO Performance of $ip \n”
ssh $ip ‘sar -b -f /var/log/sa/sa15 -s 18:33:02 -e 19:40:31’
echo -e “\n Network Performance of $ip \n”
ssh $ip ‘sar -n DEV -f /var/log/sa/sa15 -s 18:33:02 -e 19:40:31’
done

run as #./perfor-report1.sh

 

 

Want generate report your own input like time and date

script name : perfor-report2.sh

#!/bin/bash
day=$1

start =$2

end=$3

for ip in `awk -F: ‘{print $1}’ /root/serverlist`

do

echo -e “\n CPU Performance of $ip \n”

ssh $ip ‘sar -f $day -s $start -e $end’
echo -e “\n Memory Performance of $ip \n”
ssh $ip ‘sar -r -f $day -s $start -e $end’
echo -e “\n Disk IO Performance of $ip \n”
ssh $ip ‘sar -b -f $day -s $start -e $end’
echo -e “\n Network Performance of $ip \n”
ssh $ip ‘sar -n DEV -f $day -s $start -e $end’

done

run as #./perform-report2.sh /var/log/sa/sa21  12:05:00  19:00:58