app-exporter/apps/nextcloud.go

26 lines
433 B
Go
Raw Normal View History

2024-10-31 20:42:28 +01:00
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)
}