feat: added minio version export
All checks were successful
Build package / typos (push) Successful in 1m31s
All checks were successful
Build package / typos (push) Successful in 1m31s
This commit is contained in:
parent
b0cf387655
commit
f0f1213dbc
4 changed files with 27 additions and 0 deletions
|
@ -11,6 +11,7 @@ This is mainly targeted at the Recycled Cloud hosted applications.
|
|||
- forgejo
|
||||
- forgejo_runner
|
||||
- grafana
|
||||
- minio
|
||||
- nextcloud: `curl -s https://files.rccd:9000/status.php | jq .version -r`
|
||||
- odoo
|
||||
- odoo enterprise commit/date: TODO
|
||||
|
|
|
@ -62,6 +62,7 @@ func RecordMetrics(m apps.Metrics) {
|
|||
apps.Forgejo(m)
|
||||
apps.ForgejoRunner(m)
|
||||
apps.Grafana(m)
|
||||
apps.Minio(m)
|
||||
apps.Nextcloud(m)
|
||||
apps.Odoo(m)
|
||||
apps.Postgres(m)
|
||||
|
|
|
@ -9,6 +9,7 @@ type Metrics struct {
|
|||
Forgejo prometheus.GaugeVec
|
||||
ForgejoRunner prometheus.GaugeVec
|
||||
Grafana prometheus.GaugeVec
|
||||
Minio prometheus.GaugeVec
|
||||
Nextcloud prometheus.GaugeVec
|
||||
Odoo 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"}),
|
||||
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"}),
|
||||
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"}),
|
||||
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"}),
|
||||
|
@ -32,6 +34,7 @@ func NewMetrics(reg prometheus.Registerer) *Metrics {
|
|||
metrics.Forgejo,
|
||||
metrics.ForgejoRunner,
|
||||
metrics.Grafana,
|
||||
metrics.Minio,
|
||||
metrics.Nextcloud,
|
||||
metrics.Odoo,
|
||||
metrics.Postgres,
|
||||
|
@ -49,6 +52,7 @@ func (m *Metrics) Reset() {
|
|||
m.Forgejo.Reset()
|
||||
m.ForgejoRunner.Reset()
|
||||
m.Grafana.Reset()
|
||||
m.Minio.Reset()
|
||||
m.Nextcloud.Reset()
|
||||
m.Odoo.Reset()
|
||||
m.Postgres.Reset()
|
||||
|
|
21
apps/minio.go
Normal file
21
apps/minio.go
Normal 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)
|
||||
}
|
Loading…
Reference in a new issue