LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   nagios don't send mail for individual hosts (https://www.linuxquestions.org/questions/linux-newbie-8/nagios-dont-send-mail-for-individual-hosts-811940/)

knockout_artist 06-03-2010 10:10 AM

nagios don't send mail for individual hosts
 
Hi,

It does not send mail if I only add contact_groups in host definition.
Code:


define host{
        use            generic-host        ; Inherit default values from a template
        host_name      NAME1          ; The name we're giving to this switch
        address        XX.X.X.X    ; IP address of the switch
        hostgroups      GROP1                ; Host groups this switch is associated with
        contact_groups    wadmins
        }

But If in same host-config file I add contact_groups in service definition it works.

Code:

define service{
        use                    generic-service ; Inherit values from a template
        host_name              NAME1  ; The name of the host the service is associated with
        service_description    PING            ; The service description
        check_command          check_ping!200.0,20%!600.0,60%  ; The command used to monitor the service
        normal_check_interval  5              ; Check the service every 5 minutes under normal conditions
        retry_check_interval    1              ; Re-check the service every minute until its final/hard state is determined
       
 contact_groups    wadmins

}


Any ideas ?

never say never 06-03-2010 01:40 PM

You need to add these options in your hosts definitions (and services):

Code:

        notification_interval          30
        notification_period            24x7
        notification_options            w,u,c,r

Where notification_interval is in minutes; notification_period is defined timeperiod; and notification_options are a comma separated list containing: w,u,c,r (w = Warning, u = Undefined, c = Critical, r = Recovery)

A timeperiod is defined like this:

Code:

# '24x7' timeperiod definition
define timeperiod{
        timeperiod_name 24x7
        alias          24 Hours A Day, 7 Days A Week
        sunday          00:00-24:00
        monday          00:00-24:00
        tuesday        00:00-24:00
        wednesday      00:00-24:00
        thursday        00:00-24:00
        friday          00:00-24:00
        saturday        00:00-24:00
        }

And you will only receive notifications within those time periods.

Hope this helps.

knockout_artist 06-07-2010 12:14 PM

Thanks for your reply, but options you gave are only about when and who to contact.

Should it not send an email regardless, from host definition structure?

Because it does send email once I put it in service structure.

never say never 06-07-2010 12:28 PM

Well there may be a place to set a default value somewhere, but I have always set it for each host and service. I have over 100 hosts and over 500 services monitored by Nagios and I have something like 10 groups. Some get e-mails 24x7, some don't care if the copier goes down at 3 AM. I have never had a problem.

If you don't define
Code:

notification_interval  120
        notification_period    24x7
        notification_options    d,u,r

How is it to know who to contact and how often if you don't' tell it?


All times are GMT -5. The time now is 07:19 PM.