Hi all,

This has been a problem as Icinga can not set the address for the recipient
of the alert correctly. Icinga keeps giving
$@mynet.net instead of the correct value of the macro CONTACTEMAIL (in my
case tech...@mynet.net)

[root@it01 ~]# rpm -qa |grep icinga
icinga-doc-1.7.2-1.el6.x86_64
icinga-web-1.7.2-1.el6.noarch
icinga-gui-1.7.2-1.el6.x86_64
icinga-web-module-pnp-1.7.2-1.el6.noarch
icinga-idoutils-libdbi-mysql-1.7.2-1.el6.x86_64
icinga-1.7.2-1.el6.x86_64


Here is definition for a service:

define service {
  name                            check_mk_default
  register                        0
  active_checks_enabled           1
  passive_checks_enabled          1
  parallelize_check               1
  obsess_over_service             1
  check_freshness                 0
  notifications_enabled           1
  event_handler_enabled           0
  flap_detection_enabled          1
  failure_prediction_enabled      1
  process_perf_data               0
  retain_status_information       1
  retain_nonstatus_information    1
  notification_interval           0
  is_volatile                     0
  normal_check_interval           1
  retry_check_interval            1
  max_check_attempts              1
  notification_options            u,c,w,r,f
  notification_period             24X7
  check_period                    24X7
}

define service {
  name                            check_mk_perf
  register                        0
  process_perf_data               1
  action_url
 /pnp4nagios/index.php/graph?host=$HOSTNAME$&srv=$SERVICEDESC$'
class='tips'
rel='/pnp4nagios/index.php/popup?host=$HOSTNAME$&srv=$SERVICEDESC$
}


define service {
  name                            check_mk_passive_perf
  use                             check_mk_perf,check_mk_default
  register                        0
  active_checks_enabled           0
}

define command{
        command_name    notify-service-by-email
        command_line    /usr/bin/printf "%b" "***** Icinga
*****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService:
$SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState:
$SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional
Info:\n\n$SERVICEOUTPUT$\n" | /bin/mail -r ici...@mynet.net -s "**
$NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is
$SERVICESTATE$ **" $CONTACTEMAIL$
        }

define contact{
        name                            generic-contact         ; The name
of this contact template
        service_notification_period     24x7                    ; service
notifications can be sent anytime
        host_notification_period        24x7                    ; host
notifications can be sent anytime
        service_notification_options    w,u,c,r,f,s             ; send
notifications for all service states, flapping events, and scheduled
downtime events
        host_notification_options       d,u,r,f,s               ; send
notifications for all host states, flapping events, and scheduled downtime
events
        service_notification_commands   notify-service-by-email ; send
service notifications via email
        host_notification_commands      notify-host-by-email    ; send host
notifications via email
        register                        0                       ; DONT
REGISTER THIS DEFINITION - ITS NOT A REAL CONTACT, JUST A TEMPLATE!
        }

define contact{
        contact_name                    techops
        use                             generic-contact
        alias                           Tech Ops
        email                           tech...@mynet.com
        host_notifications_enabled      1
        service_notifications_enabled   1
}

define contactgroup{
         contactgroup_name      techops
         alias                  Tech Ops
         members                techops
        }


define service {
  use                           check_mk_passive_perf
  host_name                     it01
  service_description           CPU load
  notification_interval         0
  notifications_enabled         1
  event_handler                 notify-service-by-email
  contact_groups                techops
  event_handler_enabled         1
  check_interval                2
  max_check_attempts            3
  check_command                 check_mk-cpu.loads
}

Here are some info on my smtp postfix server. I really have to map $@
mynet.net to myn...@mynet.net.


/etc/postfix/generic
$@mynet.net myn...@mynet.net


Aug 29 16:28:08 it01 postfix/pickup[8773]: D1A062AD: uid=497 from=<
ici...@mynet.net>
.....
Aug 29 16:28:09 it01 postfix/smtp[13501]: > smtp.xxxx.com[a.b.c.d]:587:
MAIL FROM:<ici...@mynet.net> AUTH=<>
Aug 29 16:28:09 it01 postfix/smtp[13501]: maps_find: smtp_generic_maps:
hash:/etc/postfix/generic(0,lock|fold_fix): $@mynet.net = myn...@mynet.net
Aug 29 16:28:09 it01 postfix/smtp[13501]: mail_addr_find: $@mynet.net ->
myn...@mynet.net
.....
Aug 29 16:28:09 it01 postfix/smtp[13501]: mail_addr_map: $@mynet.net -> 0:
myn...@mynet.net
Aug 29 16:28:09 it01 postfix/smtp[13501]: smtp_map11_external: $@mynet.net->
myn...@mynet.net
...
Aug 29 16:28:09 it01 postfix/smtp[13501]: < smtp.xxxx.com[a.b.c.d]:587: 250
OK
Aug 29 16:28:09 it01 postfix/smtp[13501]: > smtp.xxxx.com[a.b.c.d]:587:
RCPT TO:<myn...@mynet.net>
...
Aug 29 16:28:11 it01 postfix/smtp[13502]: F04FE289:* to=<$@mynet.net>,
orig_to=<$>, r*elay=smtp.xxxx.com[a.b.c.d]:587, delay=2.3,
delays=0.23/0.01/0.49/1.6, dsn=2.0.0, status=sent (250 Message
0M1m9C-1Tuqyq2XxC-00thsZ accepted by m1.justme.meme)


Could you please help me with this issue?

Thanks,
Steven.
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
icinga-users mailing list
icinga-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/icinga-users

Reply via email to