Hi Tilo,

quite some questions at once :D

* scenario 2: the description field for the key column name says "This
must be a column containing unique values like hostnames. Unless
otherwise specified this will then be used as the object_name for the
synchronized Icinga object. Especially when getting started with
director please make sure to strictly follow this rule. Duplicate values
for this column on different rows will trigger a failure, your import
run will not succeed"

So, importing hosts should run fine, just make sure that you choose the
field that will become your identifier (object_name) as a key column.

* hasServiceSet -> this was a bug, I pushed a fix - please try again

* sync for single services on specific hosts works fine, everything else
used to be not supported - and still is. However, as some people
insisted doing so (and managed it to do so), we removed parts of the
code that blocked you when trying.

* when synchronizing templates the object_name should be your key

* synchronizing apply rules is VERY tricky, us you cannot work with a
unique name - Icinga allows for many rules with the very same name
unless they do not collide once realized.

I guess even apply rules COULD work with some hack based on custom vars,
but unless you have an immediate need for doing so I'd strongly advise
against even trying.

Best practice is to define apply rules in the Director, sync hosts with
custom properties useful for your apply (or "apply for") rules and
additionally also sync some single services in case your data source
provides such detailed information.

As soon as your sync has a host and an object_name property for your
services it would internally switch to using those as a combined key and
succeed. The setup I'm currently working with does so with next to
10,000 single services (plus more than 60,000 generated as apply rules),
so I guess it should work ;-)

Cheers,
Thomas

Am 13.12.2016 um 13:46 schrieb tilo....@googlemail.com:
> Hello,
>
> i want to sync services via Director.
>
> 1. scenario: assign-filter
> The importsource delivers the "import template name" and the
> "assign-filter"
>
> 2. scenario: hostname
> The importsource delivers the "import template name" and the "hostname"
>
> Neither 1 nor 2 i'm able to create
>
>
> 1. scenario
> ===========
> Importsource
> -------------
> a file (fileshipper)  or databasetable (mysql) with:
>
>    id; service_template; assign_where
>    1; check_1_template; host.vars.os==Windows
>
> Key column name: id
>
> sync rule
> ---------
> properties Source field -> Destination:
> ${service_template} -> import
> ${assign_where}     -> assign_filter
> apply               -> object_type
>
> On sync I get:
> Undefined variable: hasServiceSet
>
> Even if i introduce an "object_name" i got this error.
>
>
> 2. scenario
> ===========
> Importsource
> ------------
> a file (fileshipper)  or databasetable (mysql) with:
>   id; service; service_template; host_name
>   1; d1; check_2_template; hostA
>   2; d1; check_2_template; hostB
>
> Key column name: id
>
> sync rule
> ----------
> ${service}         ->object_name
> {service_template} -> import
> {host_name}        -> host
>
> on first sync i got as expected:
>
> object Service "d1" {
>    host_name = "hostA"
>    import "check_2_template"
> }
> object Service "d1" {
>    host_name = "hostB"
>    import "check_2_template"
> }
>
> on second sync i got
>
> "Exception while syncing Icinga\Module\Director\IcingaService d1:
> Storing icinga_service[] failed: SQLSTATE[23000]: Integrity constraints
> violadtion: 1062 Duplicate entry 'd1-1' for key 'object_key'..."
>
> But the database icinga_servcei is showing no "d1-1":
> select id,object_name, oibject_type from icinga_service;
> 11 d1 object
> 12 d1 object
>
>
> How do I import services via Director?
>
> Regards
> Tilo Mey
> _______________________________________________
> icinga-users mailing list
> icinga-users@lists.icinga.org
> https://lists.icinga.org/mailman/listinfo/icinga-users

-- 
Thomas Gelf
Principal Consultant

NETWAYS GmbH | Deutschherrnstr. 15-19 | D-90429 Nuernberg
Tel: +49 911 92885-0 | Fax: +49 911 92885-77
CEO: Julian Hein, Bernd Erk | AG Nuernberg HRB18461
http://www.netways.de | thomas.g...@netways.de

** OSDC 2017 - Mai – osdc.de **
_______________________________________________
icinga-users mailing list
icinga-users@lists.icinga.org
https://lists.icinga.org/mailman/listinfo/icinga-users

Reply via email to