-   Linux - Software (
-   -   Few questions about Nagios - reboot notification, value=x notification. (

marccmile 02-03-2009 12:06 PM

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.


MensaWater 02-03-2009 02:41 PM

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.

curtisa 02-03-2009 03:12 PM

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 ...


# '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


# '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)...


# '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:
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,

kjyoti 02-11-2009 08:31 AM

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

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


Apache/2.0.52 (Red Hat) Server at Port 80

This is my kine in httpd.conf 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

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


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,

MensaWater 02-11-2009 04:28 PM

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.

ZiPPygEEk 06-04-2009 07:44 PM

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?



All times are GMT -5. The time now is 09:08 AM.