Compare commits

...

2 Commits

Author SHA1 Message Date
55b9b16deb
Install to /usr/bin
* Standardize all install methods to use /usr/bin rather than some of
  them using /usr/local/bin

* Make the init script executable in install-openrc
2025-06-04 01:16:59 -04:00
6a22597f1f
Fix ID age query and template 2025-06-04 00:47:51 -04:00
6 changed files with 52 additions and 20 deletions

View File

@ -74,12 +74,12 @@ install-common:
# Set up directories # Set up directories
mkdir -p $(DESTDIR)/etc/$(PACKAGE_NAME) mkdir -p $(DESTDIR)/etc/$(PACKAGE_NAME)
mkdir -p ${DESTDIR}/etc/logrotate.d mkdir -p ${DESTDIR}/etc/logrotate.d
mkdir -p $(DESTDIR)/usr/local/bin mkdir -p $(DESTDIR)/usr/bin
mkdir -p $(DESTDIR)/usr/share/man/man1 mkdir -p $(DESTDIR)/usr/share/man/man1
# Install script # Install script
cp $(SCRIPT) $(DESTDIR)/usr/local/bin/$(PACKAGE_NAME) cp $(SCRIPT) $(DESTDIR)/usr/bin/$(PACKAGE_NAME)
chmod 755 $(DESTDIR)/usr/local/bin/$(PACKAGE_NAME) chmod 755 $(DESTDIR)/usr/bin/$(PACKAGE_NAME)
# Install manpage # Install manpage
cp manpages/* $(DESTDIR)/usr/share/man/man1/ cp manpages/* $(DESTDIR)/usr/share/man/man1/
@ -113,6 +113,7 @@ install-openrc:
# Install init script # Install init script
cp openrc/pgmon.initd $(DESTDIR)/etc/init.d/pgmon cp openrc/pgmon.initd $(DESTDIR)/etc/init.d/pgmon
chmod 755 $(DESTDIR)/etc/init.d/pgmon
# Install init script config file # Install init script config file
cp openrc/pgmon.confd $(DESTDIR)/etc/conf.d/pgmon cp openrc/pgmon.confd $(DESTDIR)/etc/conf.d/pgmon

View File

@ -28,7 +28,7 @@ make -C /src install-systemd DESTDIR=%{buildroot}
/etc/pgmon/pgmon-service.conf /etc/pgmon/pgmon-service.conf
/lib/systemd/system/pgmon.service /lib/systemd/system/pgmon.service
/lib/systemd/system/pgmon@.service /lib/systemd/system/pgmon@.service
/usr/local/bin/pgmon /usr/bin/pgmon
/usr/share/man/man1/pgmon.1.gz /usr/share/man/man1/pgmon.1.gz
%post %post

View File

@ -28,7 +28,7 @@ make -C /src install-systemd DESTDIR=%{buildroot}
/etc/pgmon/pgmon-service.conf /etc/pgmon/pgmon-service.conf
/lib/systemd/system/pgmon.service /lib/systemd/system/pgmon.service
/lib/systemd/system/pgmon@.service /lib/systemd/system/pgmon@.service
/usr/local/bin/pgmon /usr/bin/pgmon
/usr/share/man/man1/pgmon.1.gz /usr/share/man/man1/pgmon.1.gz
%post %post

View File

@ -22,7 +22,7 @@ metrics:
max_frozen_age: max_frozen_age:
type: row type: row
query: query:
0: SELECT max(age(datfrozenxid)), max(mxid_age(datminmxid)) FROM pg_database 0: SELECT max(age(datfrozenxid)) AS xid_age, max(mxid_age(datminmxid)) AS mxid_age FROM pg_database
# Per-database metrics # Per-database metrics
db_stats: db_stats:
@ -47,12 +47,6 @@ metrics:
test_args: test_args:
repid: 127.0.0.1_test_rep repid: 127.0.0.1_test_rep
# Debugging
sleep:
type: value
query:
0: SELECT now(), pg_sleep(5);
# Per-slot metrics # Per-slot metrics
slot_stats: slot_stats:
type: row type: row

View File

@ -7,7 +7,7 @@ After=network.target
[Service] [Service]
EnvironmentFile=/etc/pgmon/%i-service.conf EnvironmentFile=/etc/pgmon/%i-service.conf
User=${SERVICE_USER:-postgres} User=${SERVICE_USER:-postgres}
ExecStart=/usr/local/bin/pgmon -c /etc/pgmon/%i.yml ExecStart=/usr/bin/pgmon -c /etc/pgmon/%i.yml
ExecReload=kill -HUP $MAINPID ExecReload=kill -HUP $MAINPID
Restart=on-failure Restart=on-failure
Type=exec Type=exec

View File

@ -11,6 +11,44 @@ zabbix_export:
groups: groups:
- name: 'My Templates' - name: 'My Templates'
items: items:
- uuid: cc4a50ca681b4c4fb8c1c98f4bc81c96
name: 'Max Frozen MXID Age'
type: DEPENDENT
key: pgmon.age.mxid
delay: '0'
history: 90d
description: 'Maximum age of any frozen MXID in any database'
preprocessing:
- type: JSONPATH
parameters:
- $.mxid_age
- type: MATCHES_REGEX
parameters:
- '^[0-9]+$'
master_item:
key: 'pgmon[max_frozen_age]'
tags:
- tag: Application
value: PostgreSQL
- uuid: 2fa86d8c4a3a481e856a9414c5c70216
name: 'Max Frozen XID Age'
type: DEPENDENT
key: pgmon.age.xid
delay: '0'
history: 90d
description: 'Maximum age of any frozen XID in any database'
preprocessing:
- type: JSONPATH
parameters:
- $.xid_age
- type: MATCHES_REGEX
parameters:
- '^[0-9]+$'
master_item:
key: 'pgmon[max_frozen_age]'
tags:
- tag: Application
value: PostgreSQL
- uuid: de1fa757395440118026f4c7a7c4ebbe - uuid: de1fa757395440118026f4c7a7c4ebbe
name: 'PostgreSQL latest supported version' name: 'PostgreSQL latest supported version'
type: DEPENDENT type: DEPENDENT
@ -71,15 +109,14 @@ zabbix_export:
- tag: Application - tag: Application
value: PostgreSQL value: PostgreSQL
- uuid: 8706eccb7edc4fa394f552fc31f401a9 - uuid: 8706eccb7edc4fa394f552fc31f401a9
name: 'Max Frozen XID Age' name: 'PostgreSQL ID Age Info'
type: HTTP_AGENT type: HTTP_AGENT
key: 'pgmon[max_frozen_age]' key: 'pgmon[max_frozen_age]'
history: 90d delay: 5m
description: 'Maximum age of any frozen XID in any database' history: '0'
preprocessing: value_type: TEXT
- type: MATCHES_REGEX trends: '0'
parameters: description: 'Maximum age of any frozen XID and MXID in any database'
- '^[0-9]+$'
url: 'http://localhost:{$AGENT_PORT}/max_frozen_age' url: 'http://localhost:{$AGENT_PORT}/max_frozen_age'
tags: tags:
- tag: Application - tag: Application