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 v2 #449

Closed
ghost opened this issue Sep 21, 2017 · 0 comments · Fixed by #450
Closed

Zabbix API errors when adding Templates in Zabbix 3.4 v2 #449

ghost opened this issue Sep 21, 2017 · 0 comments · Fixed by #450

Comments

@ghost
Copy link

ghost commented Sep 21, 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 { 'Template App BeeFGS Metadata Service':
    templ_source => 'puppet:///modules/webtech/zabbix/template/beegfs_metadata_service.xml',
  }

What are you seeing

Error: Could not set 'present' on ensure: Server answer API error
 {
  "code": -32602,
  "message": "Invalid params.",
  "data": "Invalid parameter \"/rules/applications\": unexpected parameter \"updateExisting\"."
}
 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
      },
      "images": {
        "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-28T15:08:09Z</date>\n    <groups>\n        <group>\n            <name>Templates</name>\n        </group>\n    </groups>\n    <templates>\n        <template>\n            <template>Template App BeeGFS Metadata Service</template>\n            <name>Template App BeeGFS Metadata Service</name>\n            <description/>\n            <groups>\n                <group>\n                    <name>Templates</name>\n                </group>\n            </groups>\n            <applications>\n                <application>\n                    <name>BeeGFS Metadata Server</name>\n                </application>\n            </applications>\n            <items>\n                <item>\n                    <name>BeeGFS Metadata service is running</name>\n                    <type>0</type>\n                    <snmp_community/>\n                    <multiplier>0</multiplier>\n                    <snmp_oid/>\n                    <key>net.tcp.listen[8005]</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 Metadata 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 Metadata Service:net.tcp.listen[8005].max(3)}=0</expression>\n            <recovery_mode>0</recovery_mode>\n            <recovery_expression/>\n            <name>BeeGFS Metadata 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": 72941,
  "jsonrpc": "2.0",
  "auth": "7f36f92dbb5cbc70d06bdb831e09b521"
} 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. And also my not catching this error in my last issue or PR.

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

Successfully merging a pull request may close this issue.

0 participants