Page 1 of 1

Can I get notified just when a system comes back online?

Posted: Wed May 07, 2014 3:24 pm
by Martco
We have a Windows VM that needs the stay connected to a customer network at all times via VPN & we want to know when the VPN goes down. So I figured since I cannot ping it from our LAN while it's connected via VPN, I could try to setup Nagios to notify me when we ARE able to ping it since that would mean the VPN is down. We don't want any notices while the system is unpingable, just when it can be pinged, so kind of a 'reverse notification' I guess.

I am new to Nagios Core & it's been a while since I've been in linux command line, so please bear with me. Any help would be greatly appreciated. Thanks.

-Adam

Re: Can I get notified just when a system comes back online?

Posted: Wed May 07, 2014 3:26 pm
by sreinhardt
I would probably suggest using the negate plugin with check_icmp or something similar. This way you can invert the response from check_icmp when it is not pingable to be OK and when it is it will return critical. You might want decide what notification options too, but start with negate and see how that does for you. These should both be available via nagios-plugins with standard core installs.

Re: Can I get notified just when a system comes back online?

Posted: Tue May 13, 2014 1:44 pm
by Martco
I have been messing with negate and I think I have it how I want it. Now how do I get Nagios to ONLY send an email for this one system when I get a specific status? Below is the email I WANT to see, I do not want an email for anything other than this.

From: Nagios [mailto:[email protected]]
Sent: Tuesday, May 13, 2014 2:26 PM
To: Adam Hamilton
Subject: ** PROBLEM Service Alert: S_CCTVVM/NegatePING is CRITICAL **

***** Nagios *****

Notification Type: PROBLEM

Service: NegatePING
Host: S_CCTVVM
Address: 192.168.1.19
State: CRITICAL

Date/Time: Tue May 13 14:25:32 EDT 2014

Additional Info:

PING OK - Packet loss = 0%, RTA = 0.95 ms

Re: Can I get notified just when a system comes back online?

Posted: Wed May 14, 2014 6:59 am
by Martco
And is there a way to have that notification go to a different email than the other notifications?
FYI - I still want normal notifications for everything else.

Re: Can I get notified just when a system comes back online?

Posted: Wed May 14, 2014 12:05 pm
by sreinhardt
You would handle this through either the service notification options, sounds like you would only want to enable critical notifications. As for sending to a different email, the easiest route would be to create a secondary contact and send the notifications there. Otherwise you could add a second email field to an existing contact and copy then modify the notification command you are using to use the macro for that email address instead, I would probably suggest the second contact if this is a one off thing.

Re: Can I get notified just when a system comes back online?

Posted: Wed May 14, 2014 3:10 pm
by Martco
I'm trying to play with 'notification_options' in the 'define host' section and I added a 'contacts' line in the 'define host' section pointing to the contact I want it to go to, but when I put two 'define contacts' in contacts.cfg it emails both contacts despite specifying just one in the contacts line. All the other hosts, in a different .cfg file, have no contact line.

CONTACTS.CFG
define contact{
contact_name nagiosadmin ; Short name of user
use generic-contact ; Inherit default values from generic-contact template
alias Nagios Admin ; Full name of user
email [email protected] ; <<***** CHANGE THIS TO YOUR EMAIL ADDRESS ******
}

define contact{
contact_name CCTVVM ; Short name of user
use generic-contact ; Inherit default values from generic-contact template
alias Sader Group ; Full name of user
email [email protected] ; <<***** CHANGE THIS TO YOUR EMAIL ADDRESS ******
}

define contactgroup{
contactgroup_name admins
alias Nagios Administrators
members nagiosadmin
}

CCTVVM.CFG
define host{
use windows-server ; Inherit default values from a template
host_name S_CCTVVM ; The name we're giving to this host
alias S_CCTVVM ; A longer name associated with the host
address 192.168.1.19 ; IP address of the host
contacts CCTVVM
check_period 24x7
max_check_attempts 3
normal_check_interval 10
retry_check_interval 1
notification_interval 5
notification_period 24x7
notification_options d
}

Re: Can I get notified just when a system comes back online?

Posted: Wed May 14, 2014 3:24 pm
by slansing
Do you have your other contact assigned in the (windows-server) host template? Or on a service attached to that host?

Re: Can I get notified just when a system comes back online?

Posted: Thu May 15, 2014 6:50 am
by Martco
At first I did not, then I put a contacts nagiosadmin on ALL my other 'define host' sections, same result. Then I tried 'contacts nagiosadmin, !CCTVVM' but it didn't like that.

Re: Can I get notified just when a system comes back online?

Posted: Thu May 15, 2014 5:22 pm
by abrist
Do you have any contacts defined on the template: windows-server ?

Re: Can I get notified just when a system comes back online?

Posted: Thu May 15, 2014 5:30 pm
by tmcdonald
Can you PM me your /usr/local/nagios/var/objects.cache file? I want to see what the full config is for each of these services.