voxpupuli / puppet-zabbix

Puppet module for creating and maintaining zabbix components with puppet.

Home Page:https://forge.puppet.com/puppet/zabbix

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ipaddress should be set to empty string if agent_use_ip is false

mergwyn opened this issue · comments

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: 6.25.0
  • Ruby: 2.5.9
  • Distribution: ubuntu 20.04
  • Module version: 9.1.0

How to reproduce (e.g Puppet code you use)

class { 'zabbix::agent':
    manage_resources     => true,
    agent_use_ip         => false,
}

What are you seeing

API error caused by ipaddress set to 0 rather than an empty string as per zabbix API docs

What behaviour did you expect instead

Successful API call

Output log

Error: /Stage[main]/Zabbix::Resources::Web/Zabbix_host[india.xxx]/ensure: change from 'absent' to 'present' failed: Could not set 'present' on ensure: Server answer API error
 {
  "code": -32602,
  "message": "Invalid params.",
  "data": "Incorrect arguments passed to function."
}
 on request:
 {
  "method": "host.create",
  "params": [
    {
      "host": "india.xxx",
      "interfaces": [
        {
          "type": 1,
          "main": 1,
          "ip": null,
          "dns": "india.xxx",
          "port": "10050",
          "useip": 0
        }
      ],
      "status": 0,
      "available": 1,
      "groups": [
        {
          "groupid": 2
        }
      ],
      "proxy_hostid": null,
      "templates": [
        {
          "templateid": 10391
        },
        {
          "templateid": 10351
        },
        {
          "templateid": 10336
        },
        {
          "templateid": 10380
        }
      ]
    }
  ],
  "id": 3027,
  "jsonrpc": "2.0",
  "auth": "4eb8de6f34fcd6f2501add2d704dcb84"
}

Any additional information you'd like to impart