It's probably better to test a specific service rather than to use an ICMP ping request. Presuming you accept this advice, here is an example that will test the secure shell daemon:
hostlist=(host1.example.com host2.example.com)
for host in "${hostlist[@]}"; do
if nc -w 2 -z $host 22; then
echo "INFO: ssh on $host responding"
else
echo "ERROR: ssh on $host not responding"
fi
done