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 API errors when adding Templates in Zabbix 3.4 #446

Closed
ghost opened this issue Sep 20, 2017 · 3 comments
Closed

Zabbix API errors when adding Templates in Zabbix 3.4 #446

ghost opened this issue Sep 20, 2017 · 3 comments

Comments

@ghost
Copy link

ghost commented Sep 20, 2017

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: 4.10.5
  • Ruby: 2.3.1p112
  • Distribution: Ubuntu 16.04.3 LTS x64
  • Module version: 5.0.0

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

Define a template with manage_resources => true and run puppet agent -t

  zabbix::template { 'BeeGFS Storage Service':
    templ_source => 'xml/beegfs_storage.pp',
  }

What are you seeing

Error: Could not set 'present' on ensure: Server answer API error
 {
  "code": -32602,
  "message": "Invalid params.",
  "data": "Invalid parameter \"/rules\": unexpected parameter \"image\"."
}
 on request:
 {
  "method": "configuration.import",
  "params": {
    "format": "xml",
    "rules": {
      "applications": {
        "createMissing": true,
        "updateExisting": true
      },
      "discoveryRules": {
        "createMissing": true,
        "updateExisting": true
      },
      "graphs": {
        "createMissing": true,
        "updateExisting": true
      },
      "groups": {
        "createMissing": true
      },
      "image": {
        "createMissing": true,
        "updateExisting": true
      },
      "items": {
        "createMissing": true,
        "updateExisting": true
      },
      "maps": {
        "createMissing": true,
        "updateExisting": true
      },
      "screens": {
        "createMissing": true,
        "updateExisting": true
      },
      "templateLinkage": {
        "createMissing": true
      },
      "templates": {
        "createMissing": true,
        "updateExisting": true
      },
      "templateScreens": {
        "createMissing": true,
        "updateExisting": true
      },
      "triggers": {
        "createMissing": true,
        "updateExisting": true
      }
    },
    "source": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<zabbix_export>\n    <version>3.2</version>\n    <date>2017-08-28T20:45:07Z</date>\n    <groups>\n        <group>\n            <name>Templates</name>\n        </group>\n    </groups>\n    <templates>\n        <template>\n            <template>Template App BeeGFS Storage Service</template>\n            <name>Template App BeeGFS Storage Service</name>\n            <description/>\n            <groups>\n                <group>\n                    <name>Templates</name>\n                </group>\n            </groups>\n            <applications>\n                <application>\n                    <name>BeeGFS Storage Server</name>\n                </application>\n            </applications>\n            <items>\n                <item>\n                    <name>BeeGFS Storage service is running</name>\n                    <type>0</type>\n                    <snmp_community/>\n                    <multiplier>0</multiplier>\n                    <snmp_oid/>\n                    <key>net.tcp.listen[8003]</key>\n                    <delay>30</delay>\n                    <history>90</history>\n                    <trends>365</trends>\n                    <status>0</status>\n                    <value_type>3</value_type>\n                    <allowed_hosts/>\n                    <units/>\n                    <delta>0</delta>\n                    <snmpv3_contextname/>\n                    <snmpv3_securityname/>\n                    <snmpv3_securitylevel>0</snmpv3_securitylevel>\n                    <snmpv3_authprotocol>0</snmpv3_authprotocol>\n                    <snmpv3_authpassphrase/>\n                    <snmpv3_privprotocol>0</snmpv3_privprotocol>\n                    <snmpv3_privpassphrase/>\n                    <formula>1</formula>\n                    <delay_flex/>\n                    <params/>\n                    <ipmi_sensor/>\n                    <data_type>0</data_type>\n                    <authtype>0</authtype>\n                    <username/>\n                    <password/>\n                    <publickey/>\n                    <privatekey/>\n                    <port/>\n                    <description/>\n                    <inventory_link>0</inventory_link>\n                    <applications>\n                        <application>\n                            <name>BeeGFS Storage Server</name>\n                        </application>\n                    </applications>\n                    <valuemap>\n                        <name>Service state</name>\n                    </valuemap>\n                    <logtimefmt/>\n                </item>\n            </items>\n            <discovery_rules/>\n            <httptests/>\n            <macros/>\n            <templates/>\n            <screens/>\n        </template>\n    </templates>\n    <triggers>\n        <trigger>\n            <expression>{Template App BeeGFS Storage Service:net.tcp.listen[8003].max(3)}=0</expression>\n            <recovery_mode>0</recovery_mode>\n            <recovery_expression/>\n            <name>BeeGFS Storage service is down on {HOST.NAME}</name>\n            <correlation_mode>0</correlation_mode>\n            <correlation_tag/>\n            <url/>\n            <status>0</status>\n            <priority>4</priority>\n            <description/>\n            <type>0</type>\n            <manual_close>0</manual_close>\n            <dependencies/>\n            <tags/>\n        </trigger>\n    </triggers>\n    <value_maps>\n        <value_map>\n            <name>Service state</name>\n            <mappings>\n                <mapping>\n                    <value>0</value>\n                    <newvalue>Down</newvalue>\n                </mapping>\n                <mapping>\n                    <value>1</value>\n                    <newvalue>Up</newvalue>\n                </mapping>\n            </mappings>\n        </value_map>\n    </value_maps>\n</zabbix_export>\n"
  },
  "id": 10574,
  "jsonrpc": "2.0",
  "auth": "048c0c41a38afda42e752dc7e216c0ee"
} at /etc/puppetlabs/code/environments/development/modules/zabbix/manifests/resources/template.pp:29

What behaviour did you expect instead

The template to be added to Zabbix

Output log

Any additional information you'd like to impart

This appears to be caused by a combination of an incorrect parameter being sent to the Zabbix API (which has always been the case) and the Zabbix API doing strict parameter checking in version 3.4.

@ghost
Copy link
Author

ghost commented Sep 20, 2017

This is caused by the template provider sending image instead of images

@bastelfreak
Copy link
Member

@Breaker1 thanks for rising this issue. are you able to provide a PR for us with a fix?

@ghost
Copy link
Author

ghost commented Sep 21, 2017

Working on it, trying to make it less of a mess than my last PR.

This issue was closed.
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