sensu-plugins-edgelab 1.18.3 → 1.18.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/metrics-postgres-connections.rb +3 -2
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5d69148597eecc8e890508809750fffc64d841ef7a1c2c45930da151bececc23
|
|
4
|
+
data.tar.gz: 5e7fa4fea33721e8eafe936c9ac20b55bfaae1bcfdb0ab3a0f3bfc9736dd6134
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1cdd49b81483f19f4014ed20831d730d97513b53066e8cdb1d413f79604b224d8468713817e313e6bc355734bc92542f103ce9eba424e8915e4fa26294f1eae8
|
|
7
|
+
data.tar.gz: 62c224e081680bca8be7d5c8788d950a4786b6ba0b7ea19385bdb9416bd25932efe16f505d0f83fbf89fd34ebaaec352536e83da483132d38b3dd9ed54d24965
|
|
@@ -80,9 +80,10 @@ class PostgresStatsDBMetrics < Sensu::Plugin::Metric::CLI::Graphite
|
|
|
80
80
|
connect_timeout: config[:timeout])
|
|
81
81
|
|
|
82
82
|
# https://www.postgresql.org/docs/10/monitoring-stats.html#PG-STAT-ACTIVITY-VIEW
|
|
83
|
+
# *state* field needs superuser privileges to read state of other users, otherwise we set it to *unknown_state*
|
|
83
84
|
query = <<END_SQL
|
|
84
|
-
SELECT usename, datname, replace(replace(replace(state, ' ', '_'), '(', ''), ')', '') as state, count(*)
|
|
85
|
-
FROM pg_stat_activity WHERE usename IS NOT NULL
|
|
85
|
+
SELECT usename, datname, replace(replace(replace(coalesce(state, 'unknown_state'), ' ', '_'), '(', ''), ')', '') as state, count(*)
|
|
86
|
+
FROM pg_stat_activity WHERE usename IS NOT NULL AND datname IS NOT NULL
|
|
86
87
|
GROUP BY usename, datname, state;
|
|
87
88
|
END_SQL
|
|
88
89
|
|