southbridgeio / zabbix-review-export-import

Clone of zabbix-review-export with added import object(s) feature
https://gitlab.com/devopshq/zabbix-review-export
50 stars 30 forks source link

Export fail at processing "action" #5

Closed gjaekel closed 3 years ago

gjaekel commented 3 years ago

I found "your" clone and give it a try. It fail at processing the "action" section. Using the same instance of Zabbix4, the version form https://gitlab.com/devopshq/zabbix-review-export works on this section. But it pull much less content in general, of course.

Please ask if you need more info.

2020-11-03 15:00:28,301 INFO     JSON-RPC Server Endpoint: http://zabbix4.dnb.de.test/api_jsonrpc.php
2020-11-03 15:00:28,316 INFO     All files will be save in /data/zabbix/export
2020-11-03 15:00:28,327 INFO     Convert all format to yaml
2020-11-03 15:00:28,327 INFO     Start export XML part...
2020-11-03 15:00:28,328 INFO     Export groups
2020-11-03 15:00:29,454 INFO     Export hosts
2020-11-03 15:00:42,653 INFO     Export templates
2020-11-03 15:01:10,933 INFO     Export valueMaps
2020-11-03 15:01:12,747 INFO     Export maps
2020-11-03 15:01:13,124 INFO     Start export JSON part...
2020-11-03 15:01:13,124 INFO     Processing mediatypes...
2020-11-03 15:01:13,156 INFO     Processing images...
2020-11-03 15:01:13,312 INFO     Processing usergroups...
2020-11-03 15:01:13,343 INFO     Processing users...
2020-11-03 15:01:13,404 INFO     Processing proxy...
2020-11-03 15:01:13,421 INFO     Processing global macroses...
2020-11-03 15:01:13,450 INFO     Processing maintenances...
2020-11-03 15:01:13,462 INFO     Processing screens...
2020-11-03 15:01:16,911 INFO     Processing action...
Traceback (most recent call last):
  File "/opt/zabbix/bin/zabbix_export._next", line 530, in <module>
    main(zabbix_=zabbix_, save_yaml=args.save_yaml, directory=args.directory, only=args.only)
  File "/opt/zabbix/bin/zabbix_export._next", line 383, in main
    del op['actionid']
KeyError: 'actionid'  

The invocations of the script with -debug don't yield more valuable information

[...]
        {
            "triggerid": "79752",
            "description": "{HOST.NAME} is not pingable",
            "hosts": [
                {
                    "hostid": "14299",
                    "name": "F-NW-00098"
                }
            ]
        },
        {
            "triggerid": "79753",
            "description": "{HOST.NAME} is not pingable",
            "hosts": [
                {
                    "hostid": "14300",
                    "name": "F10AP01"
                }
            ]
        }
    ],
    "id": 937
}
Traceback (most recent call last):
  File "/opt/zabbix/bin/zabbix_export._next", line 530, in <module>
    main(zabbix_=zabbix_, save_yaml=args.save_yaml, directory=args.directory, only=args.only)
  File "/opt/zabbix/bin/zabbix_export._next", line 383, in main
    del op['actionid']
KeyError: 'actionid'          
evgkrsk commented 3 years ago

Can you re-check version in "fix-github-issue-5" git branch ?

It is better to run "--debug" with "--only actions" in this case (i.e., last failed object type). Last debug lines isn't very useful, whole debug output is needed (beware: it contains your zabbix password in PLAIN TEXT, cut off first 10-12 lines if you want to drop it). Consider sharing such dump in case of troubles.

gjaekel commented 3 years ago

Gotcha!

2020-11-04 10:22:49,368 INFO     JSON-RPC Server Endpoint: http://zabbix4.dnb.de.test/api_jsonrpc.php
2020-11-04 10:22:49,390 INFO     All files will be save in /import/share/opt/zabbix/bin/y
2020-11-04 10:22:49,396 INFO     Convert all format to yaml
2020-11-04 10:22:49,397 INFO     Start export XML part...
2020-11-04 10:22:49,397 INFO     Export groups
2020-11-04 10:22:50,179 INFO     Export hosts
2020-11-04 10:22:57,841 INFO     Export templates
2020-11-04 10:23:15,793 INFO     Export valueMaps
2020-11-04 10:23:17,001 INFO     Export maps
2020-11-04 10:23:17,310 INFO     Start export JSON part...
2020-11-04 10:23:17,310 INFO     Processing mediatypes...
2020-11-04 10:23:17,341 INFO     Processing images...
2020-11-04 10:23:17,502 INFO     Processing usergroups...
2020-11-04 10:23:17,536 INFO     Processing users...
2020-11-04 10:23:17,591 INFO     Processing proxy...
2020-11-04 10:23:17,599 INFO     Processing global macroses...
2020-11-04 10:23:17,626 INFO     Processing maintenances...
2020-11-04 10:23:17,633 INFO     Processing screens...
2020-11-04 10:23:21,057 INFO     Processing action...
2020-11-04 10:23:21,541 INFO     Processing user macroses...
2020-11-04 10:23:22,103 INFO     Processing dashboards...           

I guess you'll merge it in the master in near future. BTW: IMHO, the plural of macro is macros.

Thank you for your work and fast support, it's extreme valuable for us because in this days we refresh our Zabbix and have to propagate configuration between the test, approval and production stages.

I'm curious about your import script!

evgkrsk commented 3 years ago

Please bear in mind that import code have some known problems (see project's open issues). PR are welcome.

gjaekel commented 3 years ago

I'll test it as an option.

The other way is to "concatenate" some XML files by cutting the individual header and footer and add this to the sum. This may be imported by the GUI dialog afterwards. We will rely on this for the current task to go live from approval to production this week.