LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 03-20-2012, 11:42 AM   #1
call_krushna
Member
 
Registered: Aug 2007
Location: India
Distribution: Ubuntu
Posts: 173

Rep: Reputation: 1
redirecting nagios to check 3 times each error and then trigger mail


Hi Team,

Need to configure my existing nagios server to trigger mail only after checking 3 times any service for warning and critical .Please let me know, what should I do to get it done .

Thanks in advance .

Last edited by call_krushna; 03-20-2012 at 11:57 AM.
 
Old 03-20-2012, 12:33 PM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,634

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by call_krushna View Post
Hi Team,
Need to configure my existing nagios server to trigger mail only after checking 3 times any service for warning and critical .Please let me know, what should I do to get it done .

Thanks in advance .
Ok...then as you were told in your other threads, all you need to do is write the script to do what you want. You were given a skeleton plugin script to monitor Tomcat. If you want it to check three times, then put a loop in your script to check three times....doesn't get more simple than that.
 
1 members found this post helpful.
Old 03-20-2012, 12:45 PM   #3
call_krushna
Member
 
Registered: Aug 2007
Location: India
Distribution: Ubuntu
Posts: 173

Original Poster
Rep: Reputation: 1
Quote:
Originally Posted by TB0ne View Post
Ok...then as you were told in your other threads, all you need to do is write the script to do what you want. You were given a skeleton plugin script to monitor Tomcat. If you want it to check three times, then put a loop in your script to check three times....doesn't get more simple than that.
Thanks for quicky reply .

Monitoring tomcat we can do it via script .I dont think ,I need script to change the time of triggering alert of nagios script .It is not possible to write script for every service .Please suggest ..
 
Old 03-20-2012, 01:15 PM   #4
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,634

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by call_krushna View Post
Thanks for quicky reply .
Monitoring tomcat we can do it via script. I dont think, I need script to change the time of triggering alert of nagios script. It is not possible to write script for every service .Please suggest ..
Yes, it's VERY possible to script a check for all your services. And if you check the Nagios documentation, you'd see a possible solution to what you're asking:

http://nagios.sourceforge.net/docs/3_0/flapping.html
 
Old 03-20-2012, 06:35 PM   #5
arashi256
Member
 
Registered: Jan 2008
Location: Brighton, UK
Distribution: Ubuntu 18.04 / CentOS 7.6
Posts: 397

Rep: Reputation: 62
Quote:
Originally Posted by TB0ne View Post
Ok...then as you were told in your other threads, all you need to do is write the script to do what you want. You were given a skeleton plugin script to monitor Tomcat. If you want it to check three times, then put a loop in your script to check three times....doesn't get more simple than that.
Would you want to do that, though? Because Nagios dictates the frequency of when the script is run via the NRPE daemon. So you'd be running three return-blocking checks within the loop before the script returned the result. Unless the state change of the service you're monitoring changes *very* quickly, it won't make much difference to the result that the plugin returns by looping like that. Otherwise you'd have to put a delay in the loop that would probably cause Nagios to not get it's result back at all within the allocated time frame to be useful to it's monitoring. I would have thought it's either the flapping functionality that Nagios provides or longer/shorter scheduled calls to NRPE if the output is not guaranteed. Although, as you suggest, mail need only be sent if some threshold is reached. You could store each check per NRPE call to a temporary file and then use scripting to send a mail regardless of the current host status that Nagios displays if two of the three checks is bad (for example). That's how I'd do it, anyway.
 
Old 03-20-2012, 08:13 PM   #6
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
I'm confused; I've got 253 service checks atm and under the 'Attempts' col, they all say 1/3 or 1/4.
I'm pretty sure that's the default for most checks, unless you wrote your own.
Nagios doesn't email me until its certain its got an issue; see templates.cfg => 'define service" for 'generic-service' => 'max_check_attempts 3 ; Re-check the service up to 3 times in order to determine its final (hard) state'
See also http://nagios.sourceforge.net/docs/n...finitions.html

HTH
 
Old 03-28-2012, 05:21 AM   #7
polinux
Member
 
Registered: Jun 2011
Location: Reading UK
Distribution: OpenSUSE, CenOS
Posts: 46

Rep: Reputation: 3
You could also set up a specific notification scheme for every single service. So for example:

Code:
define service{
        use                             nrpe-service
        host_name                       machine_name
        normal_check_interval           5
        service_description             Load
        check_command                   check_nrpe!check_load
        notifications_enabled           1
        max_check_attempts              3 
        }
In this case it woild send an email after 3 checks.
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Trigger jenkins build with URL trigger when using git? jonizen Linux - Server 1 10-14-2011 01:07 PM
nagios check resource djackbloodshed Ubuntu 2 03-30-2011 10:26 AM
Redirecting e-mail jgreenfi Linux - Newbie 1 01-02-2009 09:16 PM
How do I check responce times? Kanon Linux - General 1 10-06-2005 03:26 PM
Nagios and Check.cgi kopite2012 Linux - Newbie 1 04-08-2004 04:42 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 06:12 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration