unifi icon indicating copy to clipboard operation
unifi copied to clipboard

json.Unmarshal(ugw): json: cannot unmarshal string into Go struct field SystemStats.system-stats.temps of type map[string]string

Open christoph-buente opened this issue 3 years ago • 5 comments

Hi i ran into this issue when running the unifi poller in docker:

json.Unmarshal(ugw): json: cannot unmarshal string into Go struct field SystemStats.system-stats.temps of type map[string]string

I enabled debug logs to check, and it looks like the temps field is an empty string. Not sure why that is, but it keeps the whole thing from working correctly.

{
"_id": "5dbadcxxxxxxxxxxxx4101c6f33",
"ip": "xxx.xxx.xxx.98",
"mac": "XX:XX:XX:XX:XX:XX",
"model": "UGW4",
"type": "ugw",
"version": "4.4.55.5377109",
"adopted": true,
"site_id": "5c653f14xxxxxxxxxxx72a9c",
"license_state": "registered",
"board_rev": 18,
"name": "USG",
"kernel_version": "3.10.107-UBNT",
"architecture": "mips64",
"model_incompatible": false,
"model_in_lts": false,
"model_in_eol": false,
"connected_at": 1616608597,
"provisioned_at": 1618489821,
"device_id": "5dbadcxxxxxxxxxxxx4101c6f33",
"state": 1,
"start_disconnected_millis": 1617836549326,
"last_seen": 1619452806,
"known_cfgversion": "6456170f42b3ed10",
"use_custom_config": false,
"start_connected_millis": 1617836549515,
"upgradable": false,
"adoptable_when_upgraded": false,
"rollupgrade": false,
"uptime": 1616358,
"_uptime": 1616358,
"locating": false,
"sys_stats": {
	"loadavg_1": "0.05",
	"loadavg_15": "0.13",
	"loadavg_5": "0.10",
	"mem_buffer": 51363840,
	"mem_total": 2089517056,
	"mem_used": 716029952
},
"system-stats": {
	"cpu": "6",
	"mem": "23",
	"temps": "",
	"uptime": "1350941"
},
"stat": {
	"gw": {
		"site_id": "5c653f1xxxxxxxxxc5772a9c",
		"o": "gw",
		"oid": "XX:XX:XX:XX:XX:XX",
		"gw": "XX:XX:XX:XX:XX:XX",
		"time": 1616608500000,
		"datetime": "2021-03-24T17:55:00Z",
		"duration": 2.8442E9,
		"lan-rx_packets": 2.5665939E8,
		"lan-rx_bytes": 1.89716820138E11,
		"lan-tx_packets": 2.68149976E8,
		"lan-tx_bytes": 2.0295825211E11,
		"wan-rx_packets": 2.86663081E8,
		"wan-rx_bytes": 2.31630196413E11,
		"wan-tx_packets": 2.68936271E8,
		"wan-tx_bytes": 2.13627880406E11,
		"lan-rx_dropped": 3958.0,
		"wan-rx_dropped": 69273.0
	}
},
"tx_bytes": 139274450613,
"rx_bytes": 169398902236,
"bytes": 308673352849,
"num_sta": 16,
"user-num_sta": 16,
"guest-num_sta": 0,
"num_desktop": 0,
"num_mobile": 0,
"num_handheld": 0
}

Would be good to know why the temps are not reported anymore. But in the meantime, is there a way you could handle this failure more gracefully?

christoph-buente avatar Apr 26 '21 16:04 christoph-buente

Would be good to know why the temps are not reported anymore.

This used to work? When did it stop working? What was changed?

It looks like instead of an array like this:

temps: {"Board (CPU)":"51 C","Board (PHY)":"51 C","CPU":"72 C","PHY":"77 C"}

Your controller gave you an empty string. temps: ""

Not impossible to work around that, but it really sucks when API methods change data types. :(

davidnewhall avatar Apr 28 '21 04:04 davidnewhall

Hi there, looks like I have the same issue with the same error and the temperature field.

Has this been fixed or is there a workaround for now?

The strange thing is that the poller worked perfectly for about a day and then failed and now refuses to start because of this issue. Have tried restarting the UniFi controller, the poller itself, etc.

Thanks in advance.

infocus13 avatar Jul 25 '21 11:07 infocus13

So I may have found something that may provide a clue to this bug @davidnewhall .

My unifi-poller metrics stopped working at a certain time. So I went back into my syslog aggregator to see if there was anything suspicious that happened around then. Surely enough, the USG produced the following message:

SecurityGateway kernel: Process 10698 (ubnt-util) has crashed (parent 711 (ubnt-daemon) signal 11, code 196609, addr 00000000012b3000), coredumps disabled

image

It appears something in the USG crashed. Following a restart of the USG and the unifi-poller service, everything is working fine so far for 8 hours.

infocus13 avatar Jul 25 '21 19:07 infocus13

I have this problem too, marshaling is failing. Restarting the USG doesn't help -- well, it helps for a short time but the log message that @infocus13 mentions comes back and then unpoller stops emitting data for the USG.

dulitz avatar Aug 31 '21 23:08 dulitz

For us it got fixed by updating the unifi-poller docker Image to the latest version. I had to tweak the config a bit cause there were more options then. But since then it works fine. We also updated the controller to 6.2.x

christoph-buente avatar Sep 01 '21 04:09 christoph-buente

looks like this might be fixed?

platinummonkey avatar Dec 12 '22 22:12 platinummonkey