Page 2 of 2

Re: stop sending mail after x messages

Posted: Thu Dec 13, 2012 8:10 am
by raven
Hi

Yes I confirm that I added one line in /usr/local/nagios/etc/nagios.cfg

cfg_file=/usr/local/nagios/etc/service_escalation.cfg

and the file service_escalation.cfg exist

because also if I put the wrong name in this line,when I send the command service nagios restart I have an error message

Re: stop sending mail after x messages

Posted: Thu Dec 13, 2012 10:18 am
by gshergill
Hi raven,

It might be worth me mentioning that my implementation of this functionality on a slave core machine is as follows:

-> Create a new service/host template with no contacts/contact_groups defined
-> Define the required service, e.g. HTTP, using the new template

Code: Select all

define service {
        use                   contactless-service
        host_name             hostname
        service_description   HTTP
        check_command         check_http
        max_check_attempts    2
        normal_check_interval 1
        retry_check_interval  1
        notification_interval 1
        }
-> Create a service escalation, e.g.

Code: Select all

define serviceescalation {
        host_name             hostname
        service_description   HTTP
        first_notification    1
        last_notification     5
        contact_groups        http-users
        }
Make sure to use the contacts/contact_groups you wish to receive the notifications when creating the service escalation.

What this does is it sends no notifications to anyone by default. Therefore, the only ones being sent out are the ones defined in the escalation. In this case it sends 5 emails only to the contacts which are a part of the group http-users.

This might not be the best way of doing it, I'm not sure, but this worked fine for me.
If anything it should suffice whilst you await a reply.

Hope this helps.

Kind Regards,

Gary Shergill

Re: stop sending mail after x messages

Posted: Thu Dec 13, 2012 11:39 am
by raven
Hi

Is more and more strange, if I put a wrong command on service_escalation.cfg like for example last_notificationz when I launch the command service nagios restart i have an error message, so it read the cfg file. BUT if I put a wrong number like for example last_notification 3z when I launch the command service nagios restart all seems to work fine, no error displayed