Results 1 to 4 of 4

Thread: 2 configurations, same contact_groups, different results

  1. #1

    2 configurations, same contact_groups, different results

    Hello,
    I'm trying to figure out shinken and notifications.

    Here's what I did so far.
    I defined myself as a contact and defined a contactgroup with admin and myself in it.

    In locahost.cfg I put that group as contact. In another config I did the same.

    With localhost.cfg, the notifications got sent only to admin, with the other config it went to both of us. I have no idea what's going on.

    [root@nagios shinken]# cat local-config/test.cfg
    define host{
    use dns,generic-host
    host_name test
    address 111.111.111.111
    check_command check_tcp!53
    contact_groups admins-montreal
    }


    [root@nagios shinken]# cat hosts/localhost.cfg
    define host{
    use linux-ssh,generic-host
    host_name localhost
    address localhost
    contact_groups admins-montreal
    }

    test N/A HOST DOWN 10:20:23 admin notify-host-by-email CRITICAL - Socket timeout after 10 seconds
    test N/A HOST DOWN 10:20:23 pierreg notify-host-by-email CRITICAL - Socket timeout after 10 seconds


    localhost NtpSync CRITICAL 10:25:10 admin notify-service-by-email Error: ntpq: read: Connection refused

    In the first case, the entire server was down, in the second, just 1 of the services. Could that be the reason?

    Thanks for your help.

  2. #2
    I tried a few more things and it seems to be related to the difference between host notification and service notification.

    I restarted shinken, let it flag the DNS error and only admin got notification. Then I unplugged the network cable and got a notification about the same host being down.

    The 2 scripts are the default ones, I only changed the path from /usr/bin/mail to /bin/mail.
    When I try the command_line at the prompt with my email address, I get the message in both cases so I'm pretty sure that's correct. If there was a typo in there, I'd still see the system trying to notify me in the logs but I wouldn't get the email but that's not the case, the notification just doesn't happen.

    I haven't changed generic-contact, it still looks like this:
    # cat generic-contact.cfg
    # Contact definition
    # By default the contact will ask notification by mails
    define contact{
    name generic-contact
    register 0
    host_notifications_enabled 1
    service_notifications_enabled 1
    email shinken@localhost
    can_submit_commands 1
    notificationways email
    }

    So host notification and service notifications are on.

    In the generic-host and generic services it's defaults files too and it seems to make sense:

    notification_options d,u,r,f
    notifications_enabled 1


    notifications_enabled 1 ; Service notifications are enabled
    notification_options w,u,c,r ; Send notifications about warning, unknown, critical, and recovery events

    I don't understand what's going on.
    Any tip?

  3. #3
    I did some more testing. I have my host file that looks like this:

    define host{
    use https,linux-ssh,generic-host
    contact_groups admins2
    host_name boltzmann.gerad.lan
    address boltzmann.gerad.lan
    }

    and my group that looks like this:

    # cat admins2.cfg
    define contactgroup{
    contactgroup_name admins2
    alias admins2
    members pierreg
    }

    When notifications errors occur, they get sent to admins when the should get sent to admins2, i.e. pierreg.

    admins looks like this:
    # cat admins.cfg
    define contactgroup{
    contactgroup_name admins
    alias admins
    members admin
    }

    If I add myself to that contactgroup, I get all the notifications but they should'nt be sent to admin, I asked them to be sent to admins2 in the host.

    The other thing is if I just remove the admins.cfg file, then the notifications get sent to admins2.

    In the notifications, it looks like this:

    # last test after removing admins.cfg
    boltzmann.gerad.lan CPU Stats CRITICAL 11:01:33 pierreg notify-service-by-email Error : connexion failed 'Authentication failed.'

    # test with myself added to admins.cfg
    boltzmann.gerad.lan CPU Stats CRITICAL 10:57:54 admin notify-service-by-email Error : connexion failed 'Authentication failed.'
    boltzmann.gerad.lan CPU Stats CRITICAL 10:57:54 pierreg notify-service-by-email Error : connexion failed 'Authentication failed.'

    # test with original admins.cfg
    boltzmann.gerad.lan CPU Stats CRITICAL 10:51:10 admin notify-service-by-email Error : connexion failed 'Authentication failed.'

  4. #4
    Someone told me to comment out contact_group in generic-service.cfg.

    I think I might understand what's going on. When I define a host, I use generic_host and overwrite the contact. However, the host imports services which inherit values from the template and not the host and that causes the behavior of receiving some notifications but not all. By commenting it out in the template, it gets the value from the host instead and it works.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •