Disk space check
output=$(df -h | grep -vE '^Filesystem|tmpfs|cdrom' | awk '{ print $4 " " $1 }')
usep=$(echo $output | awk '{ print $1}' | cut -d'G' -f1 |cut -d '.' -f1)
partition=$(echo $output | awk '{ print $2 }' )
if [ $usep -le 10 ]; then
echo "Running out of space \"$partition ($usep GB)\" on $(hostname) as on $(date)" |
mail -s "Alert from file Server: Almost out of disk space $usep GB. Delete backups older than 3 days from /home/uploads." [email protected]
fi
Server down check bash
!/bin/bash
IP=192.168.1.91
ping -c 4 $IP &> /dev/null
if [ $? == 0 ]
then
echo "$IP Server is UP"
else
echo "91 server ($IP)is not responding on $(date).Check the server time once you start." |
mail -s "91 Bono QA server is down!!" [email protected]
fi
Check any IP duplication in network
#!/bin/bash
cd /rezsystem/rezadmin/
rm -rf ip_duplication1.log
rm -rf ip_duplication2.log
rm -rf ip_duplication3.log
rm -rf ip_duplication4.log
arp-scan -I eth0 -l | awk '{ print $1 }' >> ip_duplication1.log
sort ip_duplication1.log | uniq -d -c >> ip_duplication2.log
usep=$(cat ip_duplication2.log |wc -l)
if [ $usep -ne 0 ]; then
arp-scan -I eth0 -l |grep "DUP: 2" | awk '{ print $1 }' >> ip_duplication3.log
while read line
do
arp-scan -I eth0 -l |egrep -w $line >> ip_duplication4.log
done < ip_duplication3.log
echo "Following IPs are duplicated in 192.168.0.0/23 network as on $(date).
$(cat ip_duplication4.log)" |
mail -s "IP Duplication Found in Local Network." [email protected]
fi
output=$(df -h | grep -vE '^Filesystem|tmpfs|cdrom' | awk '{ print $4 " " $1 }')
usep=$(echo $output | awk '{ print $1}' | cut -d'G' -f1 |cut -d '.' -f1)
partition=$(echo $output | awk '{ print $2 }' )
if [ $usep -le 10 ]; then
echo "Running out of space \"$partition ($usep GB)\" on $(hostname) as on $(date)" |
mail -s "Alert from file Server: Almost out of disk space $usep GB. Delete backups older than 3 days from /home/uploads." [email protected]
fi
Server down check bash
!/bin/bash
IP=192.168.1.91
ping -c 4 $IP &> /dev/null
if [ $? == 0 ]
then
echo "$IP Server is UP"
else
echo "91 server ($IP)is not responding on $(date).Check the server time once you start." |
mail -s "91 Bono QA server is down!!" [email protected]
fi
Check any IP duplication in network
#!/bin/bash
cd /rezsystem/rezadmin/
rm -rf ip_duplication1.log
rm -rf ip_duplication2.log
rm -rf ip_duplication3.log
rm -rf ip_duplication4.log
arp-scan -I eth0 -l | awk '{ print $1 }' >> ip_duplication1.log
sort ip_duplication1.log | uniq -d -c >> ip_duplication2.log
usep=$(cat ip_duplication2.log |wc -l)
if [ $usep -ne 0 ]; then
arp-scan -I eth0 -l |grep "DUP: 2" | awk '{ print $1 }' >> ip_duplication3.log
while read line
do
arp-scan -I eth0 -l |egrep -w $line >> ip_duplication4.log
done < ip_duplication3.log
echo "Following IPs are duplicated in 192.168.0.0/23 network as on $(date).
$(cat ip_duplication4.log)" |
mail -s "IP Duplication Found in Local Network." [email protected]
fi