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
Can I get notified just when a system comes back online?
-
- -fno-stack-protector
- Posts: 4366
- Joined: Mon Nov 19, 2012 12:10 pm
Re: Can I get notified just when a system comes back online?
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.
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
Re: Can I get notified just when a system comes back online?
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:nagios@Nagios.localdomain]
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
From: Nagios [mailto:nagios@Nagios.localdomain]
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?
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.
FYI - I still want normal notifications for everything else.
-
- -fno-stack-protector
- Posts: 4366
- Joined: Mon Nov 19, 2012 12:10 pm
Re: Can I get notified just when a system comes back online?
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.
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
Re: Can I get notified just when a system comes back online?
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 adam@martcoinc.com ; <<***** 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 helpdesk@martcoinc.com ; <<***** 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
}
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 adam@martcoinc.com ; <<***** 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 helpdesk@martcoinc.com ; <<***** 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
}
-
- Posts: 7698
- Joined: Mon Apr 23, 2012 4:28 pm
- Location: Travelling through time and space...
Re: Can I get notified just when a system comes back online?
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?
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?
Do you have any contacts defined on the template: windows-server ?
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
Re: Can I get notified just when a system comes back online?
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.
Former Nagios employee