Results 1 to 4 of 4

Thread: Why I received 2 emails when sms & email notifications enabled ?

  1. #1
    Junior Member
    Join Date
    Jun 2013
    Posts
    3

    Why I received 2 emails when sms & email notifications enabled ?

    Hi community,
    I used Shinken (1.2 updated 1.4) few months ago for test and i begin to create production version to manage my servers park.
    My problem :
    I enabled notification by SMS (with gammu through gsm usb port). It works fine.
    But when I put in same time sms and email notifications I received at each alert 2 emails and only one SMS. So when I disabled sms notification I received only one email at each alert.
    Here my configuration :

    in contacts.cfg :

    Code:
    define contact{
      use       generic-contact,sms-contact
      contact_name    mon nom
      alias        mEGa
      email        my@email 
      is_admin      1
      can_submit_commands 1
      pager        06xxxxxxxx
    }
    in templates.cfg :

    Code:
    define contact{
        name              generic-contact    
        register            0          
        host_notifications_enabled   1
        service_notifications_enabled  1
        email              shinken@localhost
        can_submit_commands       1
        notificationways        email
        }
    
    define contact{
        name              sms-contact    
        register            0        
        host_notifications_enabled   1
        service_notifications_enabled  1
        email              shinken@localhost
        pager              06xxxxxxxx
        service_notification_period   24x7
        host_notification_period    24x7
        service_notification_options  c,w,r
        host_notification_options    d,u,r,f,s
        service_notification_commands  notify-service-by-sms
    }
    
    define notificationway{
        notificationway_name      email
        service_notification_period   24x7
        host_notification_period    24x7
        service_notification_options  c,w,r
        host_notification_options    d,u,r,f,s
        service_notification_commands  notify-service-by-email
        host_notification_commands   notify-host-by-email
    }
    In commands.cfg

    Code:
    ## Notify Host by Email
    define command {
      command_name  notify-host-by-email
      command_line  /usr/bin/printf "%b" "Shinken Notification\n\nType:$NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\nDate/Time: $DATE$\n" | /usr/bin/mail -s "Host $HOSTSTATE$ alert for $HOSTNAME$!" $CONTACTEMAIL$
    }
    # mEGa commande notification par sms via gammu
    define command{
    command_name  notify-host-by-sms
    command_line  /usr/bin/printf "%b" "Alerte Shinken\nType de notification: $NOTIFICATIONTYPE$\n$HOSTNAME$ est $HOSTSTATE$\nDate: $DATE$ - $TIME$" | /usr/bin/gammu --config /home/shinken/.gammurc --sendsms TEXT $CONTACTPAGER$
    }
    define command{
    command_name  notify-service-by-sms
    command_line  /usr/bin/printf "%b" "Alerte Shinken\nType de notification: $NOTIFICATIONTYPE$\nService $SERVICEDESC$ sur $HOSTNAME$ est $SERVICESTATE$\nDate: $DATE$ - $TIME$" | /usr/bin/gammu --config /home/shinken/.gammurc --sendsms TEXT $CONTACTPAGER$
    }
    In schedulerd.log I noticed only one sending action : one email and one sms...

    note I tried to use notificationways method without success (no sms sent)

    Any idea ? Many thanks per advance

  2. #2
    Shinken project leader
    Join Date
    May 2011
    Location
    Bordeaux (France)
    Posts
    2,131

    Re: Why I received 2 emails when sms & email notifications enabled ?

    You can try by putting the "generic" template at the end of the contact, such generic template should be called in last order, not first.
    No direct support by personal message. Please open a thread so everyone can see the solution

  3. #3
    Junior Member
    Join Date
    Jun 2013
    Posts
    3

    Re: Why I received 2 emails when sms & email notifications enabled ?

    Thank you Naparuba for your response.

    I test this configuration :
    in contacts.cfg
    Code:
    define contact{
      use       generic-contact
      contact_name    my name
      alias        mEGa
      email        my@email
      pager       06xxxxxxxx
      is_admin      1
      can_submit_commands 1
     host_notifications_enabled   1
     service_notifications_enabled  1
     service_notification_period   24x7
     host_notification_period    24x7
     service_notification_options  c,w,r
     host_notification_options    d,u,r,f,s
     service_notification_commands  notify-service-by-sms
     host_notification_commands   notify-host-by-sms
    and no change in other config files as my previous post

    No success at this time. Do I correctly apply your suggestion ?

  4. #4
    Shinken project leader
    Join Date
    May 2011
    Location
    Bordeaux (France)
    Posts
    2,131

    Re: Why I received 2 emails when sms & email notifications enabled ?

    So with it, and no notification ways in the generic, you still got double notifications?
    No direct support by personal message. Please open a thread so everyone can see the solution

Posting Permissions

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