Implement Prometheus metrics
This commit is contained in:
parent
4b52934656
commit
ae6687b7d2
2 changed files with 5 additions and 0 deletions
|
@ -25,6 +25,7 @@ RUN freshclam --quiet --no-dns
|
||||||
# Build go package
|
# Build go package
|
||||||
ADD . /go/src/clamav-rest/
|
ADD . /go/src/clamav-rest/
|
||||||
RUN go get github.com/dutchcoders/go-clamd
|
RUN go get github.com/dutchcoders/go-clamd
|
||||||
|
RUN go get github.com/prometheus/client_golang/prometheus/promhttp
|
||||||
ADD ./server.* /etc/ssl/clamav-rest/
|
ADD ./server.* /etc/ssl/clamav-rest/
|
||||||
RUN cd /go/src/clamav-rest && go build -v
|
RUN cd /go/src/clamav-rest && go build -v
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/dutchcoders/go-clamd"
|
"github.com/dutchcoders/go-clamd"
|
||||||
|
"github.com/prometheus/client_golang/prometheus/promhttp"
|
||||||
)
|
)
|
||||||
|
|
||||||
var opts map[string]string
|
var opts map[string]string
|
||||||
|
@ -184,6 +185,9 @@ func main() {
|
||||||
http.HandleFunc("/scanPath", scanPathHandler)
|
http.HandleFunc("/scanPath", scanPathHandler)
|
||||||
http.HandleFunc("/", home)
|
http.HandleFunc("/", home)
|
||||||
|
|
||||||
|
// Prometheus metrics
|
||||||
|
http.Handle("/metrics", promhttp.Handler())
|
||||||
|
|
||||||
// Start the HTTPS server in a goroutine
|
// Start the HTTPS server in a goroutine
|
||||||
go http.ListenAndServeTLS(SSL_PORT, "/etc/ssl/clamav-rest/server.crt", "/etc/ssl/clamav-rest/server.key", nil)
|
go http.ListenAndServeTLS(SSL_PORT, "/etc/ssl/clamav-rest/server.crt", "/etc/ssl/clamav-rest/server.key", nil)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue