Page 1 of 4

The problem of sending a ping status

Posted: Thu Feb 25, 2016 7:53 am
by rumarcin11
dear.
How to configure Nagios Yes to send ping hour on email, a host such as a router or printer, to get the email that ping is OK

Re: The problem of sending a ping status

Posted: Thu Feb 25, 2016 9:48 am
by eloyd
I want to make sure I understand what you are asking.

You want to get an email every hour with the results of a ping test from Nagios, no matter what state it is in?

If this is the case, my preferred approach would be to write a simple plugin that executes once every hour, does a check_ping command (with appropriate macros sent to it) and then mails the result to your appropriate contact. Otherwise, I do not believe you can get Nagios to always notify you on a normal check_ping if the state is in an OK state, unless it was in a non-OK state first.

Re: The problem of sending a ping status

Posted: Thu Feb 25, 2016 10:34 am
by rumarcin11
At the moment so I have that something turned off the device or service turned off, it sends email know, but still do not know how to do, to send information, such as I have a NAS device and it works all the time and we want to send us email stutus ca.

Re: The problem of sending a ping status

Posted: Thu Feb 25, 2016 11:03 am
by rkennedy
Can you please clarify what you're looking to do? Are you just trying to send emails that say the status is OK?

Re: The problem of sending a ping status

Posted: Thu Feb 25, 2016 1:55 pm
by rumarcin11
rkennedy wrote:Can you please clarify what you're looking to do? Are you just trying to send emails that say the status is OK?
I depends, to a state that is OK, I have a NAS device and wants the information by email about ping "OK" unknown device is still working, just wants to inf about ping, ping that is ok

Re: The problem of sending a ping status

Posted: Thu Feb 25, 2016 2:37 pm
by bwallace
Ok, so if you want emails sent on each OK status, then eloyd's comment is spot-on. One way to achieve that is by using MK live status to parse through Nagios' status.dat file:
http://mathias-kettner.de/checkmk_livestatus.html

Be aware that is going to require a bit of work on your end though.
I must say, this seems like overkill - wouldn't you rather deal with one email in a 24 hour period (assuming notification interval is hourly) letting you know a server is down as opposed to receiving 23 'OK' emails obscuring the ONE email you really need, about a server being down?

Re: The problem of sending a ping status

Posted: Thu Feb 25, 2016 3:03 pm
by rumarcin11
So, besides ping. It sends me an email about the status of something such as a disabled services, how to turn it sends the ok, just missing inf of ping that sends status once a day

Re: The problem of sending a ping status

Posted: Thu Feb 25, 2016 3:26 pm
by rumarcin11
This configuration only sends a status change, yet I would like to have it sends status as approximately every hour

Code: Select all

define host{
     	use			generic-host
	host_name 		QNAP	
	alias			Dysk Sieciowy	
	address			10.0.0.121	
	hostgroups		nas
	check_command           check-host-alive
    	notifications_enabled           1       
	event_handler_enabled           1  
 	max_check_attempts      10
        notification_interval   5
        notification_period     24x7
        notification_options    d,r,u,f
        contact_groups  	admins
	flap_detection_enabled		0
	retain_status_information	1
	retain_nonstatus_information	1
	active_checks_enabled		1
	passive_checks_enabled		1
	first_notification_delay	0 
	}

define service{
	use			generic-service	
	hostgroup_name		nas
	servicegroups		qn
	service_description	PING			
	check_command		check_ping!4.0,50%!8.0,100%
 		notifications_enabled           1       
		event_handler_enabled           1  		
		notification_interval          	2		
		is_volatile                    	1
		check_period                   	24x7
		max_check_attempts             	1
		normal_check_interval           5
         	retry_check_interval            1
		notification_period             24x7
		notification_options            w,r,u,c
		contact_groups                  admins
    		flap_detection_enabled		1
#		low_flap_threshold		20.0
#		high_flap_threshold		50.0
		retain_status_information	1
		retain_nonstatus_information	1
		active_checks_enabled		0
		passive_checks_enabled		1
#		first_notification_delay	2
#		initial_state			o
#		obsess_over_host		
#		check_freshness			
#		freshness_threshold		
}

Re: The problem of sending a ping status

Posted: Fri Feb 26, 2016 1:11 am
by nozlaf
I dont think doing this with Nagios Core is easy or wise like it can be done but just not the best tool for the job

i would recommend using Nagios Reactor for this

its easy to do in reactor, create a chain which runs the pig check and on success sends e-mail

if you are running both Reactor and Core you can let core handle the notifications for down and recovery but status heartbeat type e-mails like you describe can be achieved by setting a schedule in reactor to check the host hourly and notify based on that.

Re: The problem of sending a ping status

Posted: Fri Feb 26, 2016 3:24 am
by rumarcin11
I have a problem still want to get information on e-mail with "status ok" with work.
Because now I have so that "non-ok" to get in the mail