[ZBX-17063] configuration.export can't export/import some templates Created: 2019 Dec 10  Updated: 2019 Dec 19  Resolved: 2019 Dec 19

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

Type: Problem report Priority: Trivial
Reporter: Evgenii Terechkov Assignee: Edgars Melveris
Resolution: Cannot Reproduce Votes: 0
Labels: activeagent, configuration, export, import, template
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

zabbix-4.2 from official repo updated to 4.4.3 (Centos7).


Attachments: XML File Redis_discovery.xml     PNG File Screenshot 2019-12-10 at 19.56.20.png     PNG File Screenshot 2019-12-10 at 20.05.45.png     PNG File Screenshot 2019-12-11 at 23.37.57.png     PNG File Screenshot 2019-12-11 at 23.38.06.png     PNG File Screenshot 2019-12-11 at 23.38.16.png     PNG File Screenshot 2019-12-12 at 01.26.34.png     PNG File Screenshot 2019-12-12 at 01.30.20.png    

 Description   

After update 4.2->4.4.3 some of templates cant be handled by configuration.export API call with strange messages about "zabbix active agent" items (see attached streenshot). Also, this zabbix version cant import same templates (dumped on 4.2) from XML files (see attached screenshot and XML file), in 4.4.1 version too.

Steps to reproduce:

  1. Set up zabbix-4.2
  2. Create/import template with LLD prototype items with type "Zabbix agent (active)"
  3. Update to zabbix-4.4.3
  4. Try to export this template
  5. Try to import this template (dumped to XML in 4.2) in empty instance

Result:
See screenshots 1/2: cant export/import some templates.

Expected:
Effortless configuration export.



 Comments   
Comment by Edgars Melveris [ 2019 Dec 11 ]

Hello Evgenii,
Can you show the screenshots of the graph prototypes for this template?
The problem only occurs, when the template was exported from 4.2? If you export it from 4.4 do you see the same problem?

Comment by Evgenii Terechkov [ 2019 Dec 11 ]

Just as I state before, I cannot export this template from 4.4, via GUI export nor via API configuration.export (see screenshot with "unexpected constant value 7").

 

Just by the lucky I have backup XML template, exported from 4.2. I cannot import it in 4.4 (see screenshot with PHP traceback in GUI).

 

Here is screenshot of graph prototypes (attached 3 screenshots with 12 graph prototypes in total).

Comment by Evgenii Terechkov [ 2019 Dec 11 ]

(BTW, I can open for editing any of this 12 graph prototypes without any problems).

Comment by Edgars Melveris [ 2019 Dec 11 ]

Can you open one of the graphs and add a screenshot of the configuration also?
And, please open the template and note the hostid parameter from the URL section.
Then use that hostid in this query and show us the results:

 select gi.graphid,gi.itemid,gi.type,g.graphtype,g.name
	from graphs_items gi 
	left join items i on gi.itemid=i.itemid
	left join hosts h on i.hostid=h.hostid
	left join graphs g on gi.graphid=g.graphid
	where h.hostid=<HOSTID OF THE TEMPLATE>;
Comment by Evgenii Terechkov [ 2019 Dec 11 ]

Sure. I have attached screenshot of one graph prototype.

 

Here is SQL you have asked:

graphid | itemid | type | graphtype | name
---------+--------+------+-----------+--------------------------------------------------------------
21026 | 151378 | 0 | 0 | Redis: "{#INSTANCE}:{#PORT}" - CPU Utilization
21023 | 151398 | 7 | 0 | Redis: "{#INSTANCE}:{#PORT}" - Connected Clients
21024 | 151406 | 0 | 0 | Redis: "{#INSTANCE}:{#PORT}" - Connected Slaves
21028 | 151409 | 0 | 0 | Redis: "{#INSTANCE}:{#PORT}" - Keys: Expired Keys
21022 | 151384 | 7 | 0 | Redis: "{#INSTANCE}:{#PORT}" - Commands Overview
21025 | 151385 | 7 | 0 | Redis: "{#INSTANCE}:{#PORT}" - Connections
21027 | 151391 | 0 | 0 | Redis: "{#INSTANCE}:{#PORT}" - DB Size in Memory vs Disk
21032 | 151421 | 0 | 1 | Redis: "{#INSTANCE}" - {#COMMAND} Calls Overview
21033 | 151422 | 0 | 1 | Redis: "{#INSTANCE}" - {#COMMAND} Latency Overview
21029 | 151393 | 0 | 0 | Redis: "{#INSTANCE}:{#PORT}" - Total Keys vs Keys with Expr.
21029 | 151394 | 0 | 0 | Redis: "{#INSTANCE}:{#PORT}" - Total Keys vs Keys with Expr.
21030 | 151417 | 0 | 0 | Redis: "{#INSTANCE}:{#PORT}" - "{#SLAVE}" Lag Overview
21031 | 151418 | 0 | 0 | Redis: "{#INSTANCE}:{#PORT}" - "{#SLAVE}" Offset Overview
21027 | 151415 | 0 | 0 | Redis: "{#INSTANCE}:{#PORT}" - DB Size in Memory vs Disk
(14 rows)
Comment by Evgenii Terechkov [ 2019 Dec 11 ]

Added one more screenshot (with type=7 from SQL dump above). Seems legal.

Comment by dimir [ 2019 Dec 12 ]

Looks like the issue is with this part of XML:

          <graph_prototypes>
            <graph_prototype>
              <name>Redis: "{#INSTANCE}:{#PORT}" - Commands Overview</name>
              <width>900</width>
              <height>200</height>
              <yaxismin>0.0000</yaxismin>
              <yaxismax>100.0000</yaxismax>
              <show_work_period>0</show_work_period>
              <show_triggers>0</show_triggers>
              <type>0</type>
              <show_legend>1</show_legend>
              <show_3d>0</show_3d>
              <percent_left>0.0000</percent_left>
              <percent_right>0.0000</percent_right>
              <ymin_type_1>0</ymin_type_1>
              <ymax_type_1>0</ymax_type_1>
              <ymin_item_1>0</ymin_item_1>
              <ymax_item_1>0</ymax_item_1>
              <graph_items>
                <graph_item>
                  <sortorder>0</sortorder>
                  <drawtype>2</drawtype>
                  <color>6666FF</color>
                  <yaxisside>0</yaxisside>
                  <calc_fnc>2</calc_fnc>
                  <type>7</type>                 <---- this can be only one of (0 - normal, 1 - stacked, 2 - pie, 3 - exploded)
                  <item>
                    <host>Redis_discovery</host>
                    <key>redis.stat.get[total_commands_processed,{#HOST},{#PORT}]</key>
                  </item>
                </graph_item>
              </graph_items>
            </graph_prototype>
            ...
          </graph_prototypes> 

By the way, item type 7 is "Zabbix agent (active)". So looks like item type gets into graph type field during the export.

Comment by Edgars Melveris [ 2019 Dec 12 ]

Actually type in graph items is not the item type, but calculation type, for the item in graph:

type
integer
Element type "graphs.graphtype NOT IN (0, 1)":

0, GRAPH_ITEM_SIMPLE - Simple type
2, GRAPH_ITEM_SUM - "Graph sum" type

And graphtypes can be:

graphtype
integer
Graph type:

0, GRAPH_TYPE_NORMAL - Normal graph
1, GRAPH_TYPE_STACKED - Stacked graph
2, GRAPH_TYPE_PIE - Pie graph
3, GRAPH_TYPE_EXPLODED - "Exploded" pie graph
4, GRAPH_TYPE_3D - 3d pie graph
5, GRAPH_TYPE_3D_EXPLODED - 3d "exploded" pie graph

So it should be 0 by default and only in case it's one of the "pie" graphs, it can be 2. 7 is not legal here. Although it's possible to manually insert anything there, as it's integer column.

It's possible, that there have been a bug in Zabbix API in some previous version, that could have caused this, but currently the only solution is to manually fix this in the DB.
But, if you can reproduce the problem in a current version of Zabbix, there is probably a bug to fix. Please let us know, if that's the case.

Comment by dimir [ 2019 Dec 12 ]

evg-krsk, could you please describe in detail:

  • how was this template created or where downloaded from
  • in which exact version was it imported
  • how exactly was it imported (frontend or API)
  • from which exact version was exported
  • how exactly was it exported (frontend or API)

Basically, describe in very detail the whole process of handling this template.

Comment by Evgenii Terechkov [ 2019 Dec 12 ]
  • I guess that this template was handmaded in past in our company, now sure at which zabbix version (but <= 3.4)
  • It was imported in zabbix 4.2 from 3.4 XML dump without any problems. After that, I have upgraded zabbix to 4.4 and hit this problem with import/export of just this one template.
  • It was imported from zabbix 4.2 fronend
  • It was last exported from zabbix 3.4
  • It was last exported via frontd

So, how can I manually fix DB without data acqusition and visualization breakage (template seems to work fine on production machines)?

Comment by Evgenii Terechkov [ 2019 Dec 12 ]

s/frontd/frontend/

Comment by Evgenii Terechkov [ 2019 Dec 19 ]

ping?

Comment by Edgars Melveris [ 2019 Dec 19 ]

I listed the possible values in that field in previous comment, you need to manually change it in DB to one of the expected values (probably 0).
It's possible you where able to import or export it in previous versions of Zabbix, but currently stricter XML value sanitation is done, that's why it's no longer possible.
I'm closing this, as there is currently no indication of a bug in supported version of Zabbix. Please reopen the issue, if you can reproduce the problem on a supported version of Zabbix.

Generated at Sun Jun 21 04:19:05 EEST 2026 using Jira 10.3.18#10030018-sha1:5642e4ad348b6c2a83ebdba689d04763a2393cab.