2024-10-31 20:42:28 +01:00
|
|
|
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]
|
|
|
|
|
2024-11-02 16:07:28 +01:00
|
|
|
m.Grafana.With(prometheus.Labels{"version": strings.TrimSpace(version)}).Set(1)
|
2024-10-31 20:42:28 +01:00
|
|
|
}
|