Merge pull request #44 from digitalocean/add_default_path

travis: fix docker push, add default page
This commit is contained in:
Vaibhav Bhembre 2016-12-31 15:58:14 -05:00 committed by GitHub
commit 8bb9e09349
2 changed files with 12 additions and 4 deletions

View File

@ -24,10 +24,12 @@ script:
- go test -coverprofile=collectors.coverprofile ./collectors
- $HOME/gopath/bin/gover
- $HOME/gopath/bin/goveralls -coverprofile=gover.coverprofile -service travis-ci
- docker build -t digitalocean/ceph_exporter .
after_success:
- if [ "$TRAVIS_BRANCH" == "master" ]; then
- export DOCKER_REPO="digitalocean/ceph_exporter"
- if [ ! -z "$TRAVIS_TAG" ]; then
docker build -t $DOCKER_REPO:$DOCKER_TAG .;
docker tag $DOCKER_REPO:$DOCKER_TAG $DOCKER_REPO:latest;
docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD";
docker push digitalocean/ceph_exporter:$DOCKER_TAG;
docker push $DOCKER_REPO;
fi

View File

@ -108,7 +108,13 @@ func main() {
http.Handle(*metricsPath, prometheus.Handler())
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
http.Redirect(w, r, *metricsPath, http.StatusMovedPermanently)
w.Write([]byte(`<html>
<head><title>Ceph Exporter</title></head>
<body>
<h1>Ceph Exporter</h1>
<p><a href='` + *metricsPath + `'>Metrics</a></p>
</body>
</html>`))
})
log.Printf("Starting ceph exporter on %q", *addr)