refactor: prefer pg_config in place of psql for postgres version
This commit is contained in:
parent
4e72d46ef4
commit
b0cf387655
1 changed files with 2 additions and 2 deletions
|
@ -9,13 +9,13 @@ import (
|
|||
)
|
||||
|
||||
func Postgres(m Metrics) {
|
||||
out, err := exec.Command("psql", "--version").Output()
|
||||
out, err := exec.Command("pg_config", "--version").Output()
|
||||
if err != nil {
|
||||
log.Printf(">> WARN: Unable to get Postgres version: %v", err)
|
||||
return
|
||||
}
|
||||
|
||||
version := strings.Split(string(out), " ")[2]
|
||||
version := strings.Split(string(out), " ")[1]
|
||||
|
||||
m.Postgres.With(prometheus.Labels{"version": version}).Set(1)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue