[ZBX-21470] Import Templates failed Created: 2022 Aug 13  Updated: 2022 Aug 15  Resolved: 2022 Aug 15

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: None
Affects Version/s: 6.2.0
Fix Version/s: None

Type: Problem report Priority: Trivial
Reporter: Muhtasin Haque Navid Assignee: Antons Sincovs
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

OS: CentOS Stream release 8
DB: postgresql 14, timescaldb 2.6
PHP: 7.4


Attachments: PNG File image-2022-08-13-15-21-40-347.png     PNG File image-2022-08-15-10-58-28-725.png     PNG File image-2022-08-15-11-02-11-776.png     PNG File image-2022-08-15-11-08-04-646.png     PNG File screenshot-1.png     XML File zbx_export_templates.xml    
Issue Links:
Duplicate
duplicates ZBX-20679 Template import on 6.0 doesn't recogn... Closed

 Description   

Hello!

 

I am trying to migrate template and host file from zabbix 5.0.7 to 6.2 . After exporting from 5.0.2 the xml file failed to import to zabbix 6.2. Please help me out.

Also, attached the export template file.

previous 5.0.2 zabbix version i was using redhat 8 and postgresql 11 and timescaledb 1.6.



 Comments   
Comment by Antons Sincovs [ 2022 Aug 15 ]

Hello and thank you for reporting the ZBX.

It is quite a large template (a set of templates to be precise) - that you are trying to import at once in terms of this one file.

When first trying to import the template you attached - I observed the error displayed in the Zabbix web interface itself:

This is regulated by the variable defined in the "/etc/php-fpm.d/zabbix.conf"

php_value[upload_max_filesize]

which is by default set to the value of "2M" - 2 megabytes and your template is more than 4MB big. When adjusting the value to, let's say, "16M", saving the configuration file and restarting the "php-fpm.service" - at the template import I now get the error you described:

If you look into the web server engine error logs, in my case I have an Apache Web Server + PHP-FPM process manager, you most likely will see the following entries ("/var/log/httpd/error_log"):

AH01071: Got error 'PHP message: PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes) in /usr/share/zabbix/include/classes/html/CObject.php on line 69' 

 The parameter that regulates the allowed memory size is:

php_value[memory_limit]

and by default it is set to "128M" which is apparently not enough to process the template being imported, set it to some higher value, "256M" was sufficient in my case, here are the two adjusted parameters:

php_value[memory_limit] = 256M 
php_value[upload_max_filesize] = 16M

Now you will be able to proceed with importing, however in my case the import eventually failed with:

This is a known error and described in ZBX-20679 and resolution is still in progress.

What I tried in my test environment - was:

  • on the new system where your are importing your templates to - "unlink" the existing conflicting template from all hosts where (if) it was linked - then the entities from the template are left on hosts as local entities
  • delete the template
  • import the new template (now when there is no conflicting template the import should succeed)
  • link the newly imported template to hosts, to make all hosts's entities be linked from the template level

Please, try the suggested workaround with caution, in a test environment first.

Comment by Muhtasin Haque Navid [ 2022 Aug 15 ]

@asincovs thanks for your response. I really appreciate it. I have already solved the php issue.so  what i have tried.-

  • download the existing 6.0 templates nd delete all
  • after that i have uploaded the 5.0 templates and it works fine. host upload works perfect.

though the issue is that i can not using the updated templates nd as you are giving screenshot of conflicting item/trigger when i will upload the 6.0 templates.

Comment by Antons Sincovs [ 2022 Aug 15 ]

Thank you for the feedback, will close this ZBX as a duplicate for ZBX-20679 - please, upvote, it to boost the resolution.

Generated at Tue Apr 15 13:27:43 EEST 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.