Open dacarson opened 6 months ago
It's breaking because of this line I believe.. I don't actively use the library anymore but happy to accept a PR!
Thanks for getting back to me.
It looks like your code is working fine for the for loop
- however, Go is not a language that I am very familiar with.
If I read the tip-of-tree code correctly...
for _, line := range resp {
the value for line
should be UPS hotwater "Hotwater UPS"
if strings.HasPrefix(line, "UPS ") {
this is true...
splitLine := strings.Split(strings.TrimPrefix(line, "UPS "), ``"``)
the value for splitLine
should be array with 2 elements hotwater
, Hotwater UPS
newUPS, err := NewUPS(strings.TrimSuffix(splitLine[0], " "), c)
this line only takes the first element, aka hotwater
so it should work fine.
In the project that I am getting is:
err="error reading response: EOF"
so maybe it is within the NewUPS()
function?
Using this library via nut_exporter, I was getting errors with my UPSs:
ts=2024-03-28T15:25:22.903Z caller=nut_collector.go:131 level=error msg="Failure getting the list of UPS devices" err="error reading response: EOF"
I tracked it down to getting the list of UPSs. When I have spaces in the description, it seems to be failing. When I changed the spaces to underscores, it worked.This fails with EOF:
This works: