Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zabbix_action - failed when create discovery action based on event_source=discovery, conditions.type=discovery_check and dchecks.type=Zabbix (Zabbix agent) #1409

Open
Yuskovich opened this issue Oct 25, 2024 · 0 comments

Comments

@Yuskovich
Copy link

Yuskovich commented Oct 25, 2024

SUMMARY

Creating discovery action with conditions.type=discovery_check and dchecks.type=Zabbix throw error. I look into zabbix_action module's code and there is no logic for distinguishing between discovery checks type "Zabbix" with different keys.

One discovery rule can have many checks with same type - "Zabbix agent", but with different keys. Current zabbix_action module's logic suggests only one discovery check with type "Zabbix agent" in rule. There is no way distinguish different "Zabbix agent" checks with different keys.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

Module: zabbix_action.

ANSIBLE VERSION

ansible 10.5.0 [core 2.7,5]

CONFIGURATION

for security reasons I can't, but I carefully check - problem not correlated with any information in this output

OS / ENVIRONMENT / Zabbix Version

Ubuntu 20.04.6
Python 3.12
Zabbix server: 7.0.2

STEPS TO REPRODUCE
- name: Create discovery rules
  become: false
  community.zabbix.zabbix_discovery_rule:
    name: "roles discovery"
    state: present
    iprange: "192.168.0.0/23"
    dchecks:
        - type: Zabbix
          key: "agent.hostname"
          ports: 10050
          host_source: "discovery"
        - type: Zabbix
          key: "docker.info"
          ports: 10050
        - type: Zabbix
          key: "system.hw.chassis"
          ports: 10050
        - type: Zabbix
          key: "system.uname"
          ports: 10050
        - type: Zabbix
          key: "vfs.file.contents[/sys/module/zfs/version]"
          ports: 10050
    proxy: "proxy1"
    status: "enabled"

- name: Create discovery actions
  become: false
  community.zabbix.zabbix_action:
   name: "action 1"
   eval_type: andor
   event_source: discovery
   state: present
   status: enabled
   conditions:
     - type: discovery_check
       operator: equals
       value: 'roles discovery: Zabbix agent "docker.info"'
   operations:
     - type: link_to_template
       templates:
         - Docker by Zabbix agent 2
EXPECTED RESULTS

Task done without any errors and any fails. Discovery action created in Zabbix.

ACTUAL RESULTS

Task failed. No discovery action created in Zabbix.

TASK [zabbix-monitoring : Create discovery actions] ***************************************************************************************************************************************************************
fatal: [zabbix-server-01 -> monitoring.local]: FAILED! => {"changed": false, "msg": "Discovery check type: Zabbix agent \"docker.info\" does not exist"}
@Yuskovich Yuskovich changed the title zabbix_action - not work condition based on event_source=discovery, conditions.type=discovery_check and dchecks.type=Zabbix (Zabbix agent) zabbix_action - failed when create discovery action based on event_source=discovery, conditions.type=discovery_check and dchecks.type=Zabbix (Zabbix agent) Oct 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant