ImportSource--SyncRule--ServiceApply - sync run will create additional ServiceApply object, but not update it


I do have a situation:

ImportSource from sql, which works properly:

import source name: ImportSource1
description: test
source type: sql
key column name: urlid
resource: db1

DB query:

SELECT id AS urlid,url,created FROM url WHERE xxx ORDER BY created ASC LIMIT 1;


| --- | --- | --- |
|15467|1999-08-03 12:00:00||

at this point need to mention, that I tried modifier to “[urlid: Cast a string value to an Integer]”

SyncRule is as follows:

Name: test6
Desc: test
Object type: Service
Update: Replace (tried all of them)
Purge: Yes (but as per documentation, it will work only, if host is determined)
Filter: empty


importsource1, check_curl, check_command
importsource1, apply, object_type
importsource1, ${urlid}, vars.object_sid

After I [Check for changes] on SyncRule, I get:

    [create] => 1
    [modify] => 0
    [delete] => 0

Yes, it is defenitely I want for first time. But when I click for the next [Check for changes], I get exactly the same result. So, more additional identical “Service Apply” will be created, what I do not want.

Firstly, I though there is some issue with Key_Column on ImportSource, tried not to use common naming “id”, renamed SQL output to “urlid”, tried to transform to Integer (as per some posts online).

If there are limitations or my misunderstanding, could somebody experienced on syncrule could direct me, please.

As outcome of syncrules, I have 150 checks against 100 hosts, which need to be refreshed every hour. I can not click with such speed to delete objects, and if icingacli would be capable to do it, I could cron to remove as follows:

icingacli director serviceapply delete *test*

but unfortunately it is not doable. please, correct me , if I am mistaken.

I did tried to create Service objects and add them to ServiceSet, because serviceset object can be deleted from CLI and cron’ed to clean unnecessary checks.

Any workarounds ?

Many thanks in advance.


Icinga Web 2 Version 2.9.5
Director version (System - About): 1.8.0
Icinga 2 version (icinga2 --version): 2.13.2-1
Operating System and version: RHEL 8.6
Webserver, PHP versions: Server version: Apache/2.4.37 (Red Hat Enterprise Linux)
PHP Version 7.2.24