I’ll show you a simple script for easily monitor server
#!/bin/bash # Monitoring Server with ping ######################################################## # host/ip HOST="debian-tutorials.com" # NO ping request COUNT=3 # Report SUBJECT="Server Down!" EMAIL="admin@debian-tutorials.com" for host in $HOST do count=$(ping -c $COUNT $HOST | grep 'received' | awk -F',' '{ print $2 }' | awk '{ print $1 }') if [ $COUNT -eq 0 ]; then # Server is DOWN! echo "Host : $HOST is down (ping failed) at $(date)" | mail -s "$SUBJECT" $EMAILID fi done

Recent Comments