Некорректное значение «‘44569′» для поля целого положительного числа «resourceid».
Возвращает движок zabbix при вставке счетчика в таблицу аудита. Из-за чего конкретно оно падает неясно, для подробностей нужно включать отладку (добавить текущего пользователя в группу Enabled debug mode, затем нажать Debug внизу справа) и смотреть на реальные данные.
https://github.com/zabbix/zabbix/blob/1a62a05acd4276e2dfd4e6baab1ff3443c4cbb96/ui/include/classes/db/DB.php#L396
Также необходимо убедиться, что со схемой базы все в порядке. Сделать бекап, затем выполнить для MySQL:
ALTER TABLE auditlog MODIFY COLUMN resourceid bigint unsigned DEFAULT NULL;
На чистой установке я все еще не могу воспроизвести.
Attempting to import an XML configuration for a web scenario + trigger template using the Zabbix API, but the import fails when verifying the trigger.
Here are the details of the request being made to the API and the error returned:
failed: [127.0.0.1] (item=services/website.xml.j2) => { "access_control_allow_headers": "Content-Type", "access_control_allow_methods": "POST", "access_control_allow_origin": "*", "access_control_max_age": "1000", "changed": false, "connection": "close", "content_length": "207", "content_type": "application/json", "date": "Tue, 14 Mar 2017 10:00:42 GMT", "failed": true, "failed_when_result": true, "invocation": { "module_args": { "backup": null, "body": { "auth": "f07beb1227557c992d8f6c395b48d0a7", "id": "24402", "jsonrpc": 2.0, "method": "configuration.import", "params": { "format": "xml", "rules": { "applications": { "createMissing": true, "deleteMissing": true, "updateExisting": true }, "groups": { "createMissing": true }, "items": { "createMissing": true, "deleteMissing": true, "updateExisting": true }, "templates": { "createMissing": true, "updateExisting": true }, "triggers": { "createMissing": true, "deleteMissing": true, "updateExisting": true } }, "source": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<zabbix_export>\n <version>3.2</version>\n <date>2017-03-12T12:26:11Z</date>\n <groups>\n <group>\n <name>ansible-zabbix/templates</name>\n </group>\n </groups>\n <templates>\n <template>\n <template>templates_website_check</template>\n <name>templates_website_check</name>\n <description/>\n <groups>\n <group>\n <name>ansible-zabbix/templates</name>\n </group>\n </groups>\n <applications>\n <application>\n <name>WEBSITE</name>\n </application>\n </applications>\n <items/>\n <discovery_rules/>\n <httptests>\n <httptest>\n <name>website_check</name>\n <application>\n <name>WEBSITE</name>\n </application>\n <delay>60</delay>\n <attempts>1</attempts>\n <agent>Zabbix</agent>\n <http_proxy/>\n <variables/>\n <headers/>\n <status>0</status>\n <authentication>0</authentication>\n <http_user/>\n <http_password/>\n <verify_peer>0</verify_peer>\n <verify_host>0</verify_host>\n <ssl_cert_file/>\n <ssl_key_file/>\n <ssl_key_password/>\n <steps>\n <step>\n <name>website_health</name>\n <url>{HOST.HOST}</url>\n <posts/>\n <variables/>\n <headers/>\n <follow_redirects>1</follow_redirects>\n <retrieve_mode>0</retrieve_mode>\n <timeout>300</timeout>\n <required/>\n <status_codes>200</status_codes>\n </step>\n </steps>\n </httptest>\n </httptests>\n <macros/>\n <templates/>\n <screens/>\n </template>\n </templates>\n <triggers>\n <trigger>\n <expression>{templates_website_check:web.test.fail[website_check].sum(#5)}>2</expression>\n <recovery_mode>0</recovery_mode>\n <recovery_expression/>\n <name>Greater than 60% failures on {HOST.HOST} for web scenario website_check</name>\n <correlation_mode>0</correlation_mode>\n <correlation_tag/>\n <url/>\n <status>0</status>\n <priority>4</priority> <description/>\n <type>0</type>\n <manual_close>0</manual_close>\n <dependencies/>\n <tags/>\n </trigger>\n </triggers>\n</zabbix_export>\n" } }, "body_format": "json", "content": null, "creates": null, "delimiter": null, "dest": null, "directory_mode": null, "follow": false, "follow_redirects": "safe", "force": false, "force_basic_auth": false, "group": null, "headers": { "Content-Type": "application/json" }, "http_agent": "ansible-httpget", "method": "POST", "mode": null, "owner": null, "regexp": null, "remote_src": null, "removes": null, "return_content": false, "selevel": null, "serole": null, "setype": null, "seuser": null, "src": null, "status_code": [ 200 ], "timeout": 30, "unsafe_writes": null, "url": "http:, "url_password": null, "url_username": null, "use_proxy": true, "validate_certs": true }, "module_name": "uri" }, "item": "services/website.xml.j2", "json": { "error": { "code": -32602, "data": "Incorrect item key \"web.test.fail[website_check]\" provided for trigger expression on \"templates_website_check\".", "message": "Invalid params." }, "id": "24402", "jsonrpc": "2.0" }, "msg": "OK (207 bytes)", "redirected": false, "server": "Apache/2.4.6 (CentOS) PHP/5.4.16", "status": 200, "url": "http:, "x_powered_by": "PHP/5.4.16" }
And here is what the XML looks like before being serialized into a string:
<?xml version="1.0" encoding="UTF-8"?> <zabbix_export> <version>3.2</version> <date>2017-03-12T12:26:11Z</date> <groups> <group> <name>ansible-zabbix/templates</name> </group> </groups> <templates> <template> <template>templates_website_check</template> <name>templates_website_check</name> <description/> <groups> <group> <name>ansible-zabbix/templates</name> </group> </groups> <applications> <application> <name>WEBSITE</name> </application> </applications> <items/> <discovery_rules/> <httptests> <httptest> <name>website_check</name> <application> <name>WEBSITE</name> </application> <delay>60</delay> <attempts>1</attempts> <agent>Zabbix</agent> <http_proxy/> <variables/> <headers/> <status>0</status> <authentication>0</authentication> <http_user/> <http_password/> <verify_peer>0</verify_peer> <verify_host>0</verify_host> <ssl_cert_file/> <ssl_key_file/> <ssl_key_password/> <steps> <step> <name>website_health</name> <url>{HOST.HOST}</url> <posts/> <variables/> <headers/> <follow_redirects>1</follow_redirects> <retrieve_mode>0</retrieve_mode> <timeout>300</timeout> <required/> <status_codes>200</status_codes> </step> </steps> </httptest> </httptests> <macros/> <templates/> <screens/> </template> </templates> <triggers> <trigger> <expression>{templates_website_check:web.test.fail[website_check].sum(#5)}>2</expression> <recovery_mode>0</recovery_mode> <recovery_expression/> <name>Greater than 60% failures on {HOST.HOST} for web scenario website_check</name> <correlation_mode>0</correlation_mode> <correlation_tag/> <url/> <status>0</status> <priority>4</priority> <description/> <type>0</type> <manual_close>0</manual_close> <dependencies/> <tags/> </trigger> </triggers> </zabbix_export>
The XML should be ok as I manually created the template with web scenario and trigger on an existing Zabbix server then exported the XML from there.
I can also import this XML successfully using the Zabbix frontend, but when trying to import through the API it fails.
SUMMARY
When using zabbix_template to import a template to a zabbix 5.4 API, setting «state: present» on a template that does not yet exist gives an error about:
ZabbixAPIException: (u’Error -32602: Invalid params., Invalid parameter «/rules»: unexpected parameter «applications»
ISSUE TYPE
- Bug Report
COMPONENT NAME
community.zabbix.zabbix_template
ANSIBLE VERSION
ansible 2.9.16
config file = /etc/ansible/ansible.cfg
configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python2.7/site-packages/ansible
executable location = /usr/bin/ansible
python version = 2.7.5 (default, Nov 16 2020, 22:23:17) [GCC 4.8.5 20150623 (Red Hat 4.8.5-44)]
CONFIGURATION
ANSIBLE_PIPELINING(/etc/ansible/ansible.cfg) = True
COMMAND_WARNINGS(/etc/ansible/ansible.cfg) = False
DEFAULT_HOST_LIST(/etc/ansible/ansible.cfg) = [u'/etc/ansible/hosts']
DEFAULT_PRIVATE_KEY_FILE(/etc/ansible/ansible.cfg) = /etc/ansible/enlite/files/ssh
DEFAULT_VAULT_IDENTITY_LIST(/etc/ansible/ansible.cfg) = [u'enlite@~/.vault-pass.common']
DEPRECATION_WARNINGS(/etc/ansible/ansible.cfg) = False
HOST_KEY_CHECKING(/etc/ansible/ansible.cfg) = False
OS / ENVIRONMENT / Zabbix Version
Zabbix 5.4
STEPS TO REPRODUCE
Try to import a template that does not currently exist. It actually succeeds if the template already exists.
- name: Zabbix API - Importing all templates community.zabbix.zabbix_template: server_url: "https://{{ cert_domain }}.{{ domain }}/api_jsonrpc.php" login_user: Admin login_password: "{{ services.zabbix_web.admin_password }}" template_json: "{{ lookup('file', '/etc/ansible/enlite/files/zabbix/templates/testtemplate.json') }}" state: present
{ "zabbix_export": { "groups": [ { "name": "Zabbix servers", "uuid": "6f6799aa69e844b4b3918f779f2abf08" } ], "templates": [ { "groups": [ { "name": "Zabbix servers" } ], "name": "TEST", "template": "TEST", "uuid": "e4ad7acc1a804011b7b8161663e1f31b" } ], "version": "5.4" } }
EXPECTED RESULTS
Successful import, which I think looks like:
ok: [localhost] => (item={u’rusr’: True, u’uid’: 1000, u’rgrp’: True, u’xoth’: False, u’islnk’: False, u’woth’: False, u’nlink’: 1, u’issock’: False, u’mtime’: 1622211877.3902378, u’gr_name’: u», u’path’: u’/etc/ansible/enlite/files/zabbix/templates/testtemplate.json’, u’xusr’: False, u’atime’: 1622212098.9111104, u’inode’: 698318, u’isgid’: False, u’size’: 344, u’isdir’: False, u’wgrp’: True, u’ctime’: 1622211877.3982384, u’isblk’: False, u’xgrp’: False, u’isuid’: False, u’dev’: 2053, u’roth’: True, u’isreg’: True, u’isfifo’: False, u’mode’: u’0664′, u’pw_name’: u», u’gid’: 1000, u’ischr’: False, u’wusr’: True})
though I can only get that to work when the template already exists.
ACTUAL RESULTS
Import fails and complains abou t
Invalid parameter «/rules»: unexpected parameter «applications»
Note: «applications» is no longer part of zabbix 5.4 templates. I assume this needs updating.
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ZabbixAPIException: (u'Error -32602: Invalid params., Invalid parameter "/rules": unexpected parameter "applications". while sending {"params": {"rules": {"templates": {"createMissing": true, "updateExisting": true}, "valueMaps": {"createMissing": true, "updateExisting": true}, "httptests": {"createMissing": true, "deleteMissing": true, "updateExisting": true}, "templateLinkage": {"createMissing": true, "deleteMissing": true}, "applications": {"createMissing": true, "deleteMissing": true}, "groups": {"createMissing": true}, "triggers": {"createMissing": true, "deleteMissing": true, "updateExisting": true}, "items": {"createMissing": true, "deleteMissing": true, "updateExisting": true}, "graphs": {"createMissing": true, "deleteMissing": true, "updateExisting": true}, "discoveryRules": {"createMissing": true, "deleteMissing": true, "updateExisting": true}, "templateDashboards": {"createMissing": true, "deleteMissing": true, "updateExisting": true}}, "source": "{\\"zabbix_export\\": {\\"templates\\": [{\\"template\\": \\"TEST\\", \\"name\\": \\"TEST\\", \\"groups\\": [{\\"name\\": \\"Zabbix servers\\"}], \\"uuid\\": \\"e4ad7acc1a804011b7b8161663e1f31b\\"}], \\"version\\": \\"5.4\\", \\"groups\\": [{\\"name\\": \\"Zabbix servers\\", \\"uuid\\": \\"6f6799aa69e844b4b3918f779f2abf08\\"}]}}", "format": "json"}, "jsonrpc": "2.0", "method": "configuration.import", "auth": "cf1bfe0a922dcf8557e01508d76115c5", "id": 3}', -32602)
failed: [localhost] (item={u'rusr': True, u'uid': 1000, u'rgrp': True, u'xoth': False, u'islnk': False, u'woth': False, u'nlink': 1, u'issock': False, u'mtime': 1622211877.3902378, u'gr_name': u'', u'path': u'/etc/ansible/enlite/files/zabbix/templates/testtemplate.json', u'xusr': False, u'atime': 1622212098.9111104, u'inode': 698318, u'isgid': False, u'size': 344, u'isdir': False, u'wgrp': True, u'ctime': 1622211877.3982384, u'isblk': False, u'xgrp': False, u'isuid': False, u'dev': 2053, u'roth': True, u'isreg': True, u'isfifo': False, u'mode': u'0664', u'pw_name': u'', u'gid': 1000, u'ischr': False, u'wusr': True}) => {"ansible_loop_var": "item", "changed": false, "details": "(u'Error -32602: Invalid params., Invalid parameter \"/rules\": unexpected parameter \"applications\". while sending {\"params\": {\"rules\": {\"templates\": {\"createMissing\": true, \"updateExisting\": true}, \"valueMaps\": {\"createMissing\": true, \"updateExisting\": true}, \"httptests\": {\"createMissing\": true, \"deleteMissing\": true, \"updateExisting\": true}, \"templateLinkage\": {\"createMissing\": true, \"deleteMissing\": true}, \"applications\": {\"createMissing\": true, \"deleteMissing\": true}, \"groups\": {\"createMissing\": true}, \"triggers\": {\"createMissing\": true, \"deleteMissing\": true, \"updateExisting\": true}, \"items\": {\"createMissing\": true, \"deleteMissing\": true, \"updateExisting\": true}, \"graphs\": {\"createMissing\": true, \"deleteMissing\": true, \"updateExisting\": true}, \"discoveryRules\": {\"createMissing\": true, \"deleteMissing\": true, \"updateExisting\": true}, \"templateDashboards\": {\"createMissing\": true, \"deleteMissing\": true, \"updateExisting\": true}}, \"source\": \"{\\\\\"zabbix_export\\\\\": {\\\\\"templates\\\\\": [{\\\\\"template\\\\\": \\\\\"TEST\\\\\", \\\\\"name\\\\\": \\\\\"TEST\\\\\", \\\\\"groups\\\\\": [{\\\\\"name\\\\\": \\\\\"Zabbix servers\\\\\"}], \\\\\"uuid\\\\\": \\\\\"e4ad7acc1a804011b7b8161663e1f31b\\\\\"}], \\\\\"version\\\\\": \\\\\"5.4\\\\\", \\\\\"groups\\\\\": [{\\\\\"name\\\\\": \\\\\"Zabbix servers\\\\\", \\\\\"uuid\\\\\": \\\\\"6f6799aa69e844b4b3918f779f2abf08\\\\\"}]}}\", \"format\": \"json\"}, \"jsonrpc\": \"2.0\", \"method\": \"configuration.import\", \"auth\": \"cf1bfe0a922dcf8557e01508d76115c5\", \"id\": 3}', -32602)", "item": {"atime": 1622212098.9111104, "ctime": 1622211877.3982384, "dev": 2053, "gid": 1000, "gr_name": "", "inode": 698318, "isblk": false, "ischr": false, "isdir": false, "isfifo": false, "isgid": false, "islnk": false, "isreg": true, "issock": false, "isuid": false, "mode": "0664", "mtime": 1622211877.3902378, "nlink": 1, "path": "/etc/ansible/enlite/files/zabbix/templates/testtemplate.json", "pw_name": "", "rgrp": true, "roth": true, "rusr": true, "size": 344, "uid": 1000, "wgrp": true, "woth": false, "wusr": true, "xgrp": false, "xoth": false, "xusr": false}, "msg": "Unable to import template"}
r/zabbix
r/zabbix
This subreddit is private as part of a joint protest to Reddit’s recent API changes, which breaks third-party apps and moderation tools, effectively forcing users to use the official Reddit app.
Members
Online
•
by
sphtd
SUMMARY
When using zabbix_template to import a template to a zabbix 5.4 API, setting «state: present» on a template that does not yet exist gives an error about:
ZabbixAPIException: (u’Error -32602: Invalid params., Invalid parameter «/rules»: unexpected parameter «applications»
ISSUE TYPE
- Bug Report
COMPONENT NAME
community.zabbix.zabbix_template
ANSIBLE VERSION
ansible 2.9.16
config file = /etc/ansible/ansible.cfg
configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python2.7/site-packages/ansible
executable location = /usr/bin/ansible
python version = 2.7.5 (default, Nov 16 2020, 22:23:17) [GCC 4.8.5 20150623 (Red Hat 4.8.5-44)]
CONFIGURATION
ANSIBLE_PIPELINING(/etc/ansible/ansible.cfg) = True
COMMAND_WARNINGS(/etc/ansible/ansible.cfg) = False
DEFAULT_HOST_LIST(/etc/ansible/ansible.cfg) = [u'/etc/ansible/hosts']
DEFAULT_PRIVATE_KEY_FILE(/etc/ansible/ansible.cfg) = /etc/ansible/enlite/files/ssh
DEFAULT_VAULT_IDENTITY_LIST(/etc/ansible/ansible.cfg) = [u'enlite@~/.vault-pass.common']
DEPRECATION_WARNINGS(/etc/ansible/ansible.cfg) = False
HOST_KEY_CHECKING(/etc/ansible/ansible.cfg) = False
OS / ENVIRONMENT / Zabbix Version
Zabbix 5.4
STEPS TO REPRODUCE
Try to import a template that does not currently exist. It actually succeeds if the template already exists.
- name: Zabbix API - Importing all templates community.zabbix.zabbix_template: server_url: "https://{{ cert_domain }}.{{ domain }}/api_jsonrpc.php" login_user: Admin login_password: "{{ services.zabbix_web.admin_password }}" template_json: "{{ lookup('file', '/etc/ansible/enlite/files/zabbix/templates/testtemplate.json') }}" state: present
{ "zabbix_export": { "groups": [ { "name": "Zabbix servers", "uuid": "6f6799aa69e844b4b3918f779f2abf08" } ], "templates": [ { "groups": [ { "name": "Zabbix servers" } ], "name": "TEST", "template": "TEST", "uuid": "e4ad7acc1a804011b7b8161663e1f31b" } ], "version": "5.4" } }
EXPECTED RESULTS
Successful import, which I think looks like:
ok: [localhost] => (item={u’rusr’: True, u’uid’: 1000, u’rgrp’: True, u’xoth’: False, u’islnk’: False, u’woth’: False, u’nlink’: 1, u’issock’: False, u’mtime’: 1622211877.3902378, u’gr_name’: u», u’path’: u’/etc/ansible/enlite/files/zabbix/templates/testtemplate.json’, u’xusr’: False, u’atime’: 1622212098.9111104, u’inode’: 698318, u’isgid’: False, u’size’: 344, u’isdir’: False, u’wgrp’: True, u’ctime’: 1622211877.3982384, u’isblk’: False, u’xgrp’: False, u’isuid’: False, u’dev’: 2053, u’roth’: True, u’isreg’: True, u’isfifo’: False, u’mode’: u’0664′, u’pw_name’: u», u’gid’: 1000, u’ischr’: False, u’wusr’: True})
though I can only get that to work when the template already exists.
ACTUAL RESULTS
Import fails and complains abou t
Invalid parameter «/rules»: unexpected parameter «applications»
Note: «applications» is no longer part of zabbix 5.4 templates. I assume this needs updating.
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ZabbixAPIException: (u'Error -32602: Invalid params., Invalid parameter "/rules": unexpected parameter "applications". while sending {"params": {"rules": {"templates": {"createMissing": true, "updateExisting": true}, "valueMaps": {"createMissing": true, "updateExisting": true}, "httptests": {"createMissing": true, "deleteMissing": true, "updateExisting": true}, "templateLinkage": {"createMissing": true, "deleteMissing": true}, "applications": {"createMissing": true, "deleteMissing": true}, "groups": {"createMissing": true}, "triggers": {"createMissing": true, "deleteMissing": true, "updateExisting": true}, "items": {"createMissing": true, "deleteMissing": true, "updateExisting": true}, "graphs": {"createMissing": true, "deleteMissing": true, "updateExisting": true}, "discoveryRules": {"createMissing": true, "deleteMissing": true, "updateExisting": true}, "templateDashboards": {"createMissing": true, "deleteMissing": true, "updateExisting": true}}, "source": "{\"zabbix_export\": {\"templates\": [{\"template\": \"TEST\", \"name\": \"TEST\", \"groups\": [{\"name\": \"Zabbix servers\"}], \"uuid\": \"e4ad7acc1a804011b7b8161663e1f31b\"}], \"version\": \"5.4\", \"groups\": [{\"name\": \"Zabbix servers\", \"uuid\": \"6f6799aa69e844b4b3918f779f2abf08\"}]}}", "format": "json"}, "jsonrpc": "2.0", "method": "configuration.import", "auth": "cf1bfe0a922dcf8557e01508d76115c5", "id": 3}', -32602)
failed: [localhost] (item={u'rusr': True, u'uid': 1000, u'rgrp': True, u'xoth': False, u'islnk': False, u'woth': False, u'nlink': 1, u'issock': False, u'mtime': 1622211877.3902378, u'gr_name': u'', u'path': u'/etc/ansible/enlite/files/zabbix/templates/testtemplate.json', u'xusr': False, u'atime': 1622212098.9111104, u'inode': 698318, u'isgid': False, u'size': 344, u'isdir': False, u'wgrp': True, u'ctime': 1622211877.3982384, u'isblk': False, u'xgrp': False, u'isuid': False, u'dev': 2053, u'roth': True, u'isreg': True, u'isfifo': False, u'mode': u'0664', u'pw_name': u'', u'gid': 1000, u'ischr': False, u'wusr': True}) => {"ansible_loop_var": "item", "changed": false, "details": "(u'Error -32602: Invalid params., Invalid parameter "/rules": unexpected parameter "applications". while sending {"params": {"rules": {"templates": {"createMissing": true, "updateExisting": true}, "valueMaps": {"createMissing": true, "updateExisting": true}, "httptests": {"createMissing": true, "deleteMissing": true, "updateExisting": true}, "templateLinkage": {"createMissing": true, "deleteMissing": true}, "applications": {"createMissing": true, "deleteMissing": true}, "groups": {"createMissing": true}, "triggers": {"createMissing": true, "deleteMissing": true, "updateExisting": true}, "items": {"createMissing": true, "deleteMissing": true, "updateExisting": true}, "graphs": {"createMissing": true, "deleteMissing": true, "updateExisting": true}, "discoveryRules": {"createMissing": true, "deleteMissing": true, "updateExisting": true}, "templateDashboards": {"createMissing": true, "deleteMissing": true, "updateExisting": true}}, "source": "{\\"zabbix_export\\": {\\"templates\\": [{\\"template\\": \\"TEST\\", \\"name\\": \\"TEST\\", \\"groups\\": [{\\"name\\": \\"Zabbix servers\\"}], \\"uuid\\": \\"e4ad7acc1a804011b7b8161663e1f31b\\"}], \\"version\\": \\"5.4\\", \\"groups\\": [{\\"name\\": \\"Zabbix servers\\", \\"uuid\\": \\"6f6799aa69e844b4b3918f779f2abf08\\"}]}}", "format": "json"}, "jsonrpc": "2.0", "method": "configuration.import", "auth": "cf1bfe0a922dcf8557e01508d76115c5", "id": 3}', -32602)", "item": {"atime": 1622212098.9111104, "ctime": 1622211877.3982384, "dev": 2053, "gid": 1000, "gr_name": "", "inode": 698318, "isblk": false, "ischr": false, "isdir": false, "isfifo": false, "isgid": false, "islnk": false, "isreg": true, "issock": false, "isuid": false, "mode": "0664", "mtime": 1622211877.3902378, "nlink": 1, "path": "/etc/ansible/enlite/files/zabbix/templates/testtemplate.json", "pw_name": "", "rgrp": true, "roth": true, "rusr": true, "size": 344, "uid": 1000, "wgrp": true, "woth": false, "wusr": true, "xgrp": false, "xoth": false, "xusr": false}, "msg": "Unable to import template"}
Некорректное значение «‘44569′» для поля целого положительного числа «resourceid».
Возвращает движок zabbix при вставке счетчика в таблицу аудита. Из-за чего конкретно оно падает неясно, для подробностей нужно включать отладку (добавить текущего пользователя в группу Enabled debug mode, затем нажать Debug внизу справа) и смотреть на реальные данные.
https://github.com/zabbix/zabbix/blob/1a62a05acd4276e2dfd4e6baab1ff3443c4cbb96/ui/include/classes/db/DB.php#L396
Также необходимо убедиться, что со схемой базы все в порядке. Сделать бекап, затем выполнить для MySQL:
ALTER TABLE auditlog MODIFY COLUMN resourceid bigint unsigned DEFAULT NULL;
На чистой установке я все еще не могу воспроизвести.
Attempting to import an XML configuration for a web scenario + trigger template using the Zabbix API, but the import fails when verifying the trigger.
Here are the details of the request being made to the API and the error returned:
failed: [127.0.0.1] (item=services/website.xml.j2) => { "access_control_allow_headers": "Content-Type", "access_control_allow_methods": "POST", "access_control_allow_origin": "*", "access_control_max_age": "1000", "changed": false, "connection": "close", "content_length": "207", "content_type": "application/json", "date": "Tue, 14 Mar 2017 10:00:42 GMT", "failed": true, "failed_when_result": true, "invocation": { "module_args": { "backup": null, "body": { "auth": "f07beb1227557c992d8f6c395b48d0a7", "id": "24402", "jsonrpc": 2.0, "method": "configuration.import", "params": { "format": "xml", "rules": { "applications": { "createMissing": true, "deleteMissing": true, "updateExisting": true }, "groups": { "createMissing": true }, "items": { "createMissing": true, "deleteMissing": true, "updateExisting": true }, "templates": { "createMissing": true, "updateExisting": true }, "triggers": { "createMissing": true, "deleteMissing": true, "updateExisting": true } }, "source": "<?xml version="1.0" encoding="UTF-8"?>n<zabbix_export>n <version>3.2</version>n <date>2017-03-12T12:26:11Z</date>n <groups>n <group>n <name>ansible-zabbix/templates</name>n </group>n </groups>n <templates>n <template>n <template>templates_website_check</template>n <name>templates_website_check</name>n <description/>n <groups>n <group>n <name>ansible-zabbix/templates</name>n </group>n </groups>n <applications>n <application>n <name>WEBSITE</name>n </application>n </applications>n <items/>n <discovery_rules/>n <httptests>n <httptest>n <name>website_check</name>n <application>n <name>WEBSITE</name>n </application>n <delay>60</delay>n <attempts>1</attempts>n <agent>Zabbix</agent>n <http_proxy/>n <variables/>n <headers/>n <status>0</status>n <authentication>0</authentication>n <http_user/>n <http_password/>n <verify_peer>0</verify_peer>n <verify_host>0</verify_host>n <ssl_cert_file/>n <ssl_key_file/>n <ssl_key_password/>n <steps>n <step>n <name>website_health</name>n <url>{HOST.HOST}</url>n <posts/>n <variables/>n <headers/>n <follow_redirects>1</follow_redirects>n <retrieve_mode>0</retrieve_mode>n <timeout>300</timeout>n <required/>n <status_codes>200</status_codes>n </step>n </steps>n </httptest>n </httptests>n <macros/>n <templates/>n <screens/>n </template>n </templates>n <triggers>n <trigger>n <expression>{templates_website_check:web.test.fail[website_check].sum(#5)}>2</expression>n <recovery_mode>0</recovery_mode>n <recovery_expression/>n <name>Greater than 60% failures on {HOST.HOST} for web scenario website_check</name>n <correlation_mode>0</correlation_mode>n <correlation_tag/>n <url/>n <status>0</status>n <priority>4</priority> <description/>n <type>0</type>n <manual_close>0</manual_close>n <dependencies/>n <tags/>n </trigger>n </triggers>n</zabbix_export>n" } }, "body_format": "json", "content": null, "creates": null, "delimiter": null, "dest": null, "directory_mode": null, "follow": false, "follow_redirects": "safe", "force": false, "force_basic_auth": false, "group": null, "headers": { "Content-Type": "application/json" }, "http_agent": "ansible-httpget", "method": "POST", "mode": null, "owner": null, "regexp": null, "remote_src": null, "removes": null, "return_content": false, "selevel": null, "serole": null, "setype": null, "seuser": null, "src": null, "status_code": [ 200 ], "timeout": 30, "unsafe_writes": null, "url": "http:, "url_password": null, "url_username": null, "use_proxy": true, "validate_certs": true }, "module_name": "uri" }, "item": "services/website.xml.j2", "json": { "error": { "code": -32602, "data": "Incorrect item key "web.test.fail[website_check]" provided for trigger expression on "templates_website_check".", "message": "Invalid params." }, "id": "24402", "jsonrpc": "2.0" }, "msg": "OK (207 bytes)", "redirected": false, "server": "Apache/2.4.6 (CentOS) PHP/5.4.16", "status": 200, "url": "http:, "x_powered_by": "PHP/5.4.16" }
And here is what the XML looks like before being serialized into a string:
<?xml version="1.0" encoding="UTF-8"?> <zabbix_export> <version>3.2</version> <date>2017-03-12T12:26:11Z</date> <groups> <group> <name>ansible-zabbix/templates</name> </group> </groups> <templates> <template> <template>templates_website_check</template> <name>templates_website_check</name> <description/> <groups> <group> <name>ansible-zabbix/templates</name> </group> </groups> <applications> <application> <name>WEBSITE</name> </application> </applications> <items/> <discovery_rules/> <httptests> <httptest> <name>website_check</name> <application> <name>WEBSITE</name> </application> <delay>60</delay> <attempts>1</attempts> <agent>Zabbix</agent> <http_proxy/> <variables/> <headers/> <status>0</status> <authentication>0</authentication> <http_user/> <http_password/> <verify_peer>0</verify_peer> <verify_host>0</verify_host> <ssl_cert_file/> <ssl_key_file/> <ssl_key_password/> <steps> <step> <name>website_health</name> <url>{HOST.HOST}</url> <posts/> <variables/> <headers/> <follow_redirects>1</follow_redirects> <retrieve_mode>0</retrieve_mode> <timeout>300</timeout> <required/> <status_codes>200</status_codes> </step> </steps> </httptest> </httptests> <macros/> <templates/> <screens/> </template> </templates> <triggers> <trigger> <expression>{templates_website_check:web.test.fail[website_check].sum(#5)}>2</expression> <recovery_mode>0</recovery_mode> <recovery_expression/> <name>Greater than 60% failures on {HOST.HOST} for web scenario website_check</name> <correlation_mode>0</correlation_mode> <correlation_tag/> <url/> <status>0</status> <priority>4</priority> <description/> <type>0</type> <manual_close>0</manual_close> <dependencies/> <tags/> </trigger> </triggers> </zabbix_export>
The XML should be ok as I manually created the template with web scenario and trigger on an existing Zabbix server then exported the XML from there.
I can also import this XML successfully using the Zabbix frontend, but when trying to import through the API it fails.
iadmin, Привет.
Да есть такое на версии выше 4
в новой версии так
<trigger>
<uuid>c783272bb4d04ed681e503dc6cf66287</uuid>
<expression>last(/MySQL by Zabbix agent/agent.ping)=0</expression>
<name>test</name>
<dependencies>
<dependency>
<name>NoPingAgent {HOST.NAME}</name>
<expression>nodata(/MySQL by Zabbix agent/agent.ping,6m)=1</expression>
</dependency>
</dependencies>
</trigger>
</triggers>
в версии 4,2
<name>NoPingAgent {HOST.NAME}</name>
<expression>{Template OS Windows:agent.ping.nodata(6m)}=1</expression>
можно конечно попробовать Массово найти и заменить например через нотепад++
и может повезёт и он загрузится
замена на такой вид
nodata(/Template OS Windows/agent.ping,6m)=1
убери эту зависимость
<name>NoPingAgent {HOST.NAME}</name>
<expression>{Template OS Windows:agent.ping.nodata(6m)}=1</expression>
Полностью из всего шаблона.
Позже сделаю клон и уберу зависимости и выгружу без зависимостей.
Go to zabbix
r/zabbix
Zabbix is the ultimate enterprise-level software designed for real-time monitoring of millions of metrics collected from tens of thousands of servers, virtual machines and network devices.
Zabbix is Open Source and comes at no cost.
Online
•
Can’t import template
Hi, when trying to import https://share.zabbix.com/network_devices/aruba/aruba-2930f template, I get
«Template cannot be linked to another template more than once even through other templates.: