iTop系统集成-数据同步参考-同步联系人信息
同步联系人信息在此方法中,将从CSV文件(可能是LDAP提取或任何其他来源)中提取的个人详细信息与iTop同步。名称:如何从LDAP动态人员类型:如何听众:管理员, 集成, 开发者 水平:中间持续时间:1h关键词:数据同步, 集成 iTop版本:2.2.0状态:例先决条件您将需要:[*]知道如何从LDAP服务器中提取有关某人的信息并将此信息保存到.CSV文件中
[*]拥有一个iTop系统(已安装演示数据),并可以访问管理员账号
[*]知道如何使用命令行连接到iTop Web服务器
该教程的目的在此教程中,您将学习如何:
[*]创建并配置同步数据源,以将一类对象同步到iTop中
[*]将外部数据馈入同步并将动态馈入此同步数据源
[*]了解同步状况报告
https://www.itophub.io/wiki/media?w=400&tok=584479&media=2_7_0%3Aadvancedtopics%3Adata-synchro-how-to-persons.png分步说明初始配置在这里,您将创建同步数据源。在管理工具菜单中,单击同步数据源。https://www.itophub.io/wiki/media?media=2_7_0%3Aadvancedtopics%3A1._synch_data_sources.png单击“创建新的同步数据源”。https://www.itophub.io/wiki/media?media=2_7_0%3Aadvancedtopics%3A2._create_a_new_synchro_data_source.png在以下屏幕中,在适当的字段中输入名称(来自LDAP的人员),目标类别(人员)和用户(管理员)。https://www.itophub.io/wiki/media?media=2_7_0%3Aadvancedtopics%3A3._create_a_new_synchro_data_source_fillb.png单击创建按钮以创建数据源。https://www.itophub.io/wiki/media?media=2_7_0%3Aadvancedtopics%3A4._data_source_createdb.png创建数据源后,单击右上角的“修改”并编辑“属性”选项卡,如下所示:https://www.itophub.io/wiki/media?media=2_7_0%3Aadvancedtopics%3A5._attributesb.png在浏览器的URL中,记下同步数据源对象的标识符。 (显示对象时在URL中查找&id = xxx)。第一次同步:初始负载然后在iTop根目录下的目录“数据”中创建文本文件“ persons.csv”,其内容如下:[ ttps://www.itophub.io/wiki/page?do=export_code&id=2_7_0%3Aadvancedtopics%3Asynchro_howto_personsfromldap&codeblock=0]persons.csv primary_key;name;first_name;org_id;email;status;function;phone;notify1;Monet;Claude;Demo;claude.monet@demo.com;Active;Manager;+33123456789;Yes2;Flaubert;Gustave;IT Department;gustave.flaubert@demo.com;Active;;+33987654321;No在iTop根目录的命令行中,启动以下命令:chro_import.php --auth_user=admin --auth_pwd=admin --csvfile=./data/persons.csv --data_source_id=1 --output=summary调整参数:
[*]auth_user:您的iTop登录名
[*]auth_pwd:您的iTop密码
[*]data_source_id:上面创建的同步数据源的标识符
预期的输出:#Load--------------#------------------#Data Source: 1#Synchronize: 1#Class: Person#Separator: ;#Qualifier: "#Charset Encoding:UTF-8#Date format: <none>#Data Size: 228#Data Lines: 2#Columns: primary_key, name, first_name, org_id, email, status, function, phone, notify#Output format: summary#Simulate: 0#Change tracking comment: #Issues (before synchro): 0#Created (before synchro): 2#Updated (before synchro): 0#Synchronization---#------------------#Replicas: 2#Replicas touched since last synchro: 2#Objects deleted: 0#Objects deletion errors: 0#Objects obsoleted: 0#Objects obsolescence errors: 0#Objects created: 0 (0 warnings)#Objects creation errors: 0#Objects updated: 0 (0 warnings)#Objects update errors: 0#Objects reconciled (updated): 2 (0 warnings)#Objects reconciled (unchanged): 0 (0 warnings)#Objects reconciliation errors: 0#Replica disappeared, no action taken: 0检查同步数据源的状况(如果需要,请按“刷新”图标)https://www.itophub.io/wiki/media?w=500&tok=8c5200&media=2_7_0%3Aadvancedtopics%3Asynchro-data-source-howto3.png您会看到2个人已更新。导航到联系人“ Claude Monet”的详细信息,您可以看到此对象现在已同步:https://www.itophub.io/wiki/media?w=500&tok=0fb12e&media=2_7_0%3Aadvancedtopics%3Asynchro-data-source-howto4.png查看“历史记录”标签,了解最近的更改:https://www.itophub.io/wiki/media?w=500&tok=6a07c2&media=2_7_0%3Aadvancedtopics%3Asynchro-data-source-howto6.png
如果尝试修改Person,则可以看到其大多数属性已锁定:https://www.itophub.io/wiki/media?w=500&tok=6da5b2&media=2_7_0%3Aadvancedtopics%3Asynchro-data-source-howto5.png第二次同步:更新联系人将文件“ persons.csv”修改为变更,将Claude Monet的职能从“经理”修改为“著名画家”。在iTop根目录下的目录数据中修改文本文件“ persons.csv”,内容如下:[ ttps://www.itophub.io/wiki/page?do=export_code&id=2_7_0%3Aadvancedtopics%3Asynchro_howto_personsfromldap&codeblock=3]persons.csv primary_key;name;first_name;org_id;email;status;function;phone;notify1;Monet;Claude;Demo;claude.monet@demo.com;Active;Famous painter;+33123456789;Yes2;Flaubert;Gustave;IT Department;gustave.flaubert@demo.com;Active;;+33987654321;No使用相同的命令启动导入并再次同步:php synchro/synchro_import.php --auth_user=admin --auth_pwd=admin --csvfile=./data/persons.csv --data_source_id=1 --output=summary输出如下:#Load--------------#------------------#Data Source: 1#Synchronize: 1#Class: Person#Separator: ;#Qualifier: "#Charset Encoding:UTF-8#Date format: <none>#Data Size: 235#Data Lines: 2#Columns: primary_key, name, first_name, org_id, email, status, function, phone, notify#Output format: summary#Simulate: 0#Change tracking comment: #Issues (before synchro): 0#Created (before synchro): 0#Updated (before synchro): 2#Synchronization---#------------------#Replicas: 2#Replicas touched since last synchro: 2#Objects deleted: 0#Objects deletion errors: 0#Objects obsoleted: 0#Objects obsolescence errors: 0#Objects created: 0 (0 warnings)#Objects creation errors: 0#Objects updated: 1 (0 warnings)#Objects update errors: 0#Objects reconciled (updated): 0 (0 warnings)#Objects reconciled (unchanged): 0 (0 warnings)#Objects reconciliation errors: 0#Replica disappeared, no action taken: 0同步的输出指出仅更新了1个对象。也可以在同步数据的状况选项卡上查看来源:然后导航至“ Claude Monet”人员的详细信息:https://www.itophub.io/wiki/media?w=500&tok=75e334&media=2_7_0%3Aadvancedtopics%3Asynchro-data-source-howto5_famous_painter.png第三次同步:创建一个新的联系人接下来,通过在末尾添加一行来修改iTop根目录下数据目录中的文本文件“ persons.csv”:[ ttps://www.itophub.io/wiki/page?do=export_code&id=2_7_0%3Aadvancedtopics%3Asynchro_howto_personsfromldap&codeblock=6]persons.csv primary_key;name;first_name;org_id;email;status;function;phone;notify1;Monet;Claude;Demo;claude.monet@demo.com;Active;Famous painter;+33123456789;Yes2;Flaubert;Gustave;IT Department;gustave.flaubert@demo.com;Active;;+33987654321;No3;Mondrian;Piet;Demo;p.m@demo.com;Active;;+334433221100;No使用相同的命令启动导入并再次同步:php synchro/synchro_import.php --auth_user=admin --auth_pwd=admin --csvfile=./data/persons.csv --data_source_id=1 --output=summary输出如下:#Load--------------#------------------#Data Source: 1#Synchronize: 1#Class: Person#Separator: ;#Qualifier: "#Charset Encoding:UTF-8#Date format: <none>#Data Size: 294#Data Lines: 3#Columns: primary_key, name, first_name, org_id, email, status, function, phone, notify#Output format: summary#Simulate: 0#Change tracking comment: #Issues (before synchro): 0#Created (before synchro): 1#Updated (before synchro): 2#Synchronization---#------------------#Replicas: 3#Replicas touched since last synchro: 3#Objects deleted: 0#Objects deletion errors: 0#Objects obsoleted: 0#Objects obsolescence errors: 0#Objects created: 1 (0 warnings)#Objects creation errors: 0#Objects updated: 0 (0 warnings)#Objects update errors: 0#Objects reconciled (updated): 0 (0 warnings)#Objects reconciled (unchanged): 0 (0 warnings)#Objects reconciliation errors: 0#Replica disappeared, no action taken: 0同步的输出表示仅更新了1个对象。也可以在同步数据的状况选项卡上查看来源:https://www.itophub.io/wiki/media?w=500&tok=634031&media=2_7_0%3Aadvancedtopics%3Astatus_updated_replicas3.png使用页面左上方的全局搜索,将“联系人:Piet”用于搜索,然后单击搜索的名称以显示其详细信息。https://www.itophub.io/wiki/media?w=500&tok=dd7c90&media=2_7_0%3Aadvancedtopics%3Anew_contact_piet_mondrian.png第四次同步:以错误为例然后在iTop根目录下的目录“数据”中修改文本文件“ persons.csv”,方法是在末尾再添加一行:[ ttps://www.itophub.io/wiki/page?do=export_code&id=2_7_0%3Aadvancedtopics%3Asynchro_howto_personsfromldap&codeblock=9]persons.csv primary_key;name;first_name;org_id;email;status;function;phone;notify1;Monet;Claude;Demo;claude.monet@demo.com;Active;Famous painter;+33123456789;Yes2;Flaubert;Gustave;IT Department;gustave.flaubert@demo.com;Active;;+33987654321;No3;Mondrian;Piet;Demo;p.m@demo.com;Active;;+334433221100;No4;Klimt;Gurstav;Test;gustav.klimt@demo.com;Active;;+335566778899;No使用相同的命令启动导入并再次同步:php synchro/synchro_import.php --auth_user=admin --auth_pwd=admin --csvfile=./data/persons.csv --data_source_id=1 --output=summary输出如下:#Load--------------#------------------#Data Source: 5#Synchronize: 1#Class: Person#Separator: ;#Qualifier: "#Charset Encoding:UTF-8#Date format: <none>#Data Size: 361#Data Lines: 4#Columns: primary_key, name, first_name, org_id, email, status, function, phone, notify#Output format: summary#Simulate: 0#Change tracking comment: #Issues (before synchro): 0#Created (before synchro): 1#Updated (before synchro): 3#Synchronization---#------------------#Replicas: 4#Replicas touched since last synchro: 4#Objects deleted: 0#Objects deletion errors: 0#Objects obsoleted: 0#Objects obsolescence errors: 0#Objects created: 0 (0 warnings)#Objects creation errors: 1#Objects updated: 0 (0 warnings)#Objects update errors: 0#Objects reconciled (updated): 0 (0 warnings)#Objects reconciled (unchanged): 0 (0 warnings)#Objects reconciliation errors: 0#Replica disappeared, no action taken: 0同步的输出指出存在一个错误在此处添加错误中副本详细信息的屏幕截图https://www.itophub.io/wiki/media?w=500&tok=6a3a10&media=2_7_0%3Aadvancedtopics%3Astatus_error_1_error.png[ ttps://www.itophub.io/wiki/page?do=export_code&id=2_7_0%3Aadvancedtopics%3Asynchro_howto_personsfromldap&codeblock=12]persons.csv primary_key;name;first_name;org_id;email;status;function;phone;notify1;Monet;Claude;Demo;claude.monet@demo.com;Active;Famous painter;+33123456789;Yes2;Flaubert;Gustave;IT Department;gustave.flaubert@demo.com;Active;;+33987654321;No3;Mondrian;Piet;Demo;p.m@demo.com;Active;;+334433221100;No4;Klimt;Gurstav;Demo;gustav.klimt@demo.com;Active;;+335566778899;No使用相同的命令启动导入并再次同步:php synchro/synchro_import.php --auth_user=admin --auth_pwd=admin --csvfile=./data/persons.csv --data_source_id=1 --output=summary应该没有错误,并且在演示组织中创建了联系人Gustav Klimt。
页:
[1]