The problem of sending a ping status

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
rumarcin11
Posts: 36
Joined: Thu Feb 25, 2016 7:42 am

The problem of sending a ping status

Post 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
User avatar
eloyd
Cool Title Here
Posts: 2190
Joined: Thu Sep 27, 2012 9:14 am
Location: Rochester, NY
Contact:

Re: The problem of sending a ping status

Post 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.
Image
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoyd
I'm a Nagios Fanatic! • Join our public Nagios Discord Server!
rumarcin11
Posts: 36
Joined: Thu Feb 25, 2016 7:42 am

Re: The problem of sending a ping status

Post 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.
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: The problem of sending a ping status

Post 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?
Former Nagios Employee
rumarcin11
Posts: 36
Joined: Thu Feb 25, 2016 7:42 am

Re: The problem of sending a ping status

Post 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
bwallace
Posts: 1145
Joined: Tue Nov 17, 2015 1:57 pm

Re: The problem of sending a ping status

Post 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?
Be sure to check out the Knowledgebase for helpful articles and solutions!
rumarcin11
Posts: 36
Joined: Thu Feb 25, 2016 7:42 am

Re: The problem of sending a ping status

Post 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
rumarcin11
Posts: 36
Joined: Thu Feb 25, 2016 7:42 am

Re: The problem of sending a ping status

Post 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		
}
Last edited by tmcdonald on Fri Feb 26, 2016 10:19 am, edited 1 time in total.
Reason: Please use [code][/code] tags around long output
User avatar
nozlaf
Posts: 172
Joined: Sun Nov 09, 2014 9:50 pm
Location: Victoria, Australia

Re: The problem of sending a ping status

Post 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.
Looking forward to seeing you all at #NagiosCon2019?
-Dedicated Lover of Nconf,PNP4Nagios and Nagvis
rumarcin11
Posts: 36
Joined: Thu Feb 25, 2016 7:42 am

Re: The problem of sending a ping status

Post 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
Last edited by rumarcin11 on Thu Mar 03, 2016 6:42 am, edited 1 time in total.
Locked