Compare commits
No commits in common. "1d642d41b2aebd1ce99386bde2f62e6725112b64" and "c0e153108310070dce4127a2887e88295f1c5d6d" have entirely different histories.
1d642d41b2
...
c0e1531083
@ -1,73 +0,0 @@
|
|||||||
# 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
|
|
||||||
|
|
||||||
DESCRIPTION="PostgreSQL monitoring bridge"
|
|
||||||
HOMEPAGE="None"
|
|
||||||
|
|
||||||
LICENSE="BSD"
|
|
||||||
SLOT="0"
|
|
||||||
KEYWORDS="amd64"
|
|
||||||
|
|
||||||
SRC_URI="https://code2.shh-dot-com.org/james/${PN}/archive/v${PV}.tar.bz2 -> ${P}.tar.bz2"
|
|
||||||
|
|
||||||
IUSE="-systemd"
|
|
||||||
|
|
||||||
DEPEND="
|
|
||||||
${PYTHON_DEPS}
|
|
||||||
dev-python/psycopg:2
|
|
||||||
dev-python/pyyaml
|
|
||||||
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
|
|
||||||
}
|
|
||||||
16
Makefile
16
Makefile
@ -1,10 +1,9 @@
|
|||||||
# Package details
|
# Package details
|
||||||
PACKAGE_NAME := pgmon
|
PACKAGE_NAME := pgmon
|
||||||
|
VERSION := 1.0.1
|
||||||
|
|
||||||
SCRIPT := src/$(PACKAGE_NAME).py
|
SCRIPT := src/$(PACKAGE_NAME).py
|
||||||
|
|
||||||
VERSION := $(shell grep -m 1 '^VERSION = ' "$(SCRIPT)" | sed -ne 's/.*"\(.*\)".*/\1/p')
|
|
||||||
|
|
||||||
# Where packages are built
|
# Where packages are built
|
||||||
BUILD_DIR := build
|
BUILD_DIR := build
|
||||||
|
|
||||||
@ -23,7 +22,7 @@ SUPPORTED := ubuntu-20.04 \
|
|||||||
# These targets are the main ones to use for most things.
|
# These targets are the main ones to use for most things.
|
||||||
##
|
##
|
||||||
|
|
||||||
.PHONY: all clean tgz test query-tests install
|
.PHONY: all clean tgz test install
|
||||||
|
|
||||||
|
|
||||||
# Build all packages
|
# Build all packages
|
||||||
@ -65,10 +64,6 @@ clean:
|
|||||||
test:
|
test:
|
||||||
cd src ; python3 -m unittest
|
cd src ; python3 -m unittest
|
||||||
|
|
||||||
# Run query tests
|
|
||||||
query-tests:
|
|
||||||
cd tests ; ./run-tests.sh
|
|
||||||
|
|
||||||
# Install the script at the specified base directory
|
# Install the script at the specified base directory
|
||||||
install:
|
install:
|
||||||
# Set up directories
|
# Set up directories
|
||||||
@ -97,7 +92,7 @@ install:
|
|||||||
|
|
||||||
|
|
||||||
# Run all of the install tests
|
# Run all of the install tests
|
||||||
.PHONY: install-tests debian-%-install-test rockylinux-%-install-test ubuntu-%-install-test gentoo-install-test
|
.PHONY: install-tests debian-%-install-test rockylinux-%-install-test ubuntu-%-install-test
|
||||||
install-tests: $(foreach distro_release, $(SUPPORTED), $(distro_release)-install-test)
|
install-tests: $(foreach distro_release, $(SUPPORTED), $(distro_release)-install-test)
|
||||||
|
|
||||||
|
|
||||||
@ -129,11 +124,6 @@ oraclelinux-%-install-test:
|
|||||||
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)-$(VERSION)-1.el7.noarch.rpm'
|
||||||
|
|
||||||
# Run a Gentoo install test
|
|
||||||
gentoo-install-test:
|
|
||||||
# May impliment this in the future, but would require additional headaches to set up a repo
|
|
||||||
true
|
|
||||||
|
|
||||||
##
|
##
|
||||||
# Container targets
|
# Container targets
|
||||||
#
|
#
|
||||||
|
|||||||
@ -11,7 +11,7 @@ metrics:
|
|||||||
discover_slots:
|
discover_slots:
|
||||||
type: set
|
type: set
|
||||||
query:
|
query:
|
||||||
90400: SELECT slot_name, plugin, slot_type, database, false as temporary, active FROM pg_replication_slots
|
0: SELECT slot_name, plugin, slot_type, database, false as temporary, active FROM pg_replication_slots
|
||||||
100000: SELECT slot_name, plugin, slot_type, database, temporary, active FROM pg_replication_slots
|
100000: SELECT slot_name, plugin, slot_type, database, temporary, active FROM pg_replication_slots
|
||||||
|
|
||||||
# cluster-wide metrics
|
# cluster-wide metrics
|
||||||
@ -20,9 +20,9 @@ metrics:
|
|||||||
query:
|
query:
|
||||||
0: SHOW server_version_num
|
0: SHOW server_version_num
|
||||||
max_frozen_age:
|
max_frozen_age:
|
||||||
type: row
|
type: value
|
||||||
query:
|
query:
|
||||||
0: SELECT max(age(datfrozenxid)), max(mxid_age(datminmxid)) FROM pg_database
|
0: SELECT max(age(datfrozenxid)) FROM pg_database
|
||||||
|
|
||||||
# Per-database metrics
|
# Per-database metrics
|
||||||
db_stats:
|
db_stats:
|
||||||
@ -43,7 +43,7 @@ metrics:
|
|||||||
rep_stats:
|
rep_stats:
|
||||||
type: row
|
type: row
|
||||||
query:
|
query:
|
||||||
90400: SELECT * FROM pg_stat_replication WHERE client_addr || '_' || regexp_replace(application_name, '[ ,]', '_', 'g') = '{repid}'
|
0: SELECT * FROM pg_stat_replication WHERE client_addr || '_' || regexp_replace(application_name, '[ ,]', '_', 'g') = '{repid}'
|
||||||
test_args:
|
test_args:
|
||||||
repid: 127.0.0.1_test_rep
|
repid: 127.0.0.1_test_rep
|
||||||
|
|
||||||
@ -57,7 +57,7 @@ metrics:
|
|||||||
slot_stats:
|
slot_stats:
|
||||||
type: row
|
type: row
|
||||||
query:
|
query:
|
||||||
90400: SELECT active_pid, xmin, pg_xlog_location_diff(pg_current_xlog_location(), restart_lsn) AS restart_bytes, pg_xlog_location_diff(pg_current_xlog_location(), confirmed_flush_lsn) AS confirmed_flush_bytes FROM pg_replication_slots WHERE slot_name = '{slot}'
|
0: SELECT active_pid, xmin, pg_xlog_location_diff(pg_current_xlog_location(), restart_lsn) AS restart_bytes, pg_xlog_location_diff(pg_current_xlog_location(), confirmed_flush_lsn) AS confirmed_flush_bytes FROM pg_replication_slots WHERE slot_name = '{slot}'
|
||||||
100000: SELECT active_pid, xmin, pg_wal_lsn_diff(pg_current_wal_lsn(), restart_lsn) AS restart_bytes, pg_wal_lsn_diff(pg_current_wal_lsn(), confirmed_flush_lsn) AS confirmed_flush_bytes FROM pg_replication_slots WHERE slot_name = '{slot}'
|
100000: SELECT active_pid, xmin, pg_wal_lsn_diff(pg_current_wal_lsn(), restart_lsn) AS restart_bytes, pg_wal_lsn_diff(pg_current_wal_lsn(), confirmed_flush_lsn) AS confirmed_flush_bytes FROM pg_replication_slots WHERE slot_name = '{slot}'
|
||||||
test_args:
|
test_args:
|
||||||
slot: test_slot
|
slot: test_slot
|
||||||
|
|||||||
@ -24,7 +24,7 @@ from http.server import BaseHTTPRequestHandler, HTTPServer
|
|||||||
from http.server import ThreadingHTTPServer
|
from http.server import ThreadingHTTPServer
|
||||||
from urllib.parse import urlparse, parse_qs
|
from urllib.parse import urlparse, parse_qs
|
||||||
|
|
||||||
VERSION = "1.0.2"
|
VERSION = "1.0.1"
|
||||||
|
|
||||||
# Configuration
|
# Configuration
|
||||||
config = {}
|
config = {}
|
||||||
|
|||||||
@ -23,7 +23,7 @@ services:
|
|||||||
test: [ "CMD-SHELL", "pg_controldata /var/lib/postgresql/data/ | grep -q 'in production'" ]
|
test: [ "CMD-SHELL", "pg_controldata /var/lib/postgresql/data/ | grep -q 'in production'" ]
|
||||||
interval: 5s
|
interval: 5s
|
||||||
timeout: 2s
|
timeout: 2s
|
||||||
retries: 20
|
retries: 10
|
||||||
command: >
|
command: >
|
||||||
postgres -c ssl=on
|
postgres -c ssl=on
|
||||||
-c ssl_cert_file='/etc/ssl/certs/ssl-cert-snakeoil.pem'
|
-c ssl_cert_file='/etc/ssl/certs/ssl-cert-snakeoil.pem'
|
||||||
|
|||||||
@ -8,9 +8,8 @@ dbhost: db
|
|||||||
dbport: 5432
|
dbport: 5432
|
||||||
dbuser: postgres
|
dbuser: postgres
|
||||||
|
|
||||||
# The SSL cipher parameters are too old in the 9.2 container, so we allow the tests
|
# Allow some insecure SSL parameters for the 9.2 test
|
||||||
# to be run without encryption
|
ssl_ciphers: DEFAULT@SECLEVEL=1
|
||||||
ssl_mode: prefer
|
|
||||||
|
|
||||||
# Pull in the standard metrics
|
# Pull in the standard metrics
|
||||||
include:
|
include:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user