brandonweeks / vsphere_exporter Goto Github PK
View Code? Open in Web Editor NEWA Prometheus exporter for vSphere
License: Apache License 2.0
A Prometheus exporter for vSphere
License: Apache License 2.0
Hi,
I tried to connect to a vcenter server with an account whose password has a trailing question mark.
The connection to the vcenter server failed with "invalid URL port".
Changing the password to something that does not contain a trailing question mark allows the exporter to connect.
This probably a bug in url.Parse and can potentially be worked around by constructing a UserInfo object (https://golang.org/pkg/net/url/#UserPassword), instead of relying on url.Parse to parse the credentials out of the URL.
Thank you
Right now it takes about 20 seconds for our VSphere server to respond with all the metrics -- the thing is we don't need 90% of the metrics reported.
I've been tinkering with making changes myself, but I'm pretty hobbled by not understanding the vsphere API very well.
Any suggestions? So far I've been looking pretty closely to the SampleByName
function, but I'm kind of uncertain what my ManagedObject
list should be made up of.
I don't want my password to be visible in /proc. Suggested alternatives: (1) allow prompting for password to read from stdin, (2) allow reading password from a file.
I'm pretty new to this so I may just be doing it wrong. However...I get an error when trying to build.
Go and Docker versions:
$ go version
go version go1.8.3 darwin/amd64
$ docker version
Client:
Version: 17.05.0-ce
API version: 1.24 (downgraded from 1.29)
Go version: go1.8.1
Git commit: 89658be
Built:
OS/Arch: darwin/amd64
Server:
Version: 1.12.3
API version: 1.24 (minimum version )
Go version: go1.6.3
Git commit: 6b644ec
Built: Wed Oct 26 23:26:11 2016
OS/Arch: linux/amd64
Experimental: false
$ docker build .
Sending build context to Docker daemon 124.4kB
Step 1 : FROM golang:1.6-onbuild
1.6-onbuild: Pulling from library/golang
5040bd298390: Pull complete
fce5728aad85: Pull complete
76610ec20bf5: Pull complete
86b681f75ff6: Pull complete
77855d2f51f6: Pull complete
b989296b493d: Pull complete
2d403c19702e: Pull complete
d34839605e09: Pull complete
Digest: sha256:5307f272434d6fff934b0976d6b4c55e46792b100bfb4c66b9b9f16deca8b32f
Status: Downloaded newer image for golang:1.6-onbuild
# Executing 3 build triggers...
Step 1 : COPY . /go/src/app
Step 1 : RUN go-wrapper download
---> Running in 144cf0340215
+ exec go get -v -d
github.com/prometheus/client_golang (download)
github.com/beorn7/perks (download)
github.com/golang/protobuf (download)
github.com/prometheus/client_model (download)
github.com/prometheus/common (download)
github.com/matttproud/golang_protobuf_extensions (download)
github.com/prometheus/procfs (download)
github.com/prometheus/log (download)
github.com/Sirupsen/logrus (download)
github.com/serenize/snaker (download)
github.com/vmware/govmomi (download)
package context: unrecognized import path "context" (import path does not begin with hostname)
Fetching https://golang.org/x/net/context?go-get=1
Parsing meta tags from https://golang.org/x/net/context?go-get=1 (status code 200)
get "golang.org/x/net/context": found meta tag main.metaImport{Prefix:"golang.org/x/net", VCS:"git", RepoRoot:"https://go.googlesource.com/net"} at https://golang.org/x/net/context?go-get=1
get "golang.org/x/net/context": verifying non-authoritative meta tag
Fetching https://golang.org/x/net?go-get=1
Parsing meta tags from https://golang.org/x/net?go-get=1 (status code 200)
golang.org/x/net (download)
Fetching https://gopkg.in/yaml.v2?go-get=1
Parsing meta tags from https://gopkg.in/yaml.v2?go-get=1 (status code 200)
get "gopkg.in/yaml.v2": found meta tag main.metaImport{Prefix:"gopkg.in/yaml.v2", VCS:"git", RepoRoot:"https://gopkg.in/yaml.v2"} at https://gopkg.in/yaml.v2?go-get=1
gopkg.in/yaml.v2 (download)
The command '/bin/sh -c go-wrapper download' returned a non-zero code: 1
Hi Brandon - fantastic work on this exporter!
I am trying to connect to a standalone esxi host (rather than vcenter), but as soon as I request /metrics
the container crashes with the following:
+ exec app
INFO[0000] Starting Server: :9155 file=vmware_exporter.go line=192
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x40 pc=0x54d8b8]
goroutine 32 [running]:
panic(0xf7ce00, 0xc82000a0b0)
/usr/local/go/src/runtime/panic.go:481 +0x3e6
github.com/prometheus/client_golang/prometheus.NewConstMetric(0x0, 0x2, 0x0, 0xc8201e6690, 0x3, 0x3, 0x0, 0x0, 0x0, 0x0)
/go/src/github.com/prometheus/client_golang/prometheus/value.go:156 +0x48
github.com/prometheus/client_golang/prometheus.MustNewConstMetric(0x0, 0x2, 0x0, 0xc8201e6690, 0x3, 0x3, 0x0, 0x0)
/go/src/github.com/prometheus/client_golang/prometheus/value.go:170 +0x7a
main.(*Exporter).Collect(0xc82000c4e0, 0xc820013b60)
/go/src/app/vmware_exporter.go:164 +0x910
github.com/prometheus/client_golang/prometheus.(*Registry).Gather.func2(0xc82038b1c0, 0xc820013b60, 0x7f2311ae11f0, 0xc82000c4e0)
/go/src/github.com/prometheus/client_golang/prometheus/registry.go:433 +0x58
created by github.com/prometheus/client_golang/prometheus.(*Registry).Gather
/go/src/github.com/prometheus/client_golang/prometheus/registry.go:434 +0x360
Some short steps with instructions on how to use your exporter would be much appreciated.
Thank you!
Regards,
Dan
OK...sorry for the dumb question...I'm really new to this.
How do I pass my yaml file to the Docker container so it reads the config?
Hi,
would it be possible to add metrics to expose datastore usage (total size, space left, etc)?
Thank you
Hi,
I was giving your exporter a try.
I just launched it, queried the /metrics URI via browser, and then went away for half an hour without querying it.
Once I returned, I queried the /metrics URI again, upon which is exporter exited due to authentication issues.
It seems like the exporter authenticates once, and then just reuses the client object, which is probably fine, until your vcenter goes away, your authenticated client times out (like in my case), or you run into any other issues that prevents exporter <> vcenter communication.
Would it be possible to handle this case?
Thank you
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.