charlie-haley / omada_exporter

Prometheus Exporter for TP-Link Omada Controller SDN.
MIT License
94 stars 16 forks source link

Upgraded Omada Controller and Omada Exporter - Exporter No Longer Runs #95

Closed RichieRogers closed 3 months ago

RichieRogers commented 5 months ago

Hi, I've just upgraded my Omada Controller to version 5.14.20.9 and exporter to v0.13.0. However, I now get the following error when trying to run the exporter: sudo /bin/omada-exporter --host https://my-omada-server:8043 --username prometheus --password REDACTED --insecure true

panic: runtime error: slice bounds out of range [1:0]

goroutine 1 [running]: github.com/charlie-haley/omada_exporter/pkg/api.(Client).getCid(0x40000b2680) github.com/charlie-haley/omada_exporter@v0.13.0/pkg/api/auth.go:64 +0x1a4 github.com/charlie-haley/omada_exporter/pkg/api.Configure(0x8dd660) github.com/charlie-haley/omada_exporter@v0.13.0/pkg/api/api.go:51 +0x88 github.com/charlie-haley/omada_exporter/cmd.run(0x44b9a0?) github.com/charlie-haley/omada_exporter@v0.13.0/cmd/exporter.go:91 +0x19c github.com/urfave/cli/v2.(App).RunContext(0x4000082680, {0x5bda68?, 0x4000120020}, {0x4000128000, 0x9, 0x9}) github.com/urfave/cli/v2@v2.3.0/app.go:322 +0x6ec github.com/urfave/cli/v2.(*App).Run(...) github.com/urfave/cli/v2@v2.3.0/app.go:224 github.com/charlie-haley/omada_exporter/cmd.Run() github.com/charlie-haley/omada_exporter@v0.13.0/cmd/exporter.go:60 +0xca4 main.main() github.com/charlie-haley/omada_exporter@v0.13.0/main.go:8 +0x1c

Is there a fix for this?

Thanks, Richie

jasonhouston commented 4 months ago

I'm getting the same errors, though interestingly this only started after the last reboot of my Omada controller yesterday. Before that, it had been working.

tukane commented 4 months ago

Same here.

codersaur commented 4 months ago

and here

chjohans commented 4 months ago

I'm getting the same error, was driving me nuts until I found this. I did make some changes on the server that was running this docker image, and I thought it was somehow related to that, even if it should not cause this. This is a very useful collector so hopefully, @charlie-haley will have a look at and eventually fix this.

mixman68 commented 4 months ago

I see the problem, the redirect from / to /cid/login doesn't exist anymore, the login is made here /api/v2/login, the CID can be get later but I don't investigate more...

I forked the repo and added CID param.

I think pass to OpenAPI of Omada is better to avoid futures issues

RichieRogers commented 4 months ago

@mixman68 Great you have a fix. Sadly I have no idea how to compile this into an arm64 deb package I can put onto my Raspberry Pi - any docs on this?

Thanks, Richie

mixman68 commented 4 months ago

Hello, it's programmed in golang

so no necessity of .deb, for mine I compile with this command

GOOS=linux GOARCH=arm64 go build -o omada-exporter

after this you get a single executable with all included to run without dependencies

tukane commented 4 months ago

But I can also wait until the fix is included in a new version of the docker file, right?

charlie-haley commented 4 months ago

Hi, thanks for raising this! I should have some time this week to investigate what's exactly happened here, in the meantime I'd recommend not upgrading until a fix has been released

blesswinsamuel commented 3 months ago

I made a fix by taking ideas from the ha-omada integration. I tested it on 5.14.26.1, don't know if it will break older versions.

For anyone wants to try it out, I pushed a docker image here - https://github.com/blesswinsamuel/omada_exporter/pkgs/container/omada_exporter (ghcr.io/blesswinsamuel/omada_exporter:0.0.3).

franzfopa commented 3 months ago

I made a fix by taking ideas from the ha-omada integration. I tested it on 5.14.26.1, don't know if it will break older versions.

For anyone wants to try it out, I pushed a docker image here - https://github.com/blesswinsamuel/omada_exporter/pkgs/container/omada_exporter (ghcr.io/blesswinsamuel/omada_exporter:0.0.3).

confirmed working on 5.14.26.1 - seems like all is working via docker compose.

jasonhouston commented 3 months ago

Confirmed on 5.14.26.1 for me as well

I made a fix by taking ideas from the ha-omada integration. I tested it on 5.14.26.1, don't know if it will break older versions.

For anyone wants to try it out, I pushed a docker image here - https://github.com/blesswinsamuel/omada_exporter/pkgs/container/omada_exporter (ghcr.io/blesswinsamuel/omada_exporter:0.0.3).

charlie-haley commented 3 months ago

Thanks for the PR @blesswinsamuel! It looks like the OpenAPI integration is working now too, I'll look at building a client from there now which will hopefully avoid issues like this going forward. Thank you everyone for your patience!

RichieRogers commented 3 months ago

Hi, 0.13.1 of the omada exporter works. Thanks for fixing.

Much appreciated, Richie

RichieRogers commented 3 months ago

Hi, Sorry to re-open this one, but any chance of updating the Helm chart to use the new version? I'm migrating over to Kubernetes and this error has popped up again.

Many Thanks, Richie