Compare commits
14 Commits
45953848e2
...
dev/logica
| Author | SHA1 | Date | |
|---|---|---|---|
|
29bfd07dad
|
|||
|
60589c2058
|
|||
|
ea3aca3455
|
|||
|
cc71547f5f
|
|||
|
107d5056d6
|
|||
|
e930178e9c
|
|||
|
5afc940df8
|
|||
|
3961aa3448
|
|||
|
8fd57032e7
|
|||
|
5ede7dea07
|
|||
|
5ea007c3f6
|
|||
|
7cb0f7ad40
|
|||
|
83fa12ec54
|
|||
|
98b74d9aed
|
74
GENTOO/pgmon-1.0.4.ebuild
Normal file
74
GENTOO/pgmon-1.0.4.ebuild
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
# Copyright 2024 Gentoo Authors
|
||||||
|
# Distributed under the terms of the GNU General Public License v2
|
||||||
|
|
||||||
|
EAPI=8
|
||||||
|
|
||||||
|
PYTHON_COMPAT=( python3_{6..13} )
|
||||||
|
|
||||||
|
inherit python-r1 systemd
|
||||||
|
|
||||||
|
DESCRIPTION="PostgreSQL monitoring bridge"
|
||||||
|
HOMEPAGE="None"
|
||||||
|
|
||||||
|
LICENSE="BSD"
|
||||||
|
SLOT="0"
|
||||||
|
KEYWORDS="amd64"
|
||||||
|
|
||||||
|
SRC_URI="https://code2.shh-dot-com.org/james/${PN}/releases/download/v${PV}/${P}.tar.bz2"
|
||||||
|
|
||||||
|
IUSE="-systemd"
|
||||||
|
|
||||||
|
DEPEND="
|
||||||
|
${PYTHON_DEPS}
|
||||||
|
dev-python/psycopg:2
|
||||||
|
dev-python/pyyaml
|
||||||
|
dev-python/requests
|
||||||
|
app-admin/logrotate
|
||||||
|
"
|
||||||
|
RDEPEND="${DEPEND}"
|
||||||
|
BDEPEND=""
|
||||||
|
|
||||||
|
#RESTRICT="fetch"
|
||||||
|
|
||||||
|
#S="${WORKDIR}/${PN}"
|
||||||
|
|
||||||
|
#pkg_nofetch() {
|
||||||
|
# einfo "Please download"
|
||||||
|
# einfo " - ${P}.tar.bz2"
|
||||||
|
# einfo "from ${HOMEPAGE} and place it in your DISTDIR directory."
|
||||||
|
# einfo "The file should be owned by portage:portage."
|
||||||
|
#}
|
||||||
|
|
||||||
|
src_compile() {
|
||||||
|
true
|
||||||
|
}
|
||||||
|
|
||||||
|
src_install() {
|
||||||
|
# Install init script
|
||||||
|
if ! use systemd ; then
|
||||||
|
newinitd "openrc/pgmon.initd" pgmon
|
||||||
|
newconfd "openrc/pgmon.confd" pgmon
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Install systemd unit
|
||||||
|
if use systemd ; then
|
||||||
|
systemd_dounit "systemd/pgmon.service"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Install script
|
||||||
|
exeinto /usr/bin
|
||||||
|
newexe "src/pgmon.py" pgmon
|
||||||
|
|
||||||
|
# Install default config
|
||||||
|
diropts -o root -g root -m 0755
|
||||||
|
insinto /etc/pgmon
|
||||||
|
doins "sample-config/pgmon.yml"
|
||||||
|
doins "sample-config/pgmon-metrics.yml"
|
||||||
|
|
||||||
|
# Install logrotate config
|
||||||
|
insinto /etc/logrotate.d
|
||||||
|
newins "logrotate/pgmon.logrotate" pgmon
|
||||||
|
|
||||||
|
# Install man page
|
||||||
|
doman manpages/pgmon.1
|
||||||
|
}
|
||||||
51
Makefile
51
Makefile
@@ -3,7 +3,22 @@ PACKAGE_NAME := pgmon
|
|||||||
|
|
||||||
SCRIPT := src/$(PACKAGE_NAME).py
|
SCRIPT := src/$(PACKAGE_NAME).py
|
||||||
|
|
||||||
VERSION := $(shell grep -m 1 '^VERSION = ' "$(SCRIPT)" | sed -ne 's/.*"\(.*\)".*/\1/p')
|
# Figure out the version components
|
||||||
|
# Note: The release is for RPM packages, where prerelease releases are written as 0.<release>
|
||||||
|
FULL_VERSION := $(shell grep -m 1 '^VERSION = ' "$(SCRIPT)" | sed -ne 's/.*"\(.*\)".*/\1/p')
|
||||||
|
VERSION := $(shell echo $(FULL_VERSION) | sed -n 's/\(.*\)\(-rc.*\|$$\)/\1/p')
|
||||||
|
RELEASE := $(shell echo $(FULL_VERSION) | sed -n 's/.*-rc\([0-9]\+\)$$/\1/p')
|
||||||
|
|
||||||
|
ifeq ($(RELEASE),)
|
||||||
|
RPM_RELEASE := 1
|
||||||
|
RPM_VERSION := $(VERSION)-$(RPM_RELEASE)
|
||||||
|
DEB_VERSION := $(VERSION)
|
||||||
|
else
|
||||||
|
RPM_RELEASE := 0.$(RELEASE)
|
||||||
|
RPM_VERSION := $(VERSION)-$(RPM_RELEASE)
|
||||||
|
DEB_VERSION := $(VERSION)~rc$(RELEASE)
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
# Where packages are built
|
# Where packages are built
|
||||||
BUILD_DIR := build
|
BUILD_DIR := build
|
||||||
@@ -25,16 +40,20 @@ SUPPORTED := ubuntu-20.04 \
|
|||||||
|
|
||||||
.PHONY: all clean tgz test query-tests install-common install-openrc install-systemd
|
.PHONY: all clean tgz test query-tests install-common install-openrc install-systemd
|
||||||
|
|
||||||
|
all: package-all
|
||||||
|
|
||||||
|
version:
|
||||||
|
@echo "full version=$(FULL_VERSION) version=$(VERSION) rel=$(RELEASE) rpm=$(RPM_VERSION) deb=$(DEB_VERSION)"
|
||||||
|
|
||||||
# Build all packages
|
# Build all packages
|
||||||
.PHONY: package-all
|
.PHONY: package-all
|
||||||
all: $(foreach distro_release, $(SUPPORTED), package-$(distro_release))
|
package-all: $(foreach distro_release, $(SUPPORTED), package-$(distro_release))
|
||||||
|
|
||||||
# Gentoo package (tar.gz) creation
|
# Gentoo package (tar.gz) creation
|
||||||
.PHONY: package-gentoo
|
.PHONY: package-gentoo
|
||||||
package-gentoo:
|
package-gentoo:
|
||||||
mkdir -p $(BUILD_DIR)/gentoo
|
mkdir -p $(BUILD_DIR)/gentoo
|
||||||
tar --transform "s,^,$(PACKAGE_NAME)-$(VERSION)/," -acjf $(BUILD_DIR)/gentoo/$(PACKAGE_NAME)-$(VERSION).tar.bz2 --exclude .gitignore $(shell git ls-tree --full-tree --name-only -r HEAD)
|
tar --transform "s,^,$(PACKAGE_NAME)-$(FULL_VERSION)/," -acjf $(BUILD_DIR)/gentoo/$(PACKAGE_NAME)-$(FULL_VERSION).tar.bz2 --exclude .gitignore $(shell git ls-tree --full-tree --name-only -r HEAD)
|
||||||
|
|
||||||
|
|
||||||
# Create a deb package
|
# Create a deb package
|
||||||
@@ -55,7 +74,7 @@ tgz:
|
|||||||
rm -rf $(BUILD_DIR)/tgz/root
|
rm -rf $(BUILD_DIR)/tgz/root
|
||||||
mkdir -p $(BUILD_DIR)/tgz/root
|
mkdir -p $(BUILD_DIR)/tgz/root
|
||||||
$(MAKE) install-openrc DESTDIR=$(BUILD_DIR)/tgz/root
|
$(MAKE) install-openrc DESTDIR=$(BUILD_DIR)/tgz/root
|
||||||
tar -cz -f $(BUILD_DIR)/tgz/$(PACKAGE_NAME)-$(VERSION).tgz -C $(BUILD_DIR)/tgz/root .
|
tar -cz -f $(BUILD_DIR)/tgz/$(PACKAGE_NAME)-$(FULL_VERSION).tgz -C $(BUILD_DIR)/tgz/root .
|
||||||
|
|
||||||
# Clean up the build directory
|
# Clean up the build directory
|
||||||
clean:
|
clean:
|
||||||
@@ -129,28 +148,28 @@ debian-%-install-test:
|
|||||||
docker run --rm \
|
docker run --rm \
|
||||||
-v ./$(BUILD_DIR):/output \
|
-v ./$(BUILD_DIR):/output \
|
||||||
debian:$* \
|
debian:$* \
|
||||||
bash -c 'apt-get update && apt-get install -y /output/$(PACKAGE_NAME)-$(VERSION)-debian-$*.deb'
|
bash -c 'apt-get update && apt-get install -y /output/$(PACKAGE_NAME)-$(DEB_VERSION)-debian-$*.deb'
|
||||||
|
|
||||||
# Run a RedHat install test
|
# Run a RedHat install test
|
||||||
rockylinux-%-install-test:
|
rockylinux-%-install-test:
|
||||||
docker run --rm \
|
docker run --rm \
|
||||||
-v ./$(BUILD_DIR):/output \
|
-v ./$(BUILD_DIR):/output \
|
||||||
rockylinux:$* \
|
rockylinux:$* \
|
||||||
bash -c 'dnf makecache && dnf install -y /output/$(PACKAGE_NAME)-$(VERSION)-1.el$*.noarch.rpm'
|
bash -c 'dnf makecache && dnf install -y /output/$(PACKAGE_NAME)-$(RPM_VERSION).el$*.noarch.rpm'
|
||||||
|
|
||||||
# Run an Ubuntu install test
|
# Run an Ubuntu install test
|
||||||
ubuntu-%-install-test:
|
ubuntu-%-install-test:
|
||||||
docker run --rm \
|
docker run --rm \
|
||||||
-v ./$(BUILD_DIR):/output \
|
-v ./$(BUILD_DIR):/output \
|
||||||
ubuntu:$* \
|
ubuntu:$* \
|
||||||
bash -c 'apt-get update && apt-get install -y /output/$(PACKAGE_NAME)-$(VERSION)-ubuntu-$*.deb'
|
bash -c 'apt-get update && apt-get install -y /output/$(PACKAGE_NAME)-$(DEB_VERSION)-ubuntu-$*.deb'
|
||||||
|
|
||||||
# Run an OracleLinux install test (this is for EL7 since CentOS7 images no longer exist)
|
# Run an OracleLinux install test (this is for EL7 since CentOS7 images no longer exist)
|
||||||
oraclelinux-%-install-test:
|
oraclelinux-%-install-test:
|
||||||
docker run --rm \
|
docker run --rm \
|
||||||
-v ./$(BUILD_DIR):/output \
|
-v ./$(BUILD_DIR):/output \
|
||||||
oraclelinux:7 \
|
oraclelinux:7 \
|
||||||
bash -c 'yum makecache && yum install -y /output/$(PACKAGE_NAME)-$(VERSION)-1.el7.noarch.rpm'
|
bash -c 'yum makecache && yum install -y /output/$(PACKAGE_NAME)-$(RPM_VERSION).el7.noarch.rpm'
|
||||||
|
|
||||||
# Run a Gentoo install test
|
# Run a Gentoo install test
|
||||||
gentoo-install-test:
|
gentoo-install-test:
|
||||||
@@ -192,28 +211,28 @@ package-image-%:
|
|||||||
actually-package-debian-%:
|
actually-package-debian-%:
|
||||||
$(MAKE) install-systemd DESTDIR=/output/debian-$*
|
$(MAKE) install-systemd DESTDIR=/output/debian-$*
|
||||||
cp -r --preserve=mode DEBIAN /output/debian-$*/
|
cp -r --preserve=mode DEBIAN /output/debian-$*/
|
||||||
dpkg-deb -Zgzip --build /output/debian-$* "/output/$(PACKAGE_NAME)-$(VERSION)-debian-$*.deb"
|
dpkg-deb -Zgzip --build /output/debian-$* "/output/$(PACKAGE_NAME)-$(DEB_VERSION)-debian-$*.deb"
|
||||||
|
|
||||||
# RedHat package creation
|
# RedHat package creation
|
||||||
actually-package-rockylinux-%:
|
actually-package-rockylinux-%:
|
||||||
mkdir -p /output/rockylinux-$*/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
|
mkdir -p /output/rockylinux-$*/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
|
||||||
sed -e "s/@@VERSION@@/$(VERSION)/g" RPM/$(PACKAGE_NAME).spec > /output/rockylinux-$*/SPECS/$(PACKAGE_NAME).spec
|
sed -e "s/@@VERSION@@/$(VERSION)/g" -e "s/@@RELEASE@@/$(RPM_RELEASE)/g" RPM/$(PACKAGE_NAME).spec > /output/rockylinux-$*/SPECS/$(PACKAGE_NAME).spec
|
||||||
rpmbuild --define '_topdir /output/rockylinux-$*' \
|
rpmbuild --define '_topdir /output/rockylinux-$*' \
|
||||||
--define 'version $(VERSION)' \
|
--define 'version $(RPM_VERSION)' \
|
||||||
-bb /output/rockylinux-$*/SPECS/$(PACKAGE_NAME).spec
|
-bb /output/rockylinux-$*/SPECS/$(PACKAGE_NAME).spec
|
||||||
cp /output/rockylinux-$*/RPMS/noarch/$(PACKAGE_NAME)-$(VERSION)-1.el$*.noarch.rpm /output/
|
cp /output/rockylinux-$*/RPMS/noarch/$(PACKAGE_NAME)-$(RPM_VERSION).el$*.noarch.rpm /output/
|
||||||
|
|
||||||
# Ubuntu package creation
|
# Ubuntu package creation
|
||||||
actually-package-ubuntu-%:
|
actually-package-ubuntu-%:
|
||||||
$(MAKE) install-systemd DESTDIR=/output/ubuntu-$*
|
$(MAKE) install-systemd DESTDIR=/output/ubuntu-$*
|
||||||
cp -r --preserve=mode DEBIAN /output/ubuntu-$*/
|
cp -r --preserve=mode DEBIAN /output/ubuntu-$*/
|
||||||
dpkg-deb -Zgzip --build /output/ubuntu-$* "/output/$(PACKAGE_NAME)-$(VERSION)-ubuntu-$*.deb"
|
dpkg-deb -Zgzip --build /output/ubuntu-$* "/output/$(PACKAGE_NAME)-$(DEB_VERSION)-ubuntu-$*.deb"
|
||||||
|
|
||||||
# OracleLinux package creation
|
# OracleLinux package creation
|
||||||
actually-package-oraclelinux-%:
|
actually-package-oraclelinux-%:
|
||||||
mkdir -p /output/oraclelinux-$*/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
|
mkdir -p /output/oraclelinux-$*/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
|
||||||
sed -e "s/@@VERSION@@/$(VERSION)/g" RPM/$(PACKAGE_NAME)-el7.spec > /output/oraclelinux-$*/SPECS/$(PACKAGE_NAME).spec
|
sed -e "s/@@VERSION@@/$(VERSION)/g" -e "s/@@RELEASE@@/$(RPM_RELEASE)/g" RPM/$(PACKAGE_NAME)-el7.spec > /output/oraclelinux-$*/SPECS/$(PACKAGE_NAME).spec
|
||||||
rpmbuild --define '_topdir /output/oraclelinux-$*' \
|
rpmbuild --define '_topdir /output/oraclelinux-$*' \
|
||||||
--define 'version $(VERSION)' \
|
--define 'version $(RPM_VERSION)' \
|
||||||
-bb /output/oraclelinux-$*/SPECS/$(PACKAGE_NAME).spec
|
-bb /output/oraclelinux-$*/SPECS/$(PACKAGE_NAME).spec
|
||||||
cp /output/oraclelinux-$*/RPMS/noarch/$(PACKAGE_NAME)-$(VERSION)-1.el$*.noarch.rpm /output/
|
cp /output/oraclelinux-$*/RPMS/noarch/$(PACKAGE_NAME)-$(RPM_VERSION).el$*.noarch.rpm /output/
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
Name: pgmon
|
Name: pgmon
|
||||||
Version: @@VERSION@@
|
Version: @@VERSION@@
|
||||||
Release: 1%{?dist}
|
Release: @@RELEASE@@%{?dist}
|
||||||
Summary: A bridge to sit between monitoring tools and PostgreSQL
|
Summary: A bridge to sit between monitoring tools and PostgreSQL
|
||||||
|
|
||||||
License: MIT
|
License: MIT
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
Name: pgmon
|
Name: pgmon
|
||||||
Version: @@VERSION@@
|
Version: @@VERSION@@
|
||||||
Release: 1%{?dist}
|
Release: @@RELEASE@@%{?dist}
|
||||||
Summary: A bridge to sit between monitoring tools and PostgreSQL
|
Summary: A bridge to sit between monitoring tools and PostgreSQL
|
||||||
|
|
||||||
License: MIT
|
License: MIT
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ metrics:
|
|||||||
query:
|
query:
|
||||||
0: >
|
0: >
|
||||||
SELECT host(client_addr) || '_' || regexp_replace(application_name, '[ ,]', '_', 'g') AS repid,
|
SELECT host(client_addr) || '_' || regexp_replace(application_name, '[ ,]', '_', 'g') AS repid,
|
||||||
|
application_name,
|
||||||
client_addr,
|
client_addr,
|
||||||
state
|
state
|
||||||
FROM pg_stat_replication
|
FROM pg_stat_replication
|
||||||
@@ -197,7 +198,7 @@ metrics:
|
|||||||
0: >
|
0: >
|
||||||
SELECT state,
|
SELECT state,
|
||||||
count(*) AS backend_count,
|
count(*) AS backend_count,
|
||||||
COALESCE(EXTRACT(EPOCH FROM max(now() - state_change)) 0) AS max_state_time
|
COALESCE(EXTRACT(EPOCH FROM max(now() - state_change)), 0) AS max_state_time
|
||||||
FROM pg_stat_activity
|
FROM pg_stat_activity
|
||||||
WHERE datname = %(dbname)s
|
WHERE datname = %(dbname)s
|
||||||
GROUP BY state
|
GROUP BY state
|
||||||
@@ -226,7 +227,7 @@ metrics:
|
|||||||
type: row
|
type: row
|
||||||
query:
|
query:
|
||||||
100000: >
|
100000: >
|
||||||
SELECT COUNT(*) FILTER (WHERE has_sequence_privilege(c.oid, 'SELECT,USAGE')) AS readable_sequences,
|
SELECT COUNT(*) FILTER (WHERE has_sequence_privilege(c.oid, 'SELECT,USAGE')) AS visible_sequences,
|
||||||
COUNT(*) AS total_sequences
|
COUNT(*) AS total_sequences
|
||||||
FROM pg_class AS c
|
FROM pg_class AS c
|
||||||
WHERE relkind = 'S';
|
WHERE relkind = 'S';
|
||||||
|
|||||||
15
src/pgmon.py
15
src/pgmon.py
@@ -29,7 +29,7 @@ import re
|
|||||||
|
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
|
|
||||||
VERSION = "1.0.3"
|
VERSION = "1.0.4"
|
||||||
|
|
||||||
# Configuration
|
# Configuration
|
||||||
config = {}
|
config = {}
|
||||||
@@ -400,7 +400,7 @@ def json_encode_special(obj):
|
|||||||
"""
|
"""
|
||||||
if isinstance(obj, Decimal):
|
if isinstance(obj, Decimal):
|
||||||
return float(obj)
|
return float(obj)
|
||||||
raise TypeError(f'Cannot serialize object of {type(obj)}')
|
raise TypeError(f"Cannot serialize object of {type(obj)}")
|
||||||
|
|
||||||
|
|
||||||
def run_query_no_retry(pool, return_type, query, args):
|
def run_query_no_retry(pool, return_type, query, args):
|
||||||
@@ -424,7 +424,9 @@ def run_query_no_retry(pool, return_type, query, args):
|
|||||||
elif return_type == "column":
|
elif return_type == "column":
|
||||||
if len(res) == 0:
|
if len(res) == 0:
|
||||||
return "[]"
|
return "[]"
|
||||||
return json.dumps([list(r.values())[0] for r in res], default=json_encode_special)
|
return json.dumps(
|
||||||
|
[list(r.values())[0] for r in res], default=json_encode_special
|
||||||
|
)
|
||||||
elif return_type == "set":
|
elif return_type == "set":
|
||||||
return json.dumps(res, default=json_encode_special)
|
return json.dumps(res, default=json_encode_special)
|
||||||
except:
|
except:
|
||||||
@@ -667,7 +669,12 @@ def test_queries():
|
|||||||
for name, metric in config["metrics"].items():
|
for name, metric in config["metrics"].items():
|
||||||
# If the metric has arguments to use while testing, grab those
|
# If the metric has arguments to use while testing, grab those
|
||||||
args = metric.get("test_args", {})
|
args = metric.get("test_args", {})
|
||||||
print("Testing {} [{}]".format(name, ", ".join(["{}={}".format(key, value) for key, value in args.items()])))
|
print(
|
||||||
|
"Testing {} [{}]".format(
|
||||||
|
name,
|
||||||
|
", ".join(["{}={}".format(key, value) for key, value in args.items()]),
|
||||||
|
)
|
||||||
|
)
|
||||||
# When testing against a docker container, we may end up connecting
|
# When testing against a docker container, we may end up connecting
|
||||||
# before the service is truly up (it restarts during the initialization
|
# before the service is truly up (it restarts during the initialization
|
||||||
# phase). To cope with this, we'll allow a few connection failures.
|
# phase). To cope with this, we'll allow a few connection failures.
|
||||||
|
|||||||
@@ -795,17 +795,17 @@ metrics:
|
|||||||
|
|
||||||
def test_json_encode_special(self):
|
def test_json_encode_special(self):
|
||||||
# Confirm that we're getting the right type
|
# Confirm that we're getting the right type
|
||||||
self.assertFalse(isinstance(Decimal('0.5'), float))
|
self.assertFalse(isinstance(Decimal("0.5"), float))
|
||||||
self.assertTrue(isinstance(pgmon.json_encode_special(Decimal('0.5')), float))
|
self.assertTrue(isinstance(pgmon.json_encode_special(Decimal("0.5")), float))
|
||||||
|
|
||||||
# Make sure we get sane values
|
# Make sure we get sane values
|
||||||
self.assertEqual(pgmon.json_encode_special(Decimal('0.5')), 0.5)
|
self.assertEqual(pgmon.json_encode_special(Decimal("0.5")), 0.5)
|
||||||
self.assertEqual(pgmon.json_encode_special(Decimal('12')), 12.0)
|
self.assertEqual(pgmon.json_encode_special(Decimal("12")), 12.0)
|
||||||
|
|
||||||
# Make sure we can still fail for other types
|
# Make sure we can still fail for other types
|
||||||
self.assertRaises(
|
self.assertRaises(TypeError, pgmon.json_encode_special, object)
|
||||||
TypeError, pgmon.json_encode_special, object
|
|
||||||
)
|
|
||||||
|
|
||||||
# Make sure we can actually serialize a Decimal
|
# Make sure we can actually serialize a Decimal
|
||||||
self.assertEqual(json.dumps(Decimal('2.5'), default=pgmon.json_encode_special), '2.5')
|
self.assertEqual(
|
||||||
|
json.dumps(Decimal("2.5"), default=pgmon.json_encode_special), "2.5"
|
||||||
|
)
|
||||||
|
|||||||
@@ -167,7 +167,8 @@ zabbix_export:
|
|||||||
operator: NOT_MATCHES_REGEX
|
operator: NOT_MATCHES_REGEX
|
||||||
formulaid: A
|
formulaid: A
|
||||||
lifetime: 30d
|
lifetime: 30d
|
||||||
enabled_lifetime_type: DISABLE_NEVER
|
enabled_lifetime_type: DISABLE_AFTER
|
||||||
|
enabled_lifetime: 1d
|
||||||
item_prototypes:
|
item_prototypes:
|
||||||
- uuid: a30babe4a6f4440bba2a3ee46eff7ce2
|
- uuid: a30babe4a6f4440bba2a3ee46eff7ce2
|
||||||
name: 'Time spent executing statements on {#DBNAME}'
|
name: 'Time spent executing statements on {#DBNAME}'
|
||||||
@@ -785,6 +786,77 @@ zabbix_export:
|
|||||||
value: PostgreSQL
|
value: PostgreSQL
|
||||||
- tag: Database
|
- tag: Database
|
||||||
value: '{#DBNAME}'
|
value: '{#DBNAME}'
|
||||||
|
- uuid: 5960120dd01c4926b0fc1fbe9c011507
|
||||||
|
name: 'Database max sequence usage in {#DBNAME}'
|
||||||
|
type: HTTP_AGENT
|
||||||
|
key: 'pgmon_db_max_sequence[{#DBNAME}]'
|
||||||
|
delay: 5m
|
||||||
|
value_type: FLOAT
|
||||||
|
units: '%'
|
||||||
|
description: 'The percent of the currently configured value range for the most utilized sequence.'
|
||||||
|
url: 'http://localhost:{$AGENT_PORT}/sequence_usage'
|
||||||
|
query_fields:
|
||||||
|
- name: dbname
|
||||||
|
value: '{#DBNAME}'
|
||||||
|
tags:
|
||||||
|
- tag: Application
|
||||||
|
value: PostgreSQL
|
||||||
|
- tag: Database
|
||||||
|
value: '{#DBNAME}'
|
||||||
|
- uuid: 48b9cc80ac4d4aee9e9f3a5d6f7d4a95
|
||||||
|
name: 'Total number of sequences on {#DBNAME}'
|
||||||
|
type: DEPENDENT
|
||||||
|
key: 'pgmon_db_sequences[total,{#DBNAME}]'
|
||||||
|
delay: '0'
|
||||||
|
description: 'Total number of sequences in the database.'
|
||||||
|
preprocessing:
|
||||||
|
- type: JSONPATH
|
||||||
|
parameters:
|
||||||
|
- $.total_sequences
|
||||||
|
master_item:
|
||||||
|
key: 'pgmon_db_sequence_visibility[{#DBNAME}]'
|
||||||
|
tags:
|
||||||
|
- tag: Application
|
||||||
|
value: PostgreSQL
|
||||||
|
- tag: Database
|
||||||
|
value: '{#DBNAME}'
|
||||||
|
- uuid: 6521a9bab2ac47bf85429832d289bbac
|
||||||
|
name: 'Visible sequences on {#DBNAME}'
|
||||||
|
type: DEPENDENT
|
||||||
|
key: 'pgmon_db_sequences[visible,{#DBNAME}]'
|
||||||
|
delay: '0'
|
||||||
|
description: 'Number of sequences in the database for which Zabbix can see stats.'
|
||||||
|
preprocessing:
|
||||||
|
- type: JSONPATH
|
||||||
|
parameters:
|
||||||
|
- $.visible_sequences
|
||||||
|
master_item:
|
||||||
|
key: 'pgmon_db_sequence_visibility[{#DBNAME}]'
|
||||||
|
tags:
|
||||||
|
- tag: Application
|
||||||
|
value: PostgreSQL
|
||||||
|
- tag: Database
|
||||||
|
value: '{#DBNAME}'
|
||||||
|
- uuid: 00f2da3eb99940839410a6ecd5df153f
|
||||||
|
name: 'Database sequence visibility in {#DBNAME}'
|
||||||
|
type: HTTP_AGENT
|
||||||
|
key: 'pgmon_db_sequence_visibility[{#DBNAME}]'
|
||||||
|
delay: 30m
|
||||||
|
history: '0'
|
||||||
|
value_type: TEXT
|
||||||
|
trends: '0'
|
||||||
|
description: 'Statistics about the number of sequences that exist and the number Zabbix can actually see stats for.'
|
||||||
|
url: 'http://localhost:{$AGENT_PORT}/sequence_visibility'
|
||||||
|
query_fields:
|
||||||
|
- name: dbname
|
||||||
|
value: '{#DBNAME}'
|
||||||
|
tags:
|
||||||
|
- tag: Application
|
||||||
|
value: PostgreSQL
|
||||||
|
- tag: Database
|
||||||
|
value: '{#DBNAME}'
|
||||||
|
- tag: Type
|
||||||
|
value: Raw
|
||||||
- uuid: 492b3cac15f348c2b85f97b69c114d1b
|
- uuid: 492b3cac15f348c2b85f97b69c114d1b
|
||||||
name: 'Database Stats for {#DBNAME}'
|
name: 'Database Stats for {#DBNAME}'
|
||||||
type: HTTP_AGENT
|
type: HTTP_AGENT
|
||||||
@@ -803,6 +875,17 @@ zabbix_export:
|
|||||||
value: '{#DBNAME}'
|
value: '{#DBNAME}'
|
||||||
- tag: Type
|
- tag: Type
|
||||||
value: Raw
|
value: Raw
|
||||||
|
trigger_prototypes:
|
||||||
|
- uuid: d29d0fd9d9d34b5ebd649592b0829ce5
|
||||||
|
expression: 'last(/PostgreSQL by pgmon/pgmon_db_sequences[total,{#DBNAME}]) <> last(/PostgreSQL by pgmon/pgmon_db_sequences[visible,{#DBNAME}])'
|
||||||
|
name: 'Sequences not visible to Zabbix on {#DBNAME}'
|
||||||
|
priority: WARNING
|
||||||
|
description: 'There are sequences for which Zabbix cannot see usage statistics'
|
||||||
|
tags:
|
||||||
|
- tag: Application
|
||||||
|
value: PostgreSQL
|
||||||
|
- tag: Component
|
||||||
|
value: Sequence
|
||||||
graph_prototypes:
|
graph_prototypes:
|
||||||
- uuid: 1f7de43b77714f819e61c31273712b70
|
- uuid: 1f7de43b77714f819e61c31273712b70
|
||||||
name: 'DML Totals for {#DBNAME}'
|
name: 'DML Totals for {#DBNAME}'
|
||||||
@@ -900,6 +983,9 @@ zabbix_export:
|
|||||||
type: DEPENDENT
|
type: DEPENDENT
|
||||||
key: pgmon_discover_io_backend_types
|
key: pgmon_discover_io_backend_types
|
||||||
delay: '0'
|
delay: '0'
|
||||||
|
lifetime: 30d
|
||||||
|
enabled_lifetime_type: DISABLE_AFTER
|
||||||
|
enabled_lifetime: 1h
|
||||||
item_prototypes:
|
item_prototypes:
|
||||||
- uuid: b1ac2e56b30f4812bf33ce973ef16b10
|
- uuid: b1ac2e56b30f4812bf33ce973ef16b10
|
||||||
name: 'I/O Evictions by {#BACKEND_TYPE}'
|
name: 'I/O Evictions by {#BACKEND_TYPE}'
|
||||||
@@ -1490,8 +1576,15 @@ zabbix_export:
|
|||||||
type: HTTP_AGENT
|
type: HTTP_AGENT
|
||||||
key: pgmon_discover_rep
|
key: pgmon_discover_rep
|
||||||
delay: 10m
|
delay: 10m
|
||||||
|
filter:
|
||||||
|
conditions:
|
||||||
|
- macro: '{#APPLICATION_NAME}'
|
||||||
|
value: '^pg_[0-9]+_sync_[0-9]+_[0-9]+$'
|
||||||
|
operator: NOT_MATCHES_REGEX
|
||||||
|
formulaid: A
|
||||||
lifetime: 30d
|
lifetime: 30d
|
||||||
enabled_lifetime_type: DISABLE_NEVER
|
enabled_lifetime_type: DISABLE_AFTER
|
||||||
|
enabled_lifetime: 7d
|
||||||
item_prototypes:
|
item_prototypes:
|
||||||
- uuid: 3a5a60620e6a4db694e47251148d82f5
|
- uuid: 3a5a60620e6a4db694e47251148d82f5
|
||||||
name: 'Flush lag for {#REPID}'
|
name: 'Flush lag for {#REPID}'
|
||||||
@@ -1500,6 +1593,7 @@ zabbix_export:
|
|||||||
delay: '0'
|
delay: '0'
|
||||||
history: 90d
|
history: 90d
|
||||||
value_type: FLOAT
|
value_type: FLOAT
|
||||||
|
units: s
|
||||||
description: 'Time elapsed between flushing recent WAL locally and receiving notification that this standby server has written and flushed it (but not yet applied it). This can be used to gauge the delay that synchronous_commit level on incurred while committing if this server was configured as a synchronous standby.'
|
description: 'Time elapsed between flushing recent WAL locally and receiving notification that this standby server has written and flushed it (but not yet applied it). This can be used to gauge the delay that synchronous_commit level on incurred while committing if this server was configured as a synchronous standby.'
|
||||||
preprocessing:
|
preprocessing:
|
||||||
- type: JSONPATH
|
- type: JSONPATH
|
||||||
@@ -1515,13 +1609,12 @@ zabbix_export:
|
|||||||
- tag: Database
|
- tag: Database
|
||||||
value: '{#DBNAME}'
|
value: '{#DBNAME}'
|
||||||
- uuid: 624f8f085a3642c9a10a03361c17763d
|
- uuid: 624f8f085a3642c9a10a03361c17763d
|
||||||
name: 'Last flush LSN for {#REPID}'
|
name: 'Last flush LSN lag for {#REPID}'
|
||||||
type: DEPENDENT
|
type: DEPENDENT
|
||||||
key: 'pgmon_rep[flush_lsn,repid={#REPID}]'
|
key: 'pgmon_rep[flush_lsn,repid={#REPID}]'
|
||||||
delay: '0'
|
delay: '0'
|
||||||
history: 90d
|
history: 90d
|
||||||
value_type: TEXT
|
units: B
|
||||||
trends: '0'
|
|
||||||
description: 'Last write-ahead log location flushed to disk by this standby server'
|
description: 'Last write-ahead log location flushed to disk by this standby server'
|
||||||
preprocessing:
|
preprocessing:
|
||||||
- type: JSONPATH
|
- type: JSONPATH
|
||||||
@@ -1543,6 +1636,7 @@ zabbix_export:
|
|||||||
delay: '0'
|
delay: '0'
|
||||||
history: 90d
|
history: 90d
|
||||||
value_type: FLOAT
|
value_type: FLOAT
|
||||||
|
units: s
|
||||||
description: 'Time elapsed between flushing recent WAL locally and receiving notification that this standby server has written, flushed and applied it. This can be used to gauge the delay that synchronous_commit level remote_apply incurred while committing if this server was configured as a synchronous standby.'
|
description: 'Time elapsed between flushing recent WAL locally and receiving notification that this standby server has written, flushed and applied it. This can be used to gauge the delay that synchronous_commit level remote_apply incurred while committing if this server was configured as a synchronous standby.'
|
||||||
preprocessing:
|
preprocessing:
|
||||||
- type: JSONPATH
|
- type: JSONPATH
|
||||||
@@ -1558,13 +1652,12 @@ zabbix_export:
|
|||||||
- tag: Database
|
- tag: Database
|
||||||
value: '{#DBNAME}'
|
value: '{#DBNAME}'
|
||||||
- uuid: fe1bed51845d4694bae8f53deed4846d
|
- uuid: fe1bed51845d4694bae8f53deed4846d
|
||||||
name: 'Last replay LSN for {#REPID}'
|
name: 'Last replay LSN lag for {#REPID}'
|
||||||
type: DEPENDENT
|
type: DEPENDENT
|
||||||
key: 'pgmon_rep[replay_lsn,repid={#REPID}]'
|
key: 'pgmon_rep[replay_lsn,repid={#REPID}]'
|
||||||
delay: '0'
|
delay: '0'
|
||||||
history: 90d
|
history: 90d
|
||||||
value_type: TEXT
|
units: B
|
||||||
trends: '0'
|
|
||||||
description: 'Last write-ahead log location replayed into the database on this standby server'
|
description: 'Last write-ahead log location replayed into the database on this standby server'
|
||||||
preprocessing:
|
preprocessing:
|
||||||
- type: JSONPATH
|
- type: JSONPATH
|
||||||
@@ -1580,13 +1673,12 @@ zabbix_export:
|
|||||||
- tag: Database
|
- tag: Database
|
||||||
value: '{#DBNAME}'
|
value: '{#DBNAME}'
|
||||||
- uuid: 68c179d0e33f45f9bf82d2d4125763f0
|
- uuid: 68c179d0e33f45f9bf82d2d4125763f0
|
||||||
name: 'Last sent LSN for {#REPID}'
|
name: 'Last sent LSN lag for {#REPID}'
|
||||||
type: DEPENDENT
|
type: DEPENDENT
|
||||||
key: 'pgmon_rep[sent_lsn,repid={#REPID}]'
|
key: 'pgmon_rep[sent_lsn,repid={#REPID}]'
|
||||||
delay: '0'
|
delay: '0'
|
||||||
history: 90d
|
history: 90d
|
||||||
value_type: TEXT
|
units: B
|
||||||
trends: '0'
|
|
||||||
description: 'Last write-ahead log location sent on this connection'
|
description: 'Last write-ahead log location sent on this connection'
|
||||||
preprocessing:
|
preprocessing:
|
||||||
- type: JSONPATH
|
- type: JSONPATH
|
||||||
@@ -1636,6 +1728,7 @@ zabbix_export:
|
|||||||
delay: '0'
|
delay: '0'
|
||||||
history: 90d
|
history: 90d
|
||||||
value_type: FLOAT
|
value_type: FLOAT
|
||||||
|
units: s
|
||||||
description: 'Time elapsed between flushing recent WAL locally and receiving notification that this standby server has written it (but not yet flushed it or applied it). This can be used to gauge the delay that synchronous_commit level remote_write incurred while committing if this server was configured as a synchronous standby.'
|
description: 'Time elapsed between flushing recent WAL locally and receiving notification that this standby server has written it (but not yet flushed it or applied it). This can be used to gauge the delay that synchronous_commit level remote_write incurred while committing if this server was configured as a synchronous standby.'
|
||||||
preprocessing:
|
preprocessing:
|
||||||
- type: JSONPATH
|
- type: JSONPATH
|
||||||
@@ -1651,13 +1744,12 @@ zabbix_export:
|
|||||||
- tag: Database
|
- tag: Database
|
||||||
value: '{#DBNAME}'
|
value: '{#DBNAME}'
|
||||||
- uuid: 57fb03cf63af4b0a91d8e36d6ff64d30
|
- uuid: 57fb03cf63af4b0a91d8e36d6ff64d30
|
||||||
name: 'Last write LSN for {#REPID}'
|
name: 'Last write LSN lag for {#REPID}'
|
||||||
type: DEPENDENT
|
type: DEPENDENT
|
||||||
key: 'pgmon_rep[write_lsn,repid={#REPID}]'
|
key: 'pgmon_rep[write_lsn,repid={#REPID}]'
|
||||||
delay: '0'
|
delay: '0'
|
||||||
history: 90d
|
history: 90d
|
||||||
value_type: TEXT
|
units: B
|
||||||
trends: '0'
|
|
||||||
description: 'Time elapsed between flushing recent WAL locally and receiving notification that this standby server has written it (but not yet flushed it or applied it). This can be used to gauge the delay that synchronous_commit level remote_write incurred while committing if this server was configured as a synchronous standby.'
|
description: 'Time elapsed between flushing recent WAL locally and receiving notification that this standby server has written it (but not yet flushed it or applied it). This can be used to gauge the delay that synchronous_commit level remote_write incurred while committing if this server was configured as a synchronous standby.'
|
||||||
preprocessing:
|
preprocessing:
|
||||||
- type: JSONPATH
|
- type: JSONPATH
|
||||||
@@ -1694,6 +1786,8 @@ zabbix_export:
|
|||||||
value: Raw
|
value: Raw
|
||||||
url: 'http://localhost:{$AGENT_PORT}/discover_rep'
|
url: 'http://localhost:{$AGENT_PORT}/discover_rep'
|
||||||
lld_macro_paths:
|
lld_macro_paths:
|
||||||
|
- lld_macro: '{#APPLICATION_NAME}'
|
||||||
|
path: $.application_name
|
||||||
- lld_macro: '{#CLIENT_ADDR}'
|
- lld_macro: '{#CLIENT_ADDR}'
|
||||||
path: $.client_addr
|
path: $.client_addr
|
||||||
- lld_macro: '{#REPID}'
|
- lld_macro: '{#REPID}'
|
||||||
@@ -1705,6 +1799,15 @@ zabbix_export:
|
|||||||
type: HTTP_AGENT
|
type: HTTP_AGENT
|
||||||
key: pgmon_discover_slots
|
key: pgmon_discover_slots
|
||||||
delay: 10m
|
delay: 10m
|
||||||
|
filter:
|
||||||
|
conditions:
|
||||||
|
- macro: '{#SLOT_NAME}'
|
||||||
|
value: '^pg_[0-9]+_sync_[0-9]+_[0-9]+$'
|
||||||
|
operator: NOT_MATCHES_REGEX
|
||||||
|
formulaid: A
|
||||||
|
lifetime: 30d
|
||||||
|
enabled_lifetime_type: DISABLE_AFTER
|
||||||
|
enabled_lifetime: 7d
|
||||||
item_prototypes:
|
item_prototypes:
|
||||||
- uuid: 536c5f82e3074ddfbfd842b3a2e8d46c
|
- uuid: 536c5f82e3074ddfbfd842b3a2e8d46c
|
||||||
name: 'Slot {#SLOT_NAME} - Confirmed Flushed Bytes Lag'
|
name: 'Slot {#SLOT_NAME} - Confirmed Flushed Bytes Lag'
|
||||||
|
|||||||
Reference in New Issue
Block a user