MassimilianoPasquini97 / zbx_unifi_network

Zabbix Template for Unifi Network
MIT License
48 stars 10 forks source link

Cannot create host "Unifi USW {#NAME}": name contains invalid character '{'. #17

Closed rvanlieshout closed 5 months ago

rvanlieshout commented 5 months ago

Checklist

Describe the Bug

The discovery rules Unifi Network: API stat/device-basic: Device USW and Unifi Network: API stat/device-basic: Device UAP fail with a message that the name contains an invalid character

MACROS

Scherm­afbeelding 2024-04-09 om 09 55 11

Context

It might be because this is running Unifi OS. I'll try to debug in a short future to see what data it produces. Please let me know if you want me to perform some calls

rvanlieshout commented 5 months ago

Probleem seems that devices don't (always?) have a name

A vscode-restclient file:

@ip = 192.168.0.1
@username = zabbix
@password = ***
@auth_uri = api/auth/login
@uri = proxy/network/api/s/default/stat

# @name login
POST https://{{ip}}/{{auth_uri}}
Content-Type: application/json

{
    "username": "{{username}}",
    "password": "{{password}}"
}

###

@token = {{login.response.headers.Set-Cookie}}

GET https://{{ip}}/{{uri}}/device-basic

Shows:

{
  "meta": {
    "rc": "ok"
  },
  "data": [
    {
      "mac": "9c:05:d6:53:88:4a",
      "state": 1,
      "adopted": true,
      "disabled": false,
      "type": "udm",
      "model": "UDRULT",
      "in_gateway_mode": true,
      "name": "Cloud Gateway Ultra"
    },
    {
      "mac": "d8:b3:70:38:a6:38",
      "state": 1,
      "adopted": true,
      "disabled": false,
      "type": "usw",
      "model": "USL16PB",
      "in_gateway_mode": false
    },
    {
      "mac": "60:22:32:76:4c:05",
      "state": 1,
      "adopted": true,
      "disabled": false,
      "type": "uap",
      "model": "UAP6MP",
      "in_gateway_mode": false
    }
  ]
}
rvanlieshout commented 5 months ago

This is fixable by the user, so we might want to update the readme

The interface shows a name, but the api doesn't return one. If one changes the name and saves the api will return that new name. Even if you then change it back to the original (default) name it'll present that via the api

rvanlieshout commented 5 months ago

Also poe_good and poe_mode are not in the API response for the udm-device

rvanlieshout commented 5 months ago

I've been able to resolve this by disabling some entries and setting a name

MassimilianoPasquini97 commented 5 months ago

Hi @rvanlieshout, this is a duplicated issue, look at #16.