LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 06-05-2009, 06:43 PM   #1
ZiPPygEEk
LQ Newbie
 
Registered: May 2009
Posts: 14

Rep: Reputation: 0
Nagios Notification for Reboots


I'm going to open a fresh thread on this issue, in hope that others have the same issue/question.

I'm looking to setup an alert for when a server reboots. I've posted on another thread regarding a similar issue, but I wanted to explain it.

I have PING setup right now, which does indeed work but the problem is it doesn't notify me for reboots. By the time the server comes back up on its own, no notification is sent out.

We have a server that occasionally will just reboot itself, so I wanted to know when this happens.

What do you guys recommend? A service to be watched? The check-host-alive feature? Which by the way I have setup, but it also won't notify me fast enough.


Any thoughts or direction???


Thanks,

ZiPPy
 
Old 06-05-2009, 08:07 PM   #2
twantrd
Senior Member
 
Registered: Nov 2002
Location: CA
Distribution: redhat 7.3
Posts: 1,440

Rep: Reputation: 52
You can lower the retry check interval and the max check attempts. However, if the server comes back online in less than a minute, I would suggest just writing a daemon that watches the log file in the real time and send you guys an email when it sees a reboot entry.

-twantrd
 
Old 06-05-2009, 08:15 PM   #3
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Ubuntu
Posts: 8,507

Rep: Reputation: 124Reputation: 124
Have you considered writing a Nagios plugin that checks to see if the current uptime is less than the service check interval, and if so, sends an alert?
 
Old 06-05-2009, 08:19 PM   #4
Samotnik
Member
 
Registered: Jun 2006
Location: Belarus
Distribution: Debian GNU/Linux testing/unstable
Posts: 471

Rep: Reputation: 40
I think the best solution will be a simple messaging script in startup scripts of your machine. It will send you a message every time your server brings up after rebooting.
 
Old 06-05-2009, 08:22 PM   #5
twantrd
Senior Member
 
Registered: Nov 2002
Location: CA
Distribution: redhat 7.3
Posts: 1,440

Rep: Reputation: 52
Quote:
I think the best solution will be a simple messaging script in startup scripts of your machine. It will send you a message every time your server brings up after rebooting.
Actually, that's a better idea
 
Old 06-05-2009, 08:52 PM   #6
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Ubuntu
Posts: 8,507

Rep: Reputation: 124Reputation: 124
Quote:
Originally Posted by Samotnik View Post
I think the best solution will be a simple messaging script in startup scripts of your machine. It will send you a message every time your server brings up after rebooting.
Good call. KISS, right?
 
Old 06-08-2009, 06:04 PM   #7
ZiPPygEEk
LQ Newbie
 
Registered: May 2009
Posts: 14

Original Poster
Rep: Reputation: 0
I have no idea how to script any of these suggestions. I tried setting the retry interval, but that still doesn't help. If you set the normal interval to 2 or 3 min and then the retry interval to 1 minute, you will won't know when the server rebooted. Because by the time Nagios checks and both options, the server will have already come back up.

I might be making this harder than it needs to be, but there has to be an easy way just simply get notified when the server reboots itself. No interval checks or certain timed checks, just simply a notification that the server has rebooted. Is there not???


ZiPPy
 
Old 06-08-2009, 06:57 PM   #8
jamescondron
Member
 
Registered: Jul 2007
Location: Scunthorpe, UK
Distribution: Ubuntu 8.10; Gentoo; Debian Lenny
Posts: 961

Rep: Reputation: 69
How about some simple socket programming, your machine has a socket-server running which, when some specific data is received, flags up a notification. The other machine connects and sends this specific data on boot.
 
Old 06-09-2009, 03:49 AM   #9
twantrd
Senior Member
 
Registered: Nov 2002
Location: CA
Distribution: redhat 7.3
Posts: 1,440

Rep: Reputation: 52
Quote:
I might be making this harder than it needs to be, but there has to be an easy way just simply get notified when the server reboots itself.
Samotnik provided a very easy and quick solution for your problem. Do you know where your startup scripts are? After you know that piece, read up on bash scripting or find a bash script on the web that has an example of sending a piece of email.

-twantrd
 
Old 06-09-2009, 12:48 PM   #10
ZiPPygEEk
LQ Newbie
 
Registered: May 2009
Posts: 14

Original Poster
Rep: Reputation: 0
I don't script, nor do I have time to learn how to script. I am looking for the solution in Nagios. How are other people getting notified of reboots in Nagios? I highly doubt everybody is creating scripts for this type of notification. I'm not trying to be stubborn here, or difficult, but I simply not looking to learn how to script. I just need to get the basic level (at least for now) of Nagios up and running. The only piece I have missing right now, is the notification for restarts.

Thanks,

ZiPPy
 
Old 06-09-2009, 12:53 PM   #11
jamescondron
Member
 
Registered: Jul 2007
Location: Scunthorpe, UK
Distribution: Ubuntu 8.10; Gentoo; Debian Lenny
Posts: 961

Rep: Reputation: 69
Server Side:
Code:
#!/usr/bin/env python
#
"""
Server Side
Create connection, listen for 'Booted'
Flag
"""

import socket, sys

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
host = ''
port = 3000
s.bind((host,port))

while(1):
    s.listen(1)
    conn, addr = s.accept()
    
    data = conn.recv( 1000000 )
    if data == "Reboot":
        #Do Something To Notify You
        print "Theres One Reboot"
    
conn.close()
Client Side:
Code:
#!/usr/bin/env python
#
"""
Client Side:
Send the word 'Reboot'
When 'Done' received, exit.
"""

import socket, sys

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
host = "localhost"
port = 3000
s.connect((host,port))
s.send("Reboot")

i = 0
s.close()
I'm sure you can work out what to change for your set up. There, in simple python, a notifier. I thought scripting/programming ability was more or less a prerequisite of most sysadmin jobs nowadays.

Last edited by jamescondron; 06-09-2009 at 12:53 PM. Reason: Fix code tags
 
Old 06-09-2009, 04:30 PM   #12
ZiPPygEEk
LQ Newbie
 
Registered: May 2009
Posts: 14

Original Poster
Rep: Reputation: 0
First of all, what you have posted isn't exactly a "simple" script in Python. Your dealing with a socket and sys class, which isn't exactly something simple. Secondly, No! NOT ALL sysadmin know how to script or choose to script.

I believe the Unix adage said it best: "do one thing and do it well". I can most definitely say scripting for me is not one of them, or coding for that matter.

Secondly, I appreciate you posting the code but it still doesn't help me. I can't just take some code or script that somebody posted and throw it on a config of mine. More importantly, are we still dealing with Nagios here or something different? Whether it stupidity, hard seeing, I simply don't understand why this is so hard.

Short view:

Server reboots
Nagios sees this
Nagios sends notification of server reboot

How do you configure this in Nagios? Documentation? No ...the documentation simply states what functions, types ect... are, not how to use them.

Once again ...how are people getting notification of system reboots in Nagios? If I get razzed for this post, that's fine, but at least give me some direction on this notification =)


Cheers lads,

ZiPPy
 
Old 06-09-2009, 04:40 PM   #13
jamescondron
Member
 
Registered: Jul 2007
Location: Scunthorpe, UK
Distribution: Ubuntu 8.10; Gentoo; Debian Lenny
Posts: 961

Rep: Reputation: 69
Do one thing and do it all is a software consideration, your code should do one thing and do it well. Why are you determined to use nagios? Nagios is not the tool for this job. Nagios is the tool for lazy sysadmins who just want pretty screens to show the shareholders; if you want to know when a system boots up, then get the system to tell you. Much the same way I rely on the ringer on my phone to tell me a call is coming in, not a third party.
 
Old 06-09-2009, 05:06 PM   #14
ZiPPygEEk
LQ Newbie
 
Registered: May 2009
Posts: 14

Original Poster
Rep: Reputation: 0
Lazy sysadmins? What are you talking about? Nagios is a great tool to notify me when servers have issues, or network devices are down, overloaded ect... Lazy sysadmins??? Where do you get off saying that? How do you monitor your systems and network? I'm not talking about your little network at home man, this is for an enterprise network. You know what, why am I even bothering typing a response. Your just going to come back with some smart remark, I should of known this would end up to this point after your first ridiculous comment.

And once again ...I search for other Nagios admins. There has to be some out there ...have to be!


Cheers,

ZiPPy
 
Old 06-09-2009, 05:18 PM   #15
jamescondron
Member
 
Registered: Jul 2007
Location: Scunthorpe, UK
Distribution: Ubuntu 8.10; Gentoo; Debian Lenny
Posts: 961

Rep: Reputation: 69
500 (ish) Windows boxes, about 30 Linux, a file and app server, an on-site web and mail server (with our intranet) and a backup server. Those are ignoring the ones I have no immediate control over. This is at a reasonably well known high street bank, so I have to remotely look after a wide network, with emphasis on security.

Oh, and I think you mean should have known.

Now, back to the point at hand; why are you determined to use Nagios? You have several different solutions presented to you here.
 
  


Reply


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
E-mail notification with Nagios Hiroyatamoto Linux - Newbie 7 06-30-2009 12:18 PM
Few questions about Nagios - reboot notification, value=x notification. marccmile Linux - Software 5 06-04-2009 07:44 PM
NAGIOS notification ny101880 Linux - Newbie 14 01-04-2009 02:10 AM
help in nagios notification packets Linux - Software 2 10-10-2008 02:01 PM
Nagios E-mail notification Hiroyatamoto Linux - General 5 07-02-2008 04:55 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:42 PM.

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