app-exporter/apps/grafana.go

22 lines
401 B
Go

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