Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 06-19-2008, 08:08 AM   #1
Registered: Feb 2008
Posts: 73

Rep: Reputation: 15
serverdown alert!!!!

i want to write a script which gives me an alert when a server goes down..
means there is a central server in which i want to place a script.from this server i want to execute a script which continue sly moniter that another server goes down or not. if server goes down it will alert administrator by

so please tell me how can i implement this thought?...
Old 06-19-2008, 08:37 AM   #2
LQ Guru
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,075
Blog Entries: 14

Rep: Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251
You could do something as simple as:

if ! ping -c 1 $HOSTNAME >/dev/null 2>&1
then echo $HOSTNAME is not pinging |mailx -s "$HOSTNAME Down Alert" <> 
Where <hostname> is replaced by the host you want to check and <> is the user to whom you wish to send the email.

However, there are Open Source Software (OSS) packages for doing full monitoring.

We use Nagios central server with NRPE plugin on the UNIX/Linux hosts.

It depends on what you mean by "down" of course. A server's OS could be up and running and every process but the one that is critical to your operation might be up however that one process may mean your operation is "down". The Nagios/NRPE framework allows you determine exactly what you want to monitor. We have monitors for specific processes, server pingability, CPU load, memory utilization , disk space utilization, web page availability, and I've even written monitors to tell me when services have failed over from a primary node to a secondary in a cluster.
Old 06-19-2008, 08:41 AM   #3
Registered: Jan 2006
Distribution: debian
Posts: 63

Rep: Reputation: 15
my method sucks. Look at jlightner's method.

My favorite websites:
Buy and sell class notes, old exams, papers, lab reports, admission essays.
Ask and answer Linux questions.
Read free books without walking to the library.

Last edited by twlilinux; 08-15-2008 at 04:35 PM.
Old 06-19-2008, 08:48 AM   #4
LQ Guru
Registered: Oct 2005
Location: Northeast Ohio
Distribution: linuxdebian
Posts: 7,241
Blog Entries: 5

Rep: Reputation: 190Reputation: 190
A couple other options. Nagios is awesome but it may be overkill for what you are looking to do..

monit - Should be quick to get setup


Old 06-20-2008, 01:24 AM   #5
Registered: Feb 2008
Posts: 73

Original Poster
Rep: Reputation: 15
thank you...


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
when serverdown munna_dude Programming 2 03-07-2007 12:19 AM
Automatic Alert Joe Mongi Linux - Newbie 9 05-15-2006 10:26 AM
YUM Alert graemef Fedora 13 02-12-2006 03:26 PM
noob alert! (please help me out) theriched Red Hat 2 03-10-2005 08:46 AM
ALERT!!! ALERT!!! I messed up the UNIX!!! Firew Linux - Software 1 11-05-2001 12:48 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:12 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration