Ad Widget

Collapse

Cloudflare authentication error

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • seventhsite
    Junior Member
    • Nov 2022
    • 5

    #1

    Cloudflare authentication error

    Hi!
    I created API token for Zabbix monitoring with this permissions and my Zabbix server external IP:



    But get an errors in Zabbix server log like:

    Code:
    error reason for "cloudflare:cloudflare.uniques.all" changed: Cannot execute script: Requesting failed: Request failed with status code 401: {"success":false,"errors":[{"code":10000,"message":"Authentication error"}]}

    If I remove IP address filterring from Cloudflare I get another errors:

    Code:
    error reason for "cloudflare:cloudflare.bandwidth.ssl.unencrypted" changed: Preprocessing failed for: {}
    1. Failed: cannot extract value from json by path "$.bandwidth.unencrypted": no data matches the specified path zz0.e614ouhot8hzz
    So, looks like my API token and Zone ID is ok, but
    1. Something wrong with IP. But I successfully test it with curl to https://api.cloudflare.com/client/v4/user/token... from the Zabbix server ssh console. Zabbix server is in docker container, if it depends. Is there any way to debug template requests?
    2. Even if I will solve IP problem, looks like API answers is not processed by template. I think it may depend on API permissions. Do I need to add some?
    Thank you in advance!​
  • wessel21
    Junior Member
    • Nov 2022
    • 4

    #2
    Since longer Zabbix is no more able to collect information from the Cloudflare API.
    When I check the validity of my token I will get this:​

    Code:
    curl -X GET “https://api.cloudflare.com/client/v4/user/tokens/verify” -H “Authorization: Bearer ABC... ...XYZ” -H “Content-Type:application/json”
    {“result”:{“id”:“123... ...890”,“status”:“active”,“not_before”:“2022-08-05T00:00:00Z”,“expires_on”:“2024-07-31T23:59:59Z”},“success”:true,“errors”:[],“messages”:
       [{“code”:10000,“message”:“This API Token is valid and active”,“type”:null}]}
    so I set the Zabbix server debug level to max, performed a test and grabbed this from the logs:

    Code:
    920905:20230913:011301.633 Item [:cloudflare.get] error: Cannot execute script: Requesting failed: Request failed with status code 401:
       {"success":false,"errors":[{"code":10000,"message":"Authentication error"}]}
    (the full text is in the attachment; the \r\n sequences were replaced by LF for readability)

    I suspect: something changed that the current template does not work.
    Maybe I did miss something else; if there is a hint I'd be thankful.​
    Attached Files
    Last edited by wessel21; 21-09-2023, 08:31.

    Comment

    Working...