ISync Rule Preview SQL syntax error

Hi!

Target: I would like to manage the user notification methods (email and/or sms, host and/or service) through AD group membership.

If the user is a member “Icinga-Notification-IT-host-SMS” group, he will get an SMS if the specific host is DOWN.

But If not member a “Icinga-Notification-IT-service-SMS” group, he will not get an SMS if the specific service is unreachable/down.

I created an “Import source” what get cn and memberof attributes from Microsoft AD.
For this import I set 2 “Modifiers”.

  1. To get Icinga groups full DN from AD if user is member of the specific AD group
    Property: memberOf
    Target property: Icinga-groups
    Modifier: Filter Array Values
    Filter method: Regular Expression
    Filter:
    Policy: Keep matching elements
    When empty: return an empty array

  2. Cut Icinga Group full DN to display name. Example: CN=icinga-group1,DC=domain,DC=hu → icinga-group1
    Property: Icinga-groups
    Target property: Icinga-Group-CN
    Modifier: Regular expression based replacement
    Regex pattern:
    Replacement: $1
    When not matched: Keep the given string

These modifiers are working perfectly cause the Preview is show for me.
The Icinga-Group-CN column is contain the corresponding value(s).

And I created a “Sync rule” for this Import source.
Object tpye: User
Update Policy: Merge
Purge: No
Properties:
a. Source Column: cn; Destination Field: display_name
b. Source Column: Icinga-Group-CN; Destination Field: Group membership (this indicates “groups” for the Destination)

If I run “Check for changes” it displays that 1 item will be modified.
So at this moment the director should see that 1 parameter will change.
But!
When I press the “Preview” get the following error message:

string(499) “SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘groups, set_null) VALUES (0x125d67fdd0dc4dc4bb2ceca900000003, 0x2a5fac64468c47f1’ at line 1, query was: INSERT INTO branched_icinga_user (uuid, branch_uuid, branch_deleted, branch_created, email, groups, set_null) VALUES (0x125d67fdd0dc4dc4bb2ceca900000003, 0x2a5fac64468c47f191af4127a54f3332, ?, ?, ?, ?, ?)” array(7) { [“uuid”]=> object(Zend_Db_Expr)#204 (1) { [“_expression”:protected]=> string(34) “0x125d67fdd0dc4dc4bb2ceca900000003” } [“branch_uuid”]=> object(Zend_Db_Expr)#209 (1) { [“_expression”:protected]=> string(34) “0x2a5fac64468c47f191af4127a54f3332” } [“branch_deleted”]=> string(1) “n” [“branch_created”]=> string(1) “n” [“email”]=> string(21) “username@domain.com” [“groups”]=> string(70) “[“Icinga-Notification-IT-host-SMS”,“Icinga-Notification-IT-host-mail”]” [“set_null”]=> NULL }

I think that in SQL terminology the “groups” is a reservated keyword.
Maybe I must set some escape character for “groups” word.

How could i resolve it?
Can I ask some advise from you?

Director version: 1.11.9
Icinga Web 2 Version: 2.14.0
PHP Version: 8.3.31
icinga2 - The Icinga 2 network monitoring daemon (version: r2.16.1-1)

Thanks

The above is showing an issue with the quotes used within the value being assigned to the field “groups”.
I don’t think the issue is with the name of the column (only “group” is a reserved keyword). I believe the issue is related to the escaping of the quotes when assigning the value to the field.

The table name “branched_icinga_user” hints this is an issue within the branching add-on of Icinga Director. I would go search for help in that direction. Or disable that add-on.

My two cents,

Jean