[ZBX-11594] Problem with importing trigger on hosts from xml Created: 2016 Dec 14  Updated: 2017 May 30  Resolved: 2016 Dec 14

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Frontend (F)
Affects Version/s: 3.2.2
Fix Version/s: None

Type: Incident report Priority: Major
Reporter: Gojko Bozic Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: templates, triggers
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

CentOS 7 x64


Attachments: XML File Zabbix-Hosts.xml     XML File mikrotik-template.xml    
Issue Links:
Duplicate
duplicates ZBX-3783 Proper API validation Reopened

 Description   

I am having problems when importing hosts from XML. It doesn't import triggers from discovery.
When i adding host manualy it works without problem. Everything else is ok.

Here is error:

Undefined offset: 0 [conf.import.php:176 ? CFrontendApiWrapper->import() ? CApiWrapper->__call() ? CFrontendApiWrapper->callMethod() ? CApiWrapper->callMethod() ? CFrontendApiWrapper->callClientMethod() ? CLocalApiClient->callMethod() ? call_user_func_array() ? CConfiguration->import() ? CConfigurationImport->import() ? CConfigurationImport->processHosts() ? CHostImporter->import() ? CTemplate->massAdd() ? CHostGeneral->link() ? CTriggerGeneral->syncTemplates() ? CTriggerGeneral->inherit() ? CTriggerGeneral->inheritOnHost() ? CTriggerGeneral->createReal() in include/classes/api/services/CTriggerGeneral.php:893]
Invalid argument supplied for foreach() [conf.import.php:176 ? CFrontendApiWrapper->import() ? CApiWrapper->__call() ? CFrontendApiWrapper->callMethod() ? CApiWrapper->callMethod() ? CFrontendApiWrapper->callClientMethod() ? CLocalApiClient->callMethod() ? call_user_func_array() ? CConfiguration->import() ? CConfigurationImport->import() ? CConfigurationImport->processHosts() ? CHostImporter->import() ? CTemplate->massAdd() ? CHostGeneral->link() ? CTriggerGeneral->syncTemplates() ? CTriggerGeneral->inherit() ? CTriggerGeneral->inheritOnHost() ? CTriggerGeneral->createReal() in include/classes/api/services/CTriggerGeneral.php:893]
Undefined offset: 0 [conf.import.php:176 ? CFrontendApiWrapper->import() ? CApiWrapper->__call() ? CFrontendApiWrapper->callMethod() ? CApiWrapper->callMethod() ? CFrontendApiWrapper->callClientMethod() ? CLocalApiClient->callMethod() ? call_user_func_array() ? CConfiguration->import() ? CConfigurationImport->import() ? CConfigurationImport->processHosts() ? CHostImporter->import() ? CTemplate->massAdd() ? CHostGeneral->link() ? CTriggerGeneral->syncTemplates() ? CTriggerGeneral->inherit() ? CTriggerGeneral->inheritOnHost() ? CTriggerGeneral->createReal() in include/classes/api/services/CTriggerGeneral.php:893]
Invalid argument supplied for foreach() [conf.import.php:176 ? CFrontendApiWrapper->import() ? CApiWrapper->__call() ? CFrontendApiWrapper->callMethod() ? CApiWrapper->callMethod() ? CFrontendApiWrapper->callClientMethod() ? CLocalApiClient->callMethod() ? call_user_func_array() ? CConfiguration->import() ? CConfigurationImport->import() ? CConfigurationImport->processHosts() ? CHostImporter->import() ? CTemplate->massAdd() ? CHostGeneral->link() ? CTriggerGeneral->syncTemplates() ? CTriggerGeneral->inherit() ? CTriggerGeneral->inheritOnHost() ? CTriggerGeneral->createReal() in include/classes/api/services/CTriggerGeneral.php:893]
Undefined offset: 0 [conf.import.php:176 ? CFrontendApiWrapper->import() ? CApiWrapper->__call() ? CFrontendApiWrapper->callMethod() ? CApiWrapper->callMethod() ? CFrontendApiWrapper->callClientMethod() ? CLocalApiClient->callMethod() ? call_user_func_array() ? CConfiguration->import() ? CConfigurationImport->import() ? CConfigurationImport->processHosts() ? CHostImporter->import() ? CTemplate->massAdd() ? CHostGeneral->link() ? CTriggerGeneral->syncTemplates() ? CTriggerGeneral->inherit() ? CTriggerGeneral->inheritOnHost() ? CTriggerGeneral->createReal() in include/classes/api/services/CTriggerGeneral.php:893]
Invalid argument supplied for foreach() [conf.import.php:176 ? CFrontendApiWrapper->import() ? CApiWrapper->__call() ? CFrontendApiWrapper->callMethod() ? CApiWrapper->callMethod() ? CFrontendApiWrapper->callClientMethod() ? CLocalApiClient->callMethod() ? call_user_func_array() ? CConfiguration->import() ? CConfigurationImport->import() ? CConfigurationImport->processHosts() ? CHostImporter->import() ? CTemplate->massAdd() ? CHostGeneral->link() ? CTriggerGeneral->syncTemplates() ? CTriggerGeneral->inherit() ? CTriggerGeneral->inheritOnHost() ? CTriggerGeneral->createReal() in include/classes/api/services/CTriggerGeneral.php:893]
Undefined offset: 0 [conf.import.php:176 ? CFrontendApiWrapper->import() ? CApiWrapper->__call() ? CFrontendApiWrapper->callMethod() ? CApiWrapper->callMethod() ? CFrontendApiWrapper->callClientMethod() ? CLocalApiClient->callMethod() ? call_user_func_array() ? CConfiguration->import() ? CConfigurationImport->import() ? CConfigurationImport->processHosts() ? CHostImporter->import() ? CTemplate->massAdd() ? CHostGeneral->link() ? CTriggerGeneral->syncTemplates() ? CTriggerGeneral->inherit() ? CTriggerGeneral->inheritOnHost() ? CTriggerGeneral->createReal() in include/classes/api/services/CTriggerGeneral.php:893]
Invalid argument supplied for foreach() [conf.import.php:176 ? CFrontendApiWrapper->import() ? CApiWrapper->__call() ? CFrontendApiWrapper->callMethod() ? CApiWrapper->callMethod() ? CFrontendApiWrapper->callClientMethod() ? CLocalApiClient->callMethod() ? call_user_func_array() ? CConfiguration->import() ? CConfigurationImport->import() ? CConfigurationImport->processHosts() ? CHostImporter->import() ? CTemplate->massAdd() ? CHostGeneral->link() ? CTriggerGeneral->syncTemplates() ? CTriggerGeneral->inherit() ? CTriggerGeneral->inheritOnHost() ? CTriggerGeneral->createReal() in include/classes/api/services/CTriggerGeneral.php:893]
Undefined offset: 0 [conf.import.php:176 ? CFrontendApiWrapper->import() ? CApiWrapper->__call() ? CFrontendApiWrapper->callMethod() ? CApiWrapper->callMethod() ? CFrontendApiWrapper->callClientMethod() ? CLocalApiClient->callMethod() ? call_user_func_array() ? CConfiguration->import() ? CConfigurationImport->import() ? CConfigurationImport->processHosts() ? CHostImporter->import() ? CTemplate->massAdd() ? CHostGeneral->link() ? CTriggerGeneral->syncTemplates() ? CTriggerGeneral->inherit() ? CTriggerGeneral->inheritOnHost() ? CTriggerGeneral->createReal() in include/classes/api/services/CTriggerGeneral.php:893]
Invalid argument supplied for foreach() [conf.import.php:176 ? CFrontendApiWrapper->import() ? CApiWrapper->__call() ? CFrontendApiWrapper->callMethod() ? CApiWrapper->callMethod() ? CFrontendApiWrapper->callClientMethod() ? CLocalApiClient->callMethod() ? call_user_func_array() ? CConfiguration->import() ? CConfigurationImport->import() ? CConfigurationImport->processHosts() ? CHostImporter->import() ? CTemplate->massAdd() ? CHostGeneral->link() ? CTriggerGeneral->syncTemplates() ? CTriggerGeneral->inherit() ? CTriggerGeneral->inheritOnHost() ? CTriggerGeneral->createReal() in include/classes/api/services/CTriggerGeneral.php:893]
Undefined offset: 0 [conf.import.php:176 ? CFrontendApiWrapper->import() ? CApiWrapper->__call() ? CFrontendApiWrapper->callMethod() ? CApiWrapper->callMethod() ? CFrontendApiWrapper->callClientMethod() ? CLocalApiClient->callMethod() ? call_user_func_array() ? CConfiguration->import() ? CConfigurationImport->import() ? CConfigurationImport->processHosts() ? CHostImporter->import() ? CTemplate->massAdd() ? CHostGeneral->link() ? CTriggerGeneral->syncTemplates() ? CTriggerGeneral->inherit() ? CTriggerGeneral->inheritOnHost() ? CTriggerGeneral->createReal() in include/classes/api/services/CTriggerGeneral.php:893]


 Comments   
Comment by Aleksandrs Saveljevs [ 2016 Dec 14 ]

Could you please post the XML that produces this problem?

Comment by Gojko Bozic [ 2016 Dec 14 ]

I attached Zabbix-Hosts and template which i use

Comment by Aleksandrs Saveljevs [ 2016 Dec 14 ]

Thank you! How did you obtain these files? Did you export them from Zabbix (if so, which version), downloaded from somewhere or generated manually?

Comment by Gojko Bozic [ 2016 Dec 14 ]

Mikrotik template firstly i downloaded from your site : https://share.zabbix.com/network_devices/mikrotik/mikrotik-routeros
Then i added two triggers via web gui. And exported to you.
Zabbix-Hosts, i exported one host via Zabbix web interface, then i created python script which generate same <host> section but with different ip address and name.

Comment by Aleksandrs Saveljevs [ 2016 Dec 14 ]

If we fix the XML by removing extra newlines in host names and IP addresses in "Zabbix-Hosts.xml", then that XML imports normally.

Still, we should probably fix the frontend/API to better validate XML and not allow the following:

       <host> 
            <host>Yellow_house 10.10.10.10
</host>
            <name>Yellow_house 10.10.10.10
</name>
            <description/>
            ...
            <interfaces>
                <interface>
                    <default>1</default>
                    <type>2</type>
                    <useip>1</useip>
                    <ip>10.10.10.10
</ip>
                    <dns/>
                    <port>161</port>
                    <bulk>1</bulk>
                    <interface_ref>if1</interface_ref>
                </interface>
            </interfaces>
            ...
       </host>
Comment by Alexander Vladishev [ 2016 Dec 14 ]

Closed as duplicate of ZBX-3783

Generated at Sat Apr 26 07:25:56 EEST 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.