Failed to parse response received from Meraki API. Check debug log for more information.

Solved
eugene_dev
Comes here often

Failed to parse response received from Meraki API. Check debug log for more information.

Hey community, i have an issue with applying

Cisco Meraki device by HTTP

zabbix template to hosts, error is following:

Failed to parse response received from Meraki API. Check debug log for more information.

Response code "400" did not match any of the required status codes "200"

<html>

<head>

<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"/>

<title>Error 400 Illegal Path Character</title>

</head>

<body>

<h2>HTTP ERROR 400 Illegal Path Character</h2>

<table>

<tr><th>URI:</th><td>/badURI</td></tr>

<tr><th>STATUS:</th><td>400</td></tr>

<tr><th>MESSAGE:</th><td>Illegal Path Character</td></tr>

</table>

<hr/><a href="https://jetty.org/">Powered by Jetty:// 12.0.19</a><hr/>

All the neccessary macros {$MERAKI.API.URL} and {$MERAKI.TOKEN} for the host being already specified with corresponding values.

What am I doing wrong?

1 Accepted Solution
Oren
Meraki Employee
Meraki Employee

This looks like an Ansible playbook for Zabbix.
We support the Meraki Ansible collection. I assume the Zabbix community supports the Zabbix Ansible collection.

 

That said, you can use the API analytics page and download the API call log (preferably shortly after an attempt to run this playbook).
If the 400 error is coming from Meraki (and not Zabbix) - you'll be able to see the API call being made and probably find the reason it gets a 400 response back.
If you don't see the API call in the log, the 400 error might be coming from somewhere else, before an API call is made to Meraki.

View solution in original post

8 Replies 8
alemabrahao
Kind of a big deal

Make sure your URL looks like this: https://api.meraki.com/api/v1

 

You can test it with curl: curl -H "X-Cisco-Meraki-API-Key: YOUR_API_KEY" \ https://api.meraki.com/api/v1/organizations

I am not a Cisco Meraki employee. My suggestions are based on documentation of Meraki best practices and day-to-day experience.

Please, if this post was useful, leave your kudos and mark it as solved.
eugene_dev
Comes here often

i tried with https:// as well, however error is the same

alemabrahao
Kind of a big deal

Can you share your code?

Remember that the URL cannot have a trailing slash.

I am not a Cisco Meraki employee. My suggestions are based on documentation of Meraki best practices and day-to-day experience.

Please, if this post was useful, leave your kudos and mark it as solved.
eugene_dev
Comes here often

i'm adding hosts via ansible so the code is following:

    - name: add hosts to zabbix frontend
      community.zabbix.zabbix_host:
        host_name: "{{ item.name }}"
        visible_name: "{{ item.name }}"
        host_groups:
            - "{{ item.name[4:9] }}"
        link_templates:
          - Cisco Meraki device by HTTP
        macros:
          - macro: "{$MERAKI.TOKEN}"
            value: "{{MERAKI_TOKEN}}"
          - macro: "{$MERAKI.API.URL}"
            value: "https://api.meraki.com/api/v1"
        tags:
          - tag: Product Type
            value: "{{ item.productType }}"
          - tag: Serial number
            value: "{{ item.serial }}"
          - tag: Model
            value: "{{ item.model }}"
          - tag: Firmware
            value: "{{ item.firmware }}"
        status: enabled
        state: present
        monitored_by: proxy
        proxy:  "{{PROXY_NAME}}"
      loop: "{{ devices }}"



PhilipDAth
Kind of a big deal
Kind of a big deal

What is the final URL that it constructs when calling the API?

https://developer.cisco.com/meraki/api-v1/

 

eugene_dev
Comes here often

i guess the final url is :https://api.meraki.com/api/v1/organizations, can't find a way which url zabbix is using for requests, finally managed to successfully add the devices, gather its status and public IP, however problem maintains the same: Meraki: There are errors in 'Get device data' metric , and for "Device data item errors" item Last Value is : "Failed to parse response received from Meraki API. Check debug log for more information."

Oren
Meraki Employee
Meraki Employee

This looks like an Ansible playbook for Zabbix.
We support the Meraki Ansible collection. I assume the Zabbix community supports the Zabbix Ansible collection.

 

That said, you can use the API analytics page and download the API call log (preferably shortly after an attempt to run this playbook).
If the 400 error is coming from Meraki (and not Zabbix) - you'll be able to see the API call being made and probably find the reason it gets a 400 response back.
If you don't see the API call in the log, the 400 error might be coming from somewhere else, before an API call is made to Meraki.

eugene_dev
Comes here often

k

Get notified when there are additional replies to this discussion.