app-exporter/apps/nextcloud.go

26 lines
433 B
Go

package apps
import (
"encoding/json"
"net/http"
"github.com/prometheus/client_golang/prometheus"
)
type apiResponse struct {
version string
}
func Nextcloud(m Metrics) {
var resp, err = http.Get("http://localhost:9000/status.php")
if err != nil {
return
}
defer resp.Body.Close()
var res = apiResponse{}
json.NewDecoder(resp.Body).Decode(&res)
m.Nextcloud.With(prometheus.Labels{"version": res.version}).Set(1)
}