[SOLVED] redirecting nagios to check 3 times each error and then trigger mail
Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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.
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 ..
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:
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.
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
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.