feat: added minio version export
All checks were successful
Build package / typos (push) Successful in 1m31s

This commit is contained in:
Valentin Doreau 2024-11-15 14:20:05 +01:00
parent b0cf387655
commit f0f1213dbc
Signed by: vdoreau
GPG key ID: F3E456CF9A14098B
4 changed files with 27 additions and 0 deletions

View file

@ -11,6 +11,7 @@ This is mainly targeted at the Recycled Cloud hosted applications.
- forgejo - forgejo
- forgejo_runner - forgejo_runner
- grafana - grafana
- minio
- nextcloud: `curl -s https://files.rccd:9000/status.php | jq .version -r` - nextcloud: `curl -s https://files.rccd:9000/status.php | jq .version -r`
- odoo - odoo
- odoo enterprise commit/date: TODO - odoo enterprise commit/date: TODO

View file

@ -62,6 +62,7 @@ func RecordMetrics(m apps.Metrics) {
apps.Forgejo(m) apps.Forgejo(m)
apps.ForgejoRunner(m) apps.ForgejoRunner(m)
apps.Grafana(m) apps.Grafana(m)
apps.Minio(m)
apps.Nextcloud(m) apps.Nextcloud(m)
apps.Odoo(m) apps.Odoo(m)
apps.Postgres(m) apps.Postgres(m)

View file

@ -9,6 +9,7 @@ type Metrics struct {
Forgejo prometheus.GaugeVec Forgejo prometheus.GaugeVec
ForgejoRunner prometheus.GaugeVec ForgejoRunner prometheus.GaugeVec
Grafana prometheus.GaugeVec Grafana prometheus.GaugeVec
Minio prometheus.GaugeVec
Nextcloud prometheus.GaugeVec Nextcloud prometheus.GaugeVec
Odoo prometheus.GaugeVec Odoo prometheus.GaugeVec
Postgres prometheus.GaugeVec Postgres prometheus.GaugeVec
@ -21,6 +22,7 @@ func NewMetrics(reg prometheus.Registerer) *Metrics {
Forgejo: *prometheus.NewGaugeVec(prometheus.GaugeOpts{Namespace: "app", Subsystem: "version", Name: "forgejo", Help: ""}, []string{"version"}), Forgejo: *prometheus.NewGaugeVec(prometheus.GaugeOpts{Namespace: "app", Subsystem: "version", Name: "forgejo", Help: ""}, []string{"version"}),
ForgejoRunner: *prometheus.NewGaugeVec(prometheus.GaugeOpts{Namespace: "app", Subsystem: "version", Name: "forgejo_runner", Help: ""}, []string{"version"}), ForgejoRunner: *prometheus.NewGaugeVec(prometheus.GaugeOpts{Namespace: "app", Subsystem: "version", Name: "forgejo_runner", Help: ""}, []string{"version"}),
Grafana: *prometheus.NewGaugeVec(prometheus.GaugeOpts{Namespace: "app", Subsystem: "version", Name: "grafana", Help: ""}, []string{"version"}), Grafana: *prometheus.NewGaugeVec(prometheus.GaugeOpts{Namespace: "app", Subsystem: "version", Name: "grafana", Help: ""}, []string{"version"}),
Minio: *prometheus.NewGaugeVec(prometheus.GaugeOpts{Namespace: "app", Subsystem: "version", Name: "minio", Help: ""}, []string{"version"}),
Nextcloud: *prometheus.NewGaugeVec(prometheus.GaugeOpts{Namespace: "app", Subsystem: "version", Name: "nextcloud", Help: ""}, []string{"version"}), Nextcloud: *prometheus.NewGaugeVec(prometheus.GaugeOpts{Namespace: "app", Subsystem: "version", Name: "nextcloud", Help: ""}, []string{"version"}),
Odoo: *prometheus.NewGaugeVec(prometheus.GaugeOpts{Namespace: "app", Subsystem: "version", Name: "odoo", Help: ""}, []string{"version", "version_date"}), Odoo: *prometheus.NewGaugeVec(prometheus.GaugeOpts{Namespace: "app", Subsystem: "version", Name: "odoo", Help: ""}, []string{"version", "version_date"}),
Postgres: *prometheus.NewGaugeVec(prometheus.GaugeOpts{Namespace: "app", Subsystem: "version", Name: "postgres", Help: ""}, []string{"version"}), Postgres: *prometheus.NewGaugeVec(prometheus.GaugeOpts{Namespace: "app", Subsystem: "version", Name: "postgres", Help: ""}, []string{"version"}),
@ -32,6 +34,7 @@ func NewMetrics(reg prometheus.Registerer) *Metrics {
metrics.Forgejo, metrics.Forgejo,
metrics.ForgejoRunner, metrics.ForgejoRunner,
metrics.Grafana, metrics.Grafana,
metrics.Minio,
metrics.Nextcloud, metrics.Nextcloud,
metrics.Odoo, metrics.Odoo,
metrics.Postgres, metrics.Postgres,
@ -49,6 +52,7 @@ func (m *Metrics) Reset() {
m.Forgejo.Reset() m.Forgejo.Reset()
m.ForgejoRunner.Reset() m.ForgejoRunner.Reset()
m.Grafana.Reset() m.Grafana.Reset()
m.Minio.Reset()
m.Nextcloud.Reset() m.Nextcloud.Reset()
m.Odoo.Reset() m.Odoo.Reset()
m.Postgres.Reset() m.Postgres.Reset()

21
apps/minio.go Normal file
View file

@ -0,0 +1,21 @@
package apps
import (
"log"
"os/exec"
"strings"
"github.com/prometheus/client_golang/prometheus"
)
func Minio(m Metrics) {
out, err := exec.Command("minio", "--version").Output()
if err != nil {
log.Printf(">> WARN: Unable to get Minio version: %v", err)
return
}
version := strings.Split(string(out), " ")[2]
m.Minio.With(prometheus.Labels{"version": version}).Set(1)
}