From 646dff9c9d511b27d45ff29cb3cb90f8545b0a3e Mon Sep 17 00:00:00 2001 From: tbauriedel Date: Mon, 15 Aug 2022 14:46:03 +0200 Subject: [PATCH] postgresql: add version --- README.md | 1 + modules/postgresql/collector.go | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/README.md b/README.md index ef8820e..2de5990 100644 --- a/README.md +++ b/README.md @@ -114,6 +114,7 @@ See [modules/mysql/collector.go](modules/mysql/collector.go) for details. Module: `postgresql` +* PostgreSQL version * Package versions * Service status * Configuration files from `/etc/postgresql` and `/var/lib/pgsql` (depending on OS) diff --git a/modules/postgresql/collector.go b/modules/postgresql/collector.go index 867e91c..39cffa5 100644 --- a/modules/postgresql/collector.go +++ b/modules/postgresql/collector.go @@ -17,6 +17,10 @@ var files = []string{ "/var/lib/pgsql/data/*.conf", // RedHat based systems, where the configuration is found } +var commands = map[string][]string{ + "version.txt": {"psql", "-V"}, +} + var possibleServices = []string{ "postgresql", } @@ -46,4 +50,8 @@ func Collect(c *collection.Collection) { for _, service := range possibleServices { c.AddServiceStatusRaw(ModuleName+"/service-"+service+".txt", service) } + + for name, cmd := range commands { + c.AddCommandOutput(ModuleName+"/"+name, cmd[0], cmd[1:]...) + } }