Compare commits
3 Commits
f716569aa7
...
af3bbf7515
| Author | SHA1 | Date | |
|---|---|---|---|
| af3bbf7515 | |||
| 180fa31d14 | |||
| 39a6a9d23e |
14
src/pgmon.py
14
src/pgmon.py
@ -27,7 +27,7 @@ from urllib.parse import urlparse, parse_qs
|
|||||||
import requests
|
import requests
|
||||||
import re
|
import re
|
||||||
|
|
||||||
VERSION = "1.0.2"
|
VERSION = "1.0.3"
|
||||||
|
|
||||||
# Configuration
|
# Configuration
|
||||||
config = {}
|
config = {}
|
||||||
@ -699,6 +699,18 @@ class SimpleHTTPRequestHandler(BaseHTTPRequestHandler):
|
|||||||
if metric_name == "agent_version":
|
if metric_name == "agent_version":
|
||||||
self._reply(200, VERSION)
|
self._reply(200, VERSION)
|
||||||
return
|
return
|
||||||
|
elif metric_name == "latest_version_info":
|
||||||
|
try:
|
||||||
|
get_latest_version()
|
||||||
|
self._reply(
|
||||||
|
200,
|
||||||
|
json.dumps(
|
||||||
|
{"latest": latest_version, "supported": 1 if release_supported else 0}
|
||||||
|
),
|
||||||
|
)
|
||||||
|
except LatestVersionCheckError as e:
|
||||||
|
log.error("Failed to retrieve latest version information: {}".format(e))
|
||||||
|
self._reply(503, "Failed to retrieve latest version info")
|
||||||
|
|
||||||
# Note: parse_qs returns the values as a list. Since we always expect
|
# Note: parse_qs returns the values as a list. Since we always expect
|
||||||
# single values, just grab the first from each.
|
# single values, just grab the first from each.
|
||||||
|
|||||||
@ -11,6 +11,39 @@ zabbix_export:
|
|||||||
groups:
|
groups:
|
||||||
- name: 'My Templates'
|
- name: 'My Templates'
|
||||||
items:
|
items:
|
||||||
|
- uuid: de1fa757395440118026f4c7a7c4ebbe
|
||||||
|
name: 'PostgreSQL latest supported version'
|
||||||
|
type: DEPENDENT
|
||||||
|
key: pgmon.release.latest
|
||||||
|
delay: '0'
|
||||||
|
preprocessing:
|
||||||
|
- type: JSONPATH
|
||||||
|
parameters:
|
||||||
|
- $.latest
|
||||||
|
master_item:
|
||||||
|
key: 'pgmon[latest_version_info]'
|
||||||
|
tags:
|
||||||
|
- tag: Application
|
||||||
|
value: PostgreSQL
|
||||||
|
- uuid: e1a003317bc043908ee0803704a6e1d0
|
||||||
|
name: 'PostgreSQL release support status'
|
||||||
|
type: DEPENDENT
|
||||||
|
key: pgmon.release.supported
|
||||||
|
delay: '0'
|
||||||
|
preprocessing:
|
||||||
|
- type: JSONPATH
|
||||||
|
parameters:
|
||||||
|
- $.supported
|
||||||
|
master_item:
|
||||||
|
key: 'pgmon[latest_version_info]'
|
||||||
|
tags:
|
||||||
|
- tag: Application
|
||||||
|
value: PostgreSQL
|
||||||
|
triggers:
|
||||||
|
- uuid: 88eac74402d64e7cb853e8cb505b1939
|
||||||
|
expression: 'last(/PostgreSQL by pgmon/pgmon.release.supported)<>1'
|
||||||
|
name: 'PostgreSQL major release is lo longer supported'
|
||||||
|
priority: INFO
|
||||||
- uuid: 763920af8da84db8a9a2667d9653cb21
|
- uuid: 763920af8da84db8a9a2667d9653cb21
|
||||||
name: 'PostgreSQL Agent Version'
|
name: 'PostgreSQL Agent Version'
|
||||||
type: HTTP_AGENT
|
type: HTTP_AGENT
|
||||||
@ -24,6 +57,19 @@ zabbix_export:
|
|||||||
tags:
|
tags:
|
||||||
- tag: Application
|
- tag: Application
|
||||||
value: PostgreSQL
|
value: PostgreSQL
|
||||||
|
- uuid: d890e395fbbc4f2bacbd50e7321fcb9f
|
||||||
|
name: 'PostgreSQL latest version info'
|
||||||
|
type: HTTP_AGENT
|
||||||
|
key: 'pgmon[latest_version_info]'
|
||||||
|
delay: 12h
|
||||||
|
history: '0'
|
||||||
|
value_type: TEXT
|
||||||
|
trends: '0'
|
||||||
|
description: 'Information about the latest PostgreSQL version in the current series'
|
||||||
|
url: 'http://localhost:{$AGENT_PORT}/version'
|
||||||
|
tags:
|
||||||
|
- tag: Application
|
||||||
|
value: PostgreSQL
|
||||||
- uuid: 8706eccb7edc4fa394f552fc31f401a9
|
- uuid: 8706eccb7edc4fa394f552fc31f401a9
|
||||||
name: 'Max Frozen XID Age'
|
name: 'Max Frozen XID Age'
|
||||||
type: HTTP_AGENT
|
type: HTTP_AGENT
|
||||||
@ -911,6 +957,35 @@ zabbix_export:
|
|||||||
path: $.repid
|
path: $.repid
|
||||||
- lld_macro: '{#STATE}'
|
- lld_macro: '{#STATE}'
|
||||||
path: $.state
|
path: $.state
|
||||||
|
- uuid: e22315b0295d4b43aa6b6611ede13e84
|
||||||
|
name: 'Discover Replication Slots'
|
||||||
|
type: HTTP_AGENT
|
||||||
|
key: pgmon_discover_slots
|
||||||
|
delay: 10m
|
||||||
|
item_prototypes:
|
||||||
|
- uuid: a9f53efdce0a4bdc970925f8588e01c5
|
||||||
|
name: 'Replication Slot Stats for {#SLOT_NAME}'
|
||||||
|
type: HTTP_AGENT
|
||||||
|
key: 'pgmon_slot_stats[{#SLOT_NAME}]'
|
||||||
|
history: '0'
|
||||||
|
value_type: TEXT
|
||||||
|
trends: '0'
|
||||||
|
url: 'http://localhost:{$AGENT_PORT}/slot_stats'
|
||||||
|
query_fields:
|
||||||
|
- name: slot
|
||||||
|
value: '{#SLOT_NAME}'
|
||||||
|
url: 'http://localhost:{$AGENT_PORT}/discover_slots'
|
||||||
|
lld_macro_paths:
|
||||||
|
- lld_macro: '{#ACTIVE}'
|
||||||
|
path: $.active
|
||||||
|
- lld_macro: '{#DATABASE}'
|
||||||
|
path: $.database
|
||||||
|
- lld_macro: '{#PLUGIN}'
|
||||||
|
path: $.plugin
|
||||||
|
- lld_macro: '{#SLOT_NAME}'
|
||||||
|
path: $.slot_name
|
||||||
|
- lld_macro: '{#TEMPORARY}'
|
||||||
|
path: $.temporary
|
||||||
macros:
|
macros:
|
||||||
- macro: '{$AGENT_PORT}'
|
- macro: '{$AGENT_PORT}'
|
||||||
value: '5400'
|
value: '5400'
|
||||||
@ -988,3 +1063,22 @@ zabbix_export:
|
|||||||
- type: STRING
|
- type: STRING
|
||||||
name: reference
|
name: reference
|
||||||
value: XSCMZ
|
value: XSCMZ
|
||||||
|
triggers:
|
||||||
|
- uuid: 94ce93c828aa46b4bd4f3732fc7090c6
|
||||||
|
expression: 'last(/PostgreSQL by pgmon/pgmon.release.latest) - last(/PostgreSQL by pgmon/pgmon[version]) >= 1'
|
||||||
|
name: 'PostgreSQL is at least 1 version behind'
|
||||||
|
priority: INFO
|
||||||
|
dependencies:
|
||||||
|
- name: 'PostgreSQL is at least 2 version behind'
|
||||||
|
expression: 'last(/PostgreSQL by pgmon/pgmon.release.latest) - last(/PostgreSQL by pgmon/pgmon[version]) >= 2'
|
||||||
|
- uuid: 2701bcd1223c4ee787f3eca30288e6c6
|
||||||
|
expression: 'last(/PostgreSQL by pgmon/pgmon.release.latest) - last(/PostgreSQL by pgmon/pgmon[version]) >= 2'
|
||||||
|
name: 'PostgreSQL is at least 2 version behind'
|
||||||
|
priority: INFO
|
||||||
|
dependencies:
|
||||||
|
- name: 'PostgreSQL is at least 3 version behind'
|
||||||
|
expression: 'last(/PostgreSQL by pgmon/pgmon.release.latest) - last(/PostgreSQL by pgmon/pgmon[version]) >= 3'
|
||||||
|
- uuid: 3c9adbe8b6f84b3788c6a3e513075df5
|
||||||
|
expression: 'last(/PostgreSQL by pgmon/pgmon.release.latest) - last(/PostgreSQL by pgmon/pgmon[version]) >= 3'
|
||||||
|
name: 'PostgreSQL is at least 3 version behind'
|
||||||
|
priority: INFO
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user