community.zabbix
community.zabbix copied to clipboard
Module: Implementation of zabbix_item
SUMMARY
This implements a new module, zabbix_item. This module controls the items contained by hosts.
ISSUE TYPE
- New Module Pull Request
COMPONENT NAME
zabbix_item
ADDITIONAL INFORMATION
- name: Create a new item or rewrite an existing item's info
community.zabbix.zabbix_item:
host_name: ExampleHost
item_name: ExampleItem
key: ExampleItem
description: My ExampleItem Description
type: zabbix_internal
value_type: text
status: enabled
state: present
tags:
- tag: ExampleItemTag
value: ExampleTagValue
- tag: ExampleItemTag2
value: ExampleTagValue
Regarding Issue #1203 "Request: Implement item module"
Hi, not sure why tests failed. Ran them again with a Ansible-docker container closer to the actions runner, all tests passed successfully..
Looks like they may have just died....restarted
@ljvdhooft you're getting an error during the test.
2024-04-28T03:56:11.7121231Z TASK [test_zabbix_item : test: change type simple_check] *********************** 2024-04-28T03:56:12.7610134Z [0;31mfatal: [testhost]: FAILED! => {"changed": false, "msg": "connection error occurred: REST API returned {'code': -32602, 'message': 'Invalid params.', 'data': 'No interface found.'} when sending {\"jsonrpc\": \"2.0\", \"method\": \"item.update\", \"id\": \"d34c2c4d-7ee0-47dc-8e43-5d75d265b13e\", \"params\": {\"itemid\": \"44635\", \"status\": 0, \"name\": \"ExampleItem1\", \"type\": 3, \"delay\": \"10s\", \"authtype\": 0, \"status_codes\": \"200\", \"tags\": [], \"preprocessing\": []}, \"auth\": \"d6b5801300b78af276a9524821568642\"}"}[0m
This probably has to do with some parameters that are not suitable for all item types. This makes testing a bit difficult. The way it is setup right now is that it makes only one item and changes the type of that item until all items were in use. However, by not setting a specific parameter, this remains set in the Zabbix config making it unable to change to another type of item.
I think it would make more sense to make a new item for each type, since that would be the more practical case too. Would tests like this qualify for a PR?
That is totally ok.