community.zabbix icon indicating copy to clipboard operation
community.zabbix copied to clipboard

Can't set the "zbx_trigger_color" and "zbx_trigger_draw_style"

Open dutrajulio opened this issue 9 months ago • 0 comments

SUMMARY

Trying to create a map with custom colors and draw styles for node link triggers.

ISSUE TYPE

When add "zbx_trigger_color" and/or "zbx_trigger_draw_style" attributes to a link the following error is returned.

"msg": "Failed to parse zbx_trigger='#FFFF00': not enough values to unpack (expected 2, got 1)"
COMPONENT NAME

community.zabbix.zabbix_map

ANSIBLE VERSION
ansible [core 2.15.3]
  config file = None
  configured module search path = ['/home/user/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.11/site-packages/ansible
  ansible collection location = /home/user/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.11.5 (main, Sep  2 2023, 14:16:33) [GCC 13.2.1 20230801] (/usr/bin/python)
  jinja version = 3.1.2
  libyaml = True
CONFIGURATION
CONFIG_FILE() = None
EDITOR(env: EDITOR) = vim
PAGER(env: PAGER) = less
OS / ENVIRONMENT / Zabbix Version

CentOS 8 Stream

STEPS TO REPRODUCE

Try to create a map using the following template.

graph {
  "node1" [zbx_host="node1", zbx_label="{HOST.HOST}"]
  "node2" [zbx_host="node2", zbx_label="{HOST.HOST}"]
  "node3"
  "node4"

  "node1" -- "node2" [zbx_trigger="node1:Generic SNMP: Unavailable by ICMP ping", zbx_trigger_color="#FFFF00", zbx_trigger_draw_style="dotted"]
}
- name: Creating Site map
  community.zabbix.zabbix_map:
    name: "Map"
    state: present
    width: 1920
    height: 1080
    data: "{{ lookup('template', 'map.gv') }}"
    label_type: label
  become: false
EXPECTED RESULTS

Map created with success, and links between nodes correctly configured with parametrized colors and/or draw styles.

ACTUAL RESULTS

The task failed with the following error.

TASK [zabbix : Creating Site map] *************************************************************************************************************
task path: /home/user/map.yml:8
File lookup using /home/user/Downloads/map.gv as file
redirecting (type: connection) ansible.builtin.httpapi to ansible.netcommon.httpapi
Loading collection ansible.netcommon from /usr/lib/python3.11/site-packages/ansible_collections/ansible/netcommon
Loading collection ansible.utils from /usr/lib/python3.11/site-packages/ansible_collections/ansible/utils
<server> attempting to start connection
<server> using connection plugin ansible.netcommon.httpapi
Found ansible-connection at path /usr/bin/ansible-connection
<server> local domain socket does not exist, starting it
<server> control socket path is /home/user/.ansible/pc/8f6e548a64
<server> Loading collection ansible.builtin from
<server> redirecting (type: connection) ansible.builtin.httpapi to ansible.netcommon.httpapi
<server> Loading collection ansible.netcommon from /usr/lib/python3.11/site-packages/ansible_collections/ansible/netcommon
<server> Loading collection ansible.utils from /usr/lib/python3.11/site-packages/ansible_collections/ansible/utils
<server> Loading collection community.zabbix from /usr/lib/python3.11/site-packages/ansible_collections/community/zabbix
<server> local domain socket listeners started successfully
<server> loaded API plugin ansible_collections.community.zabbix.plugins.httpapi.zabbix from path /usr/lib/python3.11/site-packages/ansible_collections/community/zabbix/plugins/httpapi/zabbix.py for platform type community.zabbix.zabbix
<server> Loading collection ansible.builtin from
<server> local domain socket path is /home/user/.ansible/pc/8f6e548a64
<server> ESTABLISH LOCAL CONNECTION FOR USER: user
<server> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/user/.ansible/tmp/ansible-local-174631470h2coyi `"&& mkdir "` echo /home/user/.ansible/tmp/ansible-local-174631470h2coyi/ansible-tmp-1694632765.353612-1746424-47626050795933 `" && echo ansible-tmp-1694632765.353612-1746424-47626050795933="` echo /home/user/.ansible/tmp/ansible-local-174631470h2coyi/ansible-tmp-1694632765.353612-1746424-47626050795933 `" ) && sleep 0'
Using module file /usr/lib/python3.11/site-packages/ansible_collections/community/zabbix/plugins/modules/zabbix_map.py
<server> PUT /home/user/.ansible/tmp/ansible-local-174631470h2coyi/tmprf8vrpg7 TO /home/user/.ansible/tmp/ansible-local-174631470h2coyi/ansible-tmp-1694632765.353612-1746424-47626050795933/AnsiballZ_zabbix_map.py
<server> EXEC /bin/sh -c 'chmod u+x /home/user/.ansible/tmp/ansible-local-174631470h2coyi/ansible-tmp-1694632765.353612-1746424-47626050795933/ /home/user/.ansible/tmp/ansible-local-174631470h2coyi/ansible-tmp-1694632765.353612-1746424-47626050795933/AnsiballZ_zabbix_map.py && sleep 0'
<server> EXEC /bin/sh -c '/usr/bin/python /home/user/.ansible/tmp/ansible-local-174631470h2coyi/ansible-tmp-1694632765.353612-1746424-47626050795933/AnsiballZ_zabbix_map.py && sleep 0'
<server> EXEC /bin/sh -c 'rm -f -r /home/user/.ansible/tmp/ansible-local-174631470h2coyi/ansible-tmp-1694632765.353612-1746424-47626050795933/ > /dev/null 2>&1 && sleep 0'
The full traceback is:
  File "/tmp/ansible_community.zabbix.zabbix_map_payload_njndjq0g/ansible_community.zabbix.zabbix_map_payload.zip/ansible_collections/community/zabbix/plugins/modules/zabbix_map.py", line 633, in _get_trigger_id
fatal: [ita-srvzbx01]: FAILED! => {
    "changed": false,
    "invocation": {
        "module_args": {
            "data": "graph {\n  \"node1\"\n  \"node1\" [zbx_host=\"node1\", zbx_label=\"{HOST.HOST}\"]\n  \"node2\" [zbx_host=\"node2\", zbx_label=\"{HOST.HOST}\"]\n\n  \"node2\"\n  \"node1\" -- \"node2\" [zbx_trigger=\"node1:Generic SNMP: Unavailable by ICMP ping\", zbx_trigger_color=\"#FFFF00\", zbx_trigger_draw_style=\"dotted\"]\n}\n",
            "default_image": "Server_(64)",
            "expand_problem": true,
            "height": 1080,
            "highlight": true,
            "http_login_password": null,
            "http_login_user": null,
            "label_type": "label",
            "margin": 40,
            "name": "Map",
            "state": "present",
            "width": 1920
        }
    },
    "msg": "Failed to parse zbx_trigger='#FFFF00': not enough values to unpack (expected 2, got 1)"
}

dutrajulio avatar Sep 13 '23 19:09 dutrajulio