app-exporter/apps/odoo.go

24 lines
540 B
Go

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