sni / mod_gearman

Distribute Naemon Host/Service Checks & Eventhandler with Gearman Queues. Host/Servicegroups affinity included.
http://www.mod-gearman.org
GNU General Public License v3.0
122 stars 42 forks source link

CONTACT macros not resolved #119

Closed adrianlzt closed 7 years ago

adrianlzt commented 7 years ago

When mod_gearman_neb is loaded in Icinga, macros CONTACT* are not resolved.

Enabling debug for macros in Icinga show this:

  [1499259440.112507] [2048.2] [pid=58492]   Processing part: 'CONTACTEMAIL'
  [1499259440.112510] [2048.2] [pid=58492]   macros[22] (CONTACTEMAIL) match.
  [1499259440.112512] [2048.2] [pid=58492]   Processed 'CONTACTEMAIL', Clean Options: 0, Free: 1, Value: ''
  [1499259440.112515] [2048.2] [pid=58492]  Warning: Error grabbing macro 'CONTACTEMAIL' value ''! Maybe used in the wrong scope? Check the docs.

Same configuration without the mod_gearman_neb module works correctly.

Versions: Icinga 1.11.6 mod_gearman-3.0.4-1.el6.x86_64 gearmand-0.33-2.x86_64 gearmand-server-0.33-2.x86_64

adrianlzt commented 7 years ago

Same with Icinga 1.14.0

adrianlzt commented 7 years ago

In the docs is said:

Mod-Gearman does not support environment macros, except two plugin output related ones.

But I see that the rest of the MACROS needed to form the notification command are correctly processed.

Our notificacion command for services:

/usr/bin/printf "%b" "***** Icinga Notification *****\n\nType: $NOTIFICATIONTYPE$\nService: $SERVICEDESC$\nHost: $HOSTNAME$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\nDate/Time: $LONGDATETIME$\nUrl: https://$USER6$/check_mk/index.py?start_url=%2Fcheck_mk%2Fview.py%3Fview_name%3Dhost%26site%3D%26host%3D$HOSTNAME$\nInfo:$SERVICEOUTPUT$\n\n" | /bin/mail -S from="Icinga" -s "$USER5$ $NOTIFICATIONTYPE$ Service Alert: $HOSTNAME$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
adrianlzt commented 7 years ago

I have been debugging Icinga and see that mac object passed to process_macros_r doesn't have the pointer mac.contact_ptr initialized.

Maybe is missing a call to grab_contact_macros_r in https://github.com/sni/mod_gearman/blob/master/neb_module/mod_gearman.c#L657

I'm trying to debug the neb module but I'm not very experienced with gdb and keep getting errors like value has been optimized out and can't compute CFA for this frame.

sni commented 7 years ago

i will have look