#! /bin/bash
export LC_ALL=en_US.UTF-8
# cpu load(5 min)
#cpu_usage=`uptime | awk '{print $11}' | cut -d , -f1`
#echo "cpu " $cpu_usage
# memery usage
mem_usage=`free | grep "buffers/cache" | awk '{print $3 * 100 /($3 + $4) }'`
echo "memory " $mem_usage
# cpu usage
cpu_usage=`sar -C 1 1 | grep "Average:" | awk '{print $3}'`
echo "cpu " $cpu_usage
disk_tps=`sar -b 1 1 | grep "Average:" | awk '{print $2}'`
echo "disk tps " $disk_tps
em1_load=`sar -n DEV 1 1 | grep "Average:" | grep "em1"`
net_recv_packet_em1=`echo $em1_load | awk '{print $3}'`
net_send_packet_em1=`echo $em1_load | awk '{print $4}'`
net_recv_kB_em1=`echo $em1_load | awk '{print $5}'`
net_send_kB_em1=`echo $em1_load | awk '{print $6}'`
echo "em1 net load " $net_recv_packet_em1 $net_send_packet_em1 $net_recv_kB_em1 $net_send_kB_em1
em2_load=`sar -n DEV 1 1 | grep "Average:" | grep "em2"`
net_recv_packet_em2=`echo $em2_load | awk '{print $3}'`
net_send_packet_em2=`echo $em2_load | awk '{print $4}'`
net_recv_kB_em2=`echo $em2_load | awk '{print $5}'`
net_send_kB_em2=`echo $em2_load | awk '{print $6}'`
echo "em2 net load " $net_recv_packet_em2 $net_send_packet_em2 $net_recv_kB_em2 $net_send_kB_em2
swap_page_num=`sar -W 1 1 | grep "Average:" | awk '{print $2 + $3}'`
echo "swap pages number " $swap_page_num