From 7f4bfb126360c9f174beb4b00761a9f26c6bc337 Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Fri, 16 Sep 2016 15:29:24 +0200 Subject: Add prometheus --- ip.go | 7 +------ prometheus.go | 11 +++++++++++ 2 files changed, 12 insertions(+), 6 deletions(-) create mode 100644 prometheus.go diff --git a/ip.go b/ip.go index 9a11b8f..787c511 100644 --- a/ip.go +++ b/ip.go @@ -17,10 +17,5 @@ func ip(w http.ResponseWriter, r *http.Request) { http.Error(w, err.Error(), http.StatusInternalServerError) return } - host, err := net.LookupAddr(addr) - if err != nil { - http.Error(w, err.Error(), http.StatusInternalServerError) - return - } - fmt.Fprintln(w, addr, host) + fmt.Fprintln(w, addr) } diff --git a/prometheus.go b/prometheus.go new file mode 100644 index 0000000..c9ac835 --- /dev/null +++ b/prometheus.go @@ -0,0 +1,11 @@ +package main + +import ( + "net/http" + + "github.com/prometheus/client_golang/prometheus" +) + +func init() { + http.Handle("/metrics", prometheus.Handler()) +} -- cgit v1.2.3