Skip to content

Commit d1ec1dc

Browse files
committed
added /health route and updated version
1 parent e30bd08 commit d1ec1dc

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ GOCMD=go
22
GOTEST=$(GOCMD) test
33
GOVET=$(GOCMD) vet
44
BINARY_NAME=uptimerobot-exporter
5-
VERSION?=0.0.0
5+
VERSION?=0.2.0
66
DOCKER_REGISTRY?=ez3kiel
77

88
GREEN := $(shell tput -Txterm setaf 2)

main.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package main
33
import (
44
"encoding/json"
55
"errors"
6+
"fmt"
67
"io/ioutil"
78
"net/http"
89
"net/url"
@@ -126,6 +127,10 @@ func main() {
126127

127128
logrus.Info("starting metrics server")
128129
http.Handle("/metrics", promhttp.Handler())
130+
http.HandleFunc("/health", func(w http.ResponseWriter, r *http.Request) {
131+
w.WriteHeader(http.StatusOK)
132+
fmt.Fprintln(w, "I'm alive! 8)")
133+
})
129134
http.ListenAndServe(a.address+":"+a.port, nil)
130135
}
131136

0 commit comments

Comments
 (0)