Skip to content

Commit 26f1b64

Browse files
committed
Log fetching problems.
1 parent 9a45290 commit 26f1b64

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

main.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ func (c collector) Collect(ch chan<- prometheus.Metric) {
8888
start := time.Now()
8989
output, err := c.jmx.Fetch()
9090
if err != nil {
91+
log.Printf("Fetching metrics failed: %v\n", err)
9192
ch <- prometheus.MustNewConstMetric(dcm4chee2Up, prometheus.GaugeValue, float64(0))
9293
return
9394
}
@@ -130,6 +131,7 @@ func main() {
130131
flag.StringVar(&jmx.Password, "p", "admin", "Password of JBoss admin")
131132
address := flag.String("a", ":9404", "Address to listen on")
132133
flag.Parse()
134+
log.Printf("Starting dcm4chee2-exporter, version %s\n", version)
133135
prometheus.MustRegister(&collector{jmx})
134136
http.Handle(metricsPath, promhttp.Handler())
135137
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
@@ -144,6 +146,5 @@ func main() {
144146
</html>
145147
`))
146148
})
147-
log.Printf("Starting dcm4chee2-exporter, version %s\n", version)
148149
log.Fatal(http.ListenAndServe(*address, nil))
149150
}

0 commit comments

Comments
 (0)