7

What are the options for a simple monitoring system:

  • Operating System to install on: Linux
  • Only need to ping device.
  • Send alerts if devices are not responding to ping.
  • Simple to add devices - such as adding IP address in a text file with a description.
  • Alerts to be sent on email when hosts are not responding.
  • Will be monitoring 25-75 devices.
  • Don't need any web interface or anything else than ping, but if it has such, it is not a problem.
  • A script scheduled with Cron would be ok. But the best would be something with a bit of intelligence such as notify when host is back up after a down.
  • Free.

Note: A script would be ok.

6

I used to use the following script, it does everything you asked for. You just need to add a cronjob entry so that it gets executed regularly:

#!/bin/bash
# Simple SHELL script for Linux and UNIX system monitoring with
# ping command
# -------------------------------------------------------------------------
# Copyright (c) 2006 nixCraft project <http://www.cyberciti.biz/fb/>
# This script is licensed under GNU GPL version 2.0 or above
# -------------------------------------------------------------------------
# This script is part of nixCraft shell script collection (NSSC)
# Visit http://bash.cyberciti.biz/ for more information.
# -------------------------------------------------------------------------
# Setup email ID below
# See URL for more info:
# http://www.cyberciti.biz/tips/simple-linux-and-unix-system-monitoring-with-ping-command-and-scripts.html
# -------------------------------------------------------------------------

# add ip / hostname separated by while space
HOSTS='cat server_list.txt'

# no ping request
COUNT=1

# email report when
SUBJECT="Ping failed"
EMAILID="test@domain.com"
for myHost in $HOSTS
do
  count=$(ping -c $COUNT $myHost | grep 'received' | awk -F',' '{ print $2 }' | awk '{ print $1 }')
  if [ $count -eq 0 ]; then
    # 100% failed
    echo "Host : $myHost is down (ping failed) at $(date)" | mail -s "$SUBJECT" $EMAILID
  fi
done
  • I was going to write one, but it seems like you beat me! +1 – Seth Mar 11 '14 at 14:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.