Open angristan opened 9 months ago
Fix for https://github.com/trazfr/freebox-exporter/issues/3:
collector.go:346: json: cannot unmarshal object into Go struct field MetricsFreeboxSwitchStatus.result.mac_list of type []*struct { Mac string "json:\"mac\""; Hostname string "json:\"hostname\"" }
Full response for reference:
{ "success": true, "result": [ { "duplex": "full", "mac_list": [ { "mac": "xx:xx:xx:xx:xx:xx", "hostname": "some device :)" } ], "name": "Ethernet 1", "link": "up", "id": 1, "mode": "100BaseTX-FD", "speed": "100", "rrd_id": "1" }, { "duplex": "full", "mac_list": [ { "mac": "xx:xx:xx:xx:xx:xx", "hostname": "some device :)" } ], "name": "Ethernet 2", "link": "up", "id": 2, "mode": "100BaseTX-FD", "speed": "100", "rrd_id": "2" }, { "duplex": "full", "mac_list": [ { "mac": "xx:xx:xx:xx:xx:xx", "hostname": "some device :)" }, { "mac": "xx:xx:xx:xx:xx:xx", "hostname": "some device :)" }, { "mac": "xx:xx:xx:xx:xx:xx", "hostname": "some device :)" }, { "mac": "xx:xx:xx:xx:xx:xx", "hostname": "some device :)" }, { "mac": "xx:xx:xx:xx:xx:xx", "hostname": "some device :)" } ], "name": "Ethernet 3", "link": "up", "id": 3, "mode": "1000BaseT-FD", "speed": "1000", "rrd_id": "3" }, { "duplex": "full", "mac_list": [ { "mac": "xx:xx:xx:xx:xx:xx", "hostname": "some device :)" } ], "name": "Ethernet 4", "link": "up", "id": 4, "mode": "100BaseTX-FD", "speed": "100", "rrd_id": "4" }, { "duplex": "half", "name": "Freeplug", "link": "down", "id": 5, "mode": "10BaseT-HD", "speed": "10", "rrd_id": "freeplug" }, { "duplex": "auto", "mac_list": {}, // ISSUE HERE "name": "Sfp lan", "link": "down", "id": 9999, "mode": "1000BaseT-FD", "speed": "1000", "rrd_id": "sfp_lan" } ] }
Fix for https://github.com/trazfr/freebox-exporter/issues/3:
Full response for reference: