metalmatze / digitalocean_exporter Goto Github PK
View Code? Open in Web Editor NEWPrometheus exporter for DigitalOcean metrics, written in Go.
License: MIT License
Prometheus exporter for DigitalOcean metrics, written in Go.
License: MIT License
The title says it all. It would be probably easiest to just use GitHub Actions going forward.
First of all I want to thank you for maintaining this project. I really appreciate your work.
Unfortunately, this exporter stopped working a few weeks ago. I run your pre-built container image in latest version 0.6.1
. These are the last lines from the log when the container starts:
digitalocean_exporter_1 | goroutine 848 [running]:
digitalocean_exporter_1 | github.com/metalmatze/digitalocean_exporter/collector.(*DropletCollector).Collect(0xc0000ae420, 0xc0002c4060)
digitalocean_exporter_1 | /go/src/github.com/metalmatze/digitalocean_exporter/collector/droplet.go:111 +0x1b1
digitalocean_exporter_1 | github.com/prometheus/client_golang/prometheus.(*Registry).Gather.func1()
digitalocean_exporter_1 | /go/pkg/mod/github.com/prometheus/[email protected]/prometheus/registry.go:443 +0x1a2
digitalocean_exporter_1 | created by github.com/prometheus/client_golang/prometheus.(*Registry).Gather
digitalocean_exporter_1 | /go/pkg/mod/github.com/prometheus/[email protected]/prometheus/registry.go:454 +0x5ce
digitalocean_exporter_1 | level=info ts=2022-11-09T05:03:19.58640215Z caller=main.go:74 msg="starting digitalocean_exporter" version=0.6.1 revision=60ab0b6a7c5fac17f003e1df01a0c45639682945 buildDate=2020-09-29T10:18:22+0000 goVersion=go1.15.2
digitalocean_exporter_1 | level=info ts=2022-11-09T05:03:19.587319196Z caller=main.go:124 msg=listening addr=:9212
digitalocean_exporter_1 | level=warn ts=2022-11-09T12:03:23.583874406Z caller=snapshot.go:61 msg="can't list snapshots" err="Get \"https://api.digitalocean.com/v2/snapshots\": context deadline exceeded"
digitalocean_exporter_1 | level=info ts=2022-11-09T13:08:47.888274687Z caller=main.go:74 msg="starting digitalocean_exporter" version=0.6.1 revision=60ab0b6a7c5fac17f003e1df01a0c45639682945 buildDate=2020-09-29T10:18:22+0000 goVersion=go1.15.2
digitalocean_exporter_1 | level=info ts=2022-11-09T13:08:47.888811646Z caller=main.go:124 msg=listening addr=:9212
digitalocean_exporter_1 | level=warn ts=2022-11-09T14:47:29.687711412Z caller=droplet.go:99 msg="can't list droplets" err="unexpected EOF"
digitalocean_exporter_1 | panic: runtime error: invalid memory address or nil pointer dereference
digitalocean_exporter_1 | [signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x7ed071]
digitalocean_exporter_1 |
digitalocean_exporter_1 | goroutine 175 [running]:
digitalocean_exporter_1 | github.com/metalmatze/digitalocean_exporter/collector.(*DropletCollector).Collect(0xc000212360, 0xc000212060)
digitalocean_exporter_1 | /go/src/github.com/metalmatze/digitalocean_exporter/collector/droplet.go:111 +0x1b1
digitalocean_exporter_1 | github.com/prometheus/client_golang/prometheus.(*Registry).Gather.func1()
digitalocean_exporter_1 | /go/pkg/mod/github.com/prometheus/[email protected]/prometheus/registry.go:443 +0x1a2
digitalocean_exporter_1 | created by github.com/prometheus/client_golang/prometheus.(*Registry).Gather
digitalocean_exporter_1 | /go/pkg/mod/github.com/prometheus/[email protected]/prometheus/registry.go:535 +0xe8e
digitalocean_exporter_1 | level=info ts=2022-11-09T14:47:30.35509065Z caller=main.go:74 msg="starting digitalocean_exporter" version=0.6.1 revision=60ab0b6a7c5fac17f003e1df01a0c45639682945 buildDate=2020-09-29T10:18:22+0000 goVersion=go1.15.2
digitalocean_exporter_1 | level=info ts=2022-11-09T14:47:30.355694664Z caller=main.go:124 msg=listening addr=:9212
digitalocean_exporter_1 | level=info ts=2022-11-09T15:21:41.646456507Z caller=main.go:74 msg="starting digitalocean_exporter" version=0.6.1 revision=60ab0b6a7c5fac17f003e1df01a0c45639682945 buildDate=2020-09-29T10:18:22+0000 goVersion=go1.15.2
digitalocean_exporter_1 | level=info ts=2022-11-09T15:21:41.647105552Z caller=main.go:124 msg=listening addr=:9212
digitalocean_exporter_1 | level=info ts=2022-11-09T15:38:49.037905583Z caller=main.go:74 msg="starting digitalocean_exporter" version=0.6.1 revision=60ab0b6a7c5fac17f003e1df01a0c45639682945 buildDate=2020-09-29T10:18:22+0000 goVersion=go1.15.2
digitalocean_exporter_1 | level=info ts=2022-11-09T15:38:49.038667044Z caller=main.go:124 msg=listening addr=:9212
digitalocean_exporter_1 | level=info ts=2022-11-09T15:41:39.928618869Z caller=main.go:74 msg="starting digitalocean_exporter" version=0.6.1 revision=60ab0b6a7c5fac17f003e1df01a0c45639682945 buildDate=2020-09-29T10:18:22+0000 goVersion=go1.15.2
digitalocean_exporter_1 | level=info ts=2022-11-09T15:41:39.929420254Z caller=main.go:124 msg=listening addr=:9212
As you can see in the snippet from the docker-compose.yml
the exporter has access to the API via HTTP proxy:
---
version: "3.8"
services:
digitalocean_exporter:
image: metalmatze/digitalocean_exporter:0.6.1
restart: always
environment:
DIGITALOCEAN_TOKEN: changeme
http_proxy: {{ http_proxy }}
https_proxy: {{ http_proxy }}
I already double-checked if the container can reach the API.
Also, the used token has not been expired and has read access to DO's API.
Do you need any other information?
Thanks in advance.
Ben
The current release is 0.5 and is from 2018. The exporter seems to have been updated since. Is a new release with the changes scheduled?
Sometimes exporter crushes with Traceback
After restart it works fine.
level=info ts=2021-03-19T10:25:42.792620942Z caller=main.go:74 msg="starting digitalocean_exporter" version=0.6.1 revision=60ab0b6a7c5fac17f003e1df01a0c45639682945 buildDate=2020-09-29T10:18:22+0000 goVersion=go1.15.2
level=info ts=2021-03-19T10:25:42.7934958Z caller=main.go:124 msg=listening addr=:9212
level=warn ts=2021-03-19T10:26:01.710181373Z caller=droplet.go:99 msg="can't list droplets" err="Get \"https://api.digitalocean.com/v2/droplets?page=5\": context deadline exceeded"
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x7ed071]
goroutine 180 [running]:
github.com/metalmatze/digitalocean_exporter/collector.(*DropletCollector).Collect(0xc000098300, 0xc000482060)
/go/src/github.com/metalmatze/digitalocean_exporter/collector/droplet.go:111 +0x1b1
github.com/prometheus/client_golang/prometheus.(*Registry).Gather.func1()
/go/pkg/mod/github.com/prometheus/[email protected]/prometheus/registry.go:443 +0x1a2
created by github.com/prometheus/client_golang/prometheus.(*Registry).Gather
/go/pkg/mod/github.com/prometheus/[email protected]/prometheus/registry.go:535 +0xe8e
stream closed
It would appear that the Droplet collector is only returning 20 results as the API endpoint is paginated - can this be looked into?
Great work writing this exporter.
Any plan to expose more metrics about digitalocean droplets image, public and private ips, vpc and container registry?
Around every second the following error is generated:
level=warn ts=2023-01-18T13:54:39.684877049Z caller=snapshot.go:61 msg="can't list snapshots" err="Get \"https://api.digitalocean.com/v2/snapshots\": context deadline exceeded"
This drives the error count shown on the dashboard very high.
Digitalocean added their new apps platform which is also accessible through godo. Would be useful to have things like apps and deployments to be exported.
Hi, I am running the do exporter as a docker container. I can see some metrics on /metrics page. But there are warnings reported in the logs.
I am using the metalmatze/digitalocean_exporter:0.6.1 docker image
$ sudo docker logs -f --tail 1 digitalocean_exporter
level=warn ts=2020-10-08T10:51:55.130314947Z caller=incidents.go:104 msg="can't retrieve incidents" err="Get \"https://s2k7tnzlhrpw.statuspage.io/api/v2/summary.json\": context deadline exceeded (Client.Timeout exceeded while awaiting headers)"
level=warn ts=2020-10-08T10:52:10.129703669Z caller=incidents.go:104 msg="can't retrieve incidents" err="Get \"https://s2k7tnzlhrpw.statuspage.io/api/v2/summary.json\": context deadline exceeded (Client.Timeout exceeded while awaiting headers)"
level=warn ts=2020-10-08T10:52:10.12987051Z caller=snapshot.go:61 msg="can't list snapshots" err="Get \"https://api.digitalocean.com/v2/snapshots\": context deadline exceeded"
level=warn ts=2020-10-08T10:52:25.130035769Z caller=incidents.go:104 msg="can't retrieve incidents" err="Get \"https://s2k7tnzlhrpw.statuspage.io/api/v2/summary.json\": context deadline exceeded (Client.Timeout exceeded while awaiting headers)"
level=warn ts=2020-10-08T10:52:25.130147046Z caller=snapshot.go:61 msg="can't list snapshots" err="Get \"https://api.digitalocean.com/v2/snapshots\": context deadline exceeded"
level=warn ts=2020-10-08T10:52:40.12954981Z caller=incidents.go:104 msg="can't retrieve incidents" err="Get \"https://s2k7tnzlhrpw.statuspage.io/api/v2/summary.json\": context deadline exceeded (Client.Timeout exceeded while awaiting headers)"
level=warn ts=2020-10-08T10:52:55.12995342Z caller=incidents.go:104 msg="can't retrieve incidents" err="Get \"https://s2k7tnzlhrpw.statuspage.io/api/v2/summary.json\": context deadline exceeded (Client.Timeout exceeded while awaiting headers)"
level=warn ts=2020-10-08T10:52:55.129958578Z caller=snapshot.go:61 msg="can't list snapshots" err="Get \"https://api.digitalocean.com/v2/snapshots\": context deadline exceeded"
level=warn ts=2020-10-08T10:53:10.130054868Z caller=incidents.go:104 msg="can't retrieve incidents" err="Get \"https://s2k7tnzlhrpw.statuspage.io/api/v2/summary.json\": context deadline exceeded (Client.Timeout exceeded while awaiting headers)"
level=warn ts=2020-10-08T10:53:25.130195926Z caller=incidents.go:104 msg="can't retrieve incidents" err="Get \"https://s2k7tnzlhrpw.statuspage.io/api/v2/summary.json\": context deadline exceeded (Client.Timeout exceeded while awaiting headers)"
level=warn ts=2020-10-08T10:53:40.130741997Z caller=incidents.go:104 msg="can't retrieve incidents" err="Get \"https://s2k7tnzlhrpw.statuspage.io/api/v2/summary.json\": context deadline exceeded (Client.Timeout exceeded while awaiting headers)"
level=warn ts=2020-10-08T10:53:55.130038935Z caller=incidents.go:104 msg="can't retrieve incidents" err="Get \"https://s2k7tnzlhrpw.statuspage.io/api/v2/summary.json\": context deadline exceeded (Client.Timeout exceeded while awaiting headers)"
Sometimes, these error too comes up
digitalocean_exporter | level=warn ts=2020-10-08T11:05:55.129682229Z caller=incidents.go:104 msg="can't retrieve incidents" err="Get \"https://s2k7tnzlhrpw.statuspage.io/api/v2/summary.json\": context deadline exceeded (Client.Timeout exceeded while awaiting headers)"
digitalocean_exporter | level=warn ts=2020-10-08T11:05:55.129685665Z caller=key.go:56 msg="can't list keys" err="Get \"https://api.digitalocean.com/v2/account/keys\": context deadline exceeded"
digitalocean_exporter | level=warn ts=2020-10-08T11:05:55.129733339Z caller=droplet.go:99 msg="can't list droplets" err="Get \"https://api.digitalocean.com/v2/droplets\": context deadline exceeded"
digitalocean_exporter | level=warn ts=2020-10-08T11:05:55.129936014Z caller=image.go:56 msg="can't list images" err="Get \"https://api.digitalocean.com/v2/images?private=true\": context deadline exceeded"
digitalocean_exporter | panic: runtime error: invalid memory address or nil pointer dereference
digitalocean_exporter | [signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x7ed071]
digitalocean_exporter |
digitalocean_exporter | goroutine 746 [running]:
digitalocean_exporter | github.com/metalmatze/digitalocean_exporter/collector.(*DropletCollector).Collect(0xc000062cc0, 0xc0002683c0)
digitalocean_exporter | /go/src/github.com/metalmatze/digitalocean_exporter/collector/droplet.go:111 +0x1b1
digitalocean_exporter | github.com/prometheus/client_golang/prometheus.(*Registry).Gather.func1()
digitalocean_exporter | /go/pkg/mod/github.com/prometheus/[email protected]/prometheus/registry.go:443 +0x1a2
digitalocean_exporter | created by github.com/prometheus/client_golang/prometheus.(*Registry).Gather
digitalocean_exporter | /go/pkg/mod/github.com/prometheus/[email protected]/prometheus/registry.go:535 +0xe8e
digitalocean_exporter exited with code 2
I did a curl inside the container -
/ # apk add curl
fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/main/x86_64/APKINDEX.tar.gz
....
/ # curl https://s2k7tnzlhrpw.statuspage.io/api/v2/summary.json
^C
/ # curl https://s2k7tnzlhrpw.statuspage.io/api/v2/summary.json -v
* Trying 13.236.8.151:443...
* Connected to s2k7tnzlhrpw.statuspage.io (13.236.8.151) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
* CAfile: /etc/ssl/certs/ca-certificates.crt
CApath: none
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
There's no output and it gets stuck there. However, I am able to curl other urls or even curl from host to this url - https://s2k7tnzlhrpw.statuspage.io/api/v2/summary.json and get the output. I am not sure why this url is being used (must be used to get metrics info) but it is not able to reach from inside the container.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.