LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 02-03-2009, 11:06 AM   #1
marccmile
LQ Newbie
 
Registered: Nov 2008
Posts: 1

Rep: Reputation: 0
Few questions about Nagios - reboot notification, value=x notification.


Hi everyone.

I'm strugling to find the way to notify myself when server was rebooted (on localhost and on remote host by ssh). Any ideas? plug-ins?.
I need also to set up notification on services when value will = to some special value (not like by defualt- notification when value bigger than warnning or critical).
Thank you for any help.

Marcin
 
Old 02-03-2009, 01:41 PM   #2
MensaWater
Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 6,009
Blog Entries: 5

Rep: Reputation: 787Reputation: 787Reputation: 787Reputation: 787Reputation: 787Reputation: 787Reputation: 787
You could just add an init script to your servers that sends and email to you when it comes up. I'm assuming you're already doing a "PING" of some sort to tell when it is down. You wouldn't want it as critical AFTER it is down. Nagios will tell you when it went critical AND when it went back to OK and you configure how it does this with notifications in the service and host definitions using contacts and contactgroups.

If what you are asking is to have the Nagios service say when the last boot was you'd have to write a customized script that checks to see if it is up then print the "uptime" information. Nagios lets you create scripts where you can define "CRITICAL", "WARNING", "OK" and "UNDEFINED" statuses. With each of these you can print one line of text that will appear in your monitoring.

For your other question see last paragraph. You could set the value you want to be defined as "OK" but generate a different text line.

e.g. a script that does:
Between 0 and 5 = "OK" with text "This is operating at minimal level."
Between 6 and 10 = "OK" with text "This is somewhat loaded."
Between 10 and 15 = "WARNING" with text "You've reached minimum warning threshold."
Between 15 and 20 = "WARNING" with text "You are approaching critical theshold."
Between 20 and 25 = "CRITICAL" with text "System at low end of critical level".
Greater than 25 = "CRITICAL" with text "Oh my God, time to update the resume".

You can NOT have multiple lines in the text for a given status but can have multiple conditions that give you one of the statuses available with separate text as shown above.

The above is not the actual text of a script but is more a conceptual way of viewing it.
 
Old 02-03-2009, 02:12 PM   #3
curtisa
Member
 
Registered: Oct 2005
Location: Switzerland
Distribution: Ubuntu
Posts: 33

Rep: Reputation: 16
Hi,
Although I'm certainly no nagios expert, I would think you could get this notification by making use of the 'check-host-alive' command definition within nagios (should be enabled as part of the standard install I think). During the time when the server is being rebooted I don't think it'll be 'alive' as far as nagios is concerned. If it does report it as being alive then also try the 'check_ping' command as well. Eg in my commands.cfg file I have ...

Quote:
# 'check-host-alive' command definition
define command{
command_name check-host-alive
command_line $USER1$/check_ping -H $HOSTADDRESS$ -w 3000.0,80% -c 5000.0,100% -p 5
}
and

Quote:
# 'check_ping' command definition
define command{
command_name check_ping
command_line $USER1$/check_ping -H $HOSTADDRESS$ -w $ARG1$ -c $ARG2$ -p 5
}
then (and assuming your machine doesn't come up at the speed of light), one or both of these commands should result in one of more 'SOFT events' happening (ie a potential problem). Then you can configure to be notified (via email) after 1,2 or x failures. Eg (also from my commands.cfg)...

Quote:
# 'notify-host-by-email' command definition
define command{
command_name notify-host-by-email
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress:
$HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
}
Then, and if you've configured an admin/notification email address (in contacts.cfg), you should get an email.

Another way you could perhaps achieve pretty much the same result is to use event handlers to run some script (which does the email notification), however I use the event handlers to actually reboot any unresponsive machines (so whilst I'll get notified, the rebooting process should have already happened by the time I'm trying to ssh in to reboot it myself).

Once you get it configured correctly I think you'll find it pretty powerful with all the things it can check (and then do with the event handlers)..

Alternatively perhaps you could just put some script within the init process which sends an email.

Good luck,
 
Old 02-11-2009, 07:31 AM   #4
kjyoti
LQ Newbie
 
Registered: Jul 2007
Location: INDIA
Distribution: RHEL 4.0
Posts: 2

Rep: Reputation: 0
Red face Nagios Help

Hi All,

I have installed Nagios 3.0 and it working fine without CGI authentication. But when I apply cgi authentication
it is giving error

Forbidden
You don't have permission to access /nagios/ on this server.


------------------------------------------------------------------------

Apache/2.0.52 (Red Hat) Server at 10.1.5.153 Port 80


This is my kine in httpd.conf for nagios

# BEGIN FOR NAGIOS

ScriptAlias /nagios/cgi-bin /usr/local/nagios/sbin

<Directory "/usr/local/nagios/sbin">
Options ExecCGI
AllowOverride AuthConfig
Order allow,deny
Allow from all
# AuthName "Nagios Access"
# AuthType Basic
# AuthUserFile /usr/local/nagios/etc/htpasswd.users
# Require nagiosadmin
</Directory>

Alias /nagios /usr/local/nagios/share

<Directory "/usr/local/nagios/share">
Options None
AllowOverride AuthConfig
Order allow,deny
Allow from all
# AuthName "Nagios Access"
# AuthType Basic
# AuthUserFile /usr/local/nagios/etc/htpasswd.users
# Require nagiosadmin
</Directory>

###############################################

I have gone through nagios documentation but still not able to apply cgi authentication.

This is my .htaccess file contents:-

AuthName "Nagios Access"
AuthType Basic
AuthUserFile /usr/local/nagios/etc/htpasswd.users
require valid-user

/usr/local/nagios/sbin and /usr/local/nagios/share has nagios nagios with owner with 777 permissions.

Waiting for kind help & support. It is very urgent.

Thanks & Regards,
Kumar
 
Old 02-11-2009, 03:28 PM   #5
MensaWater
Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 6,009
Blog Entries: 5

Rep: Reputation: 787Reputation: 787Reputation: 787Reputation: 787Reputation: 787Reputation: 787Reputation: 787
Please open a new thread rather than appending to an old one.

You'll get more visibility for a new thread as it will appear in "zero replies" for all users

The only people likely to see one appended to an existing question are those who already subscribed to the old one before.
 
Old 06-04-2009, 06:44 PM   #6
ZiPPygEEk
LQ Newbie
 
Registered: May 2009
Posts: 14

Rep: Reputation: 0
I have enabled the check-host-alive command, but still can't get Nagios to notify me as soon as the server reboots. I've messed with the timing in the check-host-alive setting, but I still can't get it to notify me when the server reboots

Basically, what I'm looking to do is get a notification when the server reboots. I mean as soon as that server reboots, I would like to be notified. Because when I look at the Service State Information, it tells me the next scheduled check will be in about 7min. Should I use something else for this notification?



Cheers,

ZiPPy

Last edited by ZiPPygEEk; 06-04-2009 at 07:25 PM.
 
  


Reply

Tags
nagios


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 11:18 AM
NAGIOS notification ny101880 Linux - Newbie 14 01-04-2009 01:10 AM
help in nagios notification packets Linux - Software 2 10-10-2008 01:01 PM
Nagios E-mail notification Hiroyatamoto Linux - General 5 07-02-2008 03:55 AM


All times are GMT -5. The time now is 03:10 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration