1<a id="Import-and-Sync"></a>Import and Synchronization
2======================================================
3
4Icinga Director offers very powerful mechanisms when it comes to fetching data
5from external data sources.
6
7The following examples should give you a quick idea of what you might want to
8use this feature for. Please note that Import Data Sources are implemented as
9hooks in Director. This means that it is absolutely possible and probably very
10easy to create custom data sources for whatever kind of data you have. And you
11do not need to modify the Director source code for this, you can ship your very
12own importer in your very own Icinga Web 2 module.
13
14Examples
15--------
16
17### Import Servers from MS Active Directory
18
19#### Create a new import source
20
21Importing data from LDAP sources is pretty easy. We use MS Active Directory
22as an example source:
23
24![Import source](screenshot/director/08_import-and-sync/081_director_import_source.png)
25
26You must formerly have configured a corresponding LDAP resource in your Icinga Web.
27Then you choose your preferred object class, you might add custom filters, a search
28base should always be set.
29
30The only tricky part here are the chosen Properties. You must know them and you
31are required to fill them in, no way around this right now. Also please choose one
32column as your key column.
33
34In case you want to avoid trouble please make this the column that corresponds to
35your desired object name for the objects you are going to import. Rows duplicating
36this property will be considered erroneous, the Import would fail.
37
38#### Property modifiers
39
40Data sources like SQL databases provide very powerful modifiers themselves. With a
41handcrafted query you can solve lots of data conversion problems. Sometimes this is
42not possible, and some sources (like LDAP) do not even have such features.
43
44This is where property modifiers jump in to the rescue. Your computer names are
45uppercase and you hate this? Use the lowercase modifier:
46
47![Lowercase modifier](screenshot/director/08_import-and-sync/082_director_import_modifier_lowercase.png)
48
49You want to have the object SID as a custom variable, but the data is stored
50binary in your AD? There is a dedicated modifier:
51
52![SID modifier](screenshot/director/08_import-and-sync/083_director_import_modifier_sid.png)
53
54You do not agree with the way Microsoft represents its version numbers? Regular
55expressions are able to fix everything:
56
57![Regular expression modifier](screenshot/director/08_import-and-sync/084_director_import_modifier_regex.png)
58
59#### Preview
60
61A quick look at the preview confirms that we reached a good point, that's the data
62we want:
63
64![Import preview](screenshot/director/08_import-and-sync/085_director_import_preview.png)
65
66#### Synchronization
67
68The Import itself just fetches raw data, it does not yet try to modify any of your
69Icinga objects. That's what the Sync rules have been designed for. This distinction
70has a lot of advantages when it goes to automatic scheduling for various import and
71sync jobs.
72
73When creating a Synchronization rule, you must decide which Icinga objects you want
74to work with. You could decide to use the same import source in various rules with
75different filters and properties.
76
77![Synchronization rule](screenshot/director/08_import-and-sync/086_director_sync_rule_ad_hosts.png)
78
79For every property you must decide whether and how it should be synchronized. You
80can also define custom expressions, combine multiple source fields, set custom
81properties based on custom conditions and so on.
82
83![Synchronization properties](screenshot/director/08_import-and-sync/087_director_sync_properties_ad_host.png)
84
85Now you are all done and ready to a) launch the Import and b) trigger your synchronization
86run.
87
88
89