mirror of
https://github.com/neondatabase/neon.git
synced 2026-01-06 21:12:55 +00:00
committed by
GitHub
parent
7eabfc40ee
commit
92e7cd40e8
@@ -13,6 +13,10 @@ commands:
|
|||||||
user: nobody
|
user: nobody
|
||||||
sysvInitAction: respawn
|
sysvInitAction: respawn
|
||||||
shell: 'DATA_SOURCE_NAME="user=cloud_admin sslmode=disable dbname=postgres" /bin/postgres_exporter'
|
shell: 'DATA_SOURCE_NAME="user=cloud_admin sslmode=disable dbname=postgres" /bin/postgres_exporter'
|
||||||
|
- name: sql-exporter
|
||||||
|
user: nobody
|
||||||
|
sysvInitAction: respawn
|
||||||
|
shell: '/bin/sql_exporter -config.file=/etc/sql_exporter.yml'
|
||||||
shutdownHook: |
|
shutdownHook: |
|
||||||
su -p postgres --session-command '/usr/local/bin/pg_ctl stop -D /var/db/postgres/compute/pgdata -m fast --wait -t 10'
|
su -p postgres --session-command '/usr/local/bin/pg_ctl stop -D /var/db/postgres/compute/pgdata -m fast --wait -t 10'
|
||||||
files:
|
files:
|
||||||
@@ -46,6 +50,77 @@ files:
|
|||||||
}
|
}
|
||||||
memory {}
|
memory {}
|
||||||
}
|
}
|
||||||
|
- filename: sql_exporter.yml
|
||||||
|
content: |
|
||||||
|
# Configuration for sql_exporter
|
||||||
|
# Global defaults.
|
||||||
|
global:
|
||||||
|
# If scrape_timeout <= 0, no timeout is set unless Prometheus provides one. The default is 10s.
|
||||||
|
scrape_timeout: 10s
|
||||||
|
# Subtracted from Prometheus' scrape_timeout to give us some headroom and prevent Prometheus from timing out first.
|
||||||
|
scrape_timeout_offset: 500ms
|
||||||
|
# Minimum interval between collector runs: by default (0s) collectors are executed on every scrape.
|
||||||
|
min_interval: 0s
|
||||||
|
# Maximum number of open connections to any one target. Metric queries will run concurrently on multiple connections,
|
||||||
|
# as will concurrent scrapes.
|
||||||
|
max_connections: 1
|
||||||
|
# Maximum number of idle connections to any one target. Unless you use very long collection intervals, this should
|
||||||
|
# always be the same as max_connections.
|
||||||
|
max_idle_connections: 1
|
||||||
|
# Maximum number of maximum amount of time a connection may be reused. Expired connections may be closed lazily before reuse.
|
||||||
|
# If 0, connections are not closed due to a connection's age.
|
||||||
|
max_connection_lifetime: 5m
|
||||||
|
|
||||||
|
# The target to monitor and the collectors to execute on it.
|
||||||
|
target:
|
||||||
|
# Data source name always has a URI schema that matches the driver name. In some cases (e.g. MySQL)
|
||||||
|
# the schema gets dropped or replaced to match the driver expected DSN format.
|
||||||
|
data_source_name: 'postgresql://cloud_admin@127.0.0.1:5432/postgres?sslmode=disable'
|
||||||
|
|
||||||
|
# Collectors (referenced by name) to execute on the target.
|
||||||
|
# Glob patterns are supported (see <https://pkg.go.dev/path/filepath#Match> for syntax).
|
||||||
|
collectors: [neon_collector]
|
||||||
|
|
||||||
|
# Collector files specifies a list of globs. One collector definition is read from each matching file.
|
||||||
|
# Glob patterns are supported (see <https://pkg.go.dev/path/filepath#Match> for syntax).
|
||||||
|
collector_files:
|
||||||
|
- "neon_collector.yml"
|
||||||
|
- filename: neon_collector.yml
|
||||||
|
content: |
|
||||||
|
collector_name: neon_collector
|
||||||
|
metrics:
|
||||||
|
- metric_name: lfc_misses
|
||||||
|
type: gauge
|
||||||
|
help: 'lfc_misses'
|
||||||
|
key_labels:
|
||||||
|
values: [lfc_misses]
|
||||||
|
query: |
|
||||||
|
select lfc_value as lfc_misses from neon.neon_lfc_stats where lfc_key='file_cache_misses';
|
||||||
|
|
||||||
|
- metric_name: lfc_used
|
||||||
|
type: gauge
|
||||||
|
help: 'lfc_used'
|
||||||
|
key_labels:
|
||||||
|
values: [lfc_used]
|
||||||
|
query: |
|
||||||
|
select lfc_value as lfc_used from neon.neon_lfc_stats where lfc_key='file_cache_used';
|
||||||
|
|
||||||
|
- metric_name: lfc_hits
|
||||||
|
type: gauge
|
||||||
|
help: 'lfc_hits'
|
||||||
|
key_labels:
|
||||||
|
values: [lfc_hits]
|
||||||
|
query: |
|
||||||
|
select lfc_value as lfc_hits from neon.neon_lfc_stats where lfc_key='file_cache_hits';
|
||||||
|
|
||||||
|
- metric_name: lfc_writes
|
||||||
|
type: gauge
|
||||||
|
help: 'lfc_writes'
|
||||||
|
key_labels:
|
||||||
|
values: [lfc_writes]
|
||||||
|
query: |
|
||||||
|
select lfc_value as lfc_writes from neon.neon_lfc_stats where lfc_key='file_cache_writes';
|
||||||
|
|
||||||
build: |
|
build: |
|
||||||
# Build cgroup-tools
|
# Build cgroup-tools
|
||||||
#
|
#
|
||||||
@@ -82,6 +157,8 @@ build: |
|
|||||||
|
|
||||||
FROM quay.io/prometheuscommunity/postgres-exporter:v0.12.0 AS postgres-exporter
|
FROM quay.io/prometheuscommunity/postgres-exporter:v0.12.0 AS postgres-exporter
|
||||||
|
|
||||||
|
FROM burningalchemist/sql_exporter:0.13 AS sql-exporter
|
||||||
|
|
||||||
# Build pgbouncer
|
# Build pgbouncer
|
||||||
#
|
#
|
||||||
FROM debian:bullseye-slim AS pgbouncer
|
FROM debian:bullseye-slim AS pgbouncer
|
||||||
@@ -116,13 +193,19 @@ merge: |
|
|||||||
|
|
||||||
COPY cgconfig.conf /etc/cgconfig.conf
|
COPY cgconfig.conf /etc/cgconfig.conf
|
||||||
COPY pgbouncer.ini /etc/pgbouncer.ini
|
COPY pgbouncer.ini /etc/pgbouncer.ini
|
||||||
|
COPY sql_exporter.yml /etc/sql_exporter.yml
|
||||||
|
COPY neon_collector.yml /etc/neon_collector.yml
|
||||||
|
|
||||||
RUN set -e \
|
RUN set -e \
|
||||||
&& chown postgres:postgres /etc/pgbouncer.ini \
|
&& chown postgres:postgres /etc/pgbouncer.ini \
|
||||||
&& chmod 0644 /etc/pgbouncer.ini \
|
&& chmod 0644 /etc/pgbouncer.ini \
|
||||||
&& chmod 0644 /etc/cgconfig.conf
|
&& chmod 0644 /etc/cgconfig.conf \
|
||||||
|
&& chmod 0644 /etc/sql_exporter.yml \
|
||||||
|
&& chmod 0644 /etc/neon_collector.yml
|
||||||
|
|
||||||
COPY --from=libcgroup-builder /libcgroup-install/bin/* /usr/bin/
|
COPY --from=libcgroup-builder /libcgroup-install/bin/* /usr/bin/
|
||||||
COPY --from=libcgroup-builder /libcgroup-install/lib/* /usr/lib/
|
COPY --from=libcgroup-builder /libcgroup-install/lib/* /usr/lib/
|
||||||
COPY --from=libcgroup-builder /libcgroup-install/sbin/* /usr/sbin/
|
COPY --from=libcgroup-builder /libcgroup-install/sbin/* /usr/sbin/
|
||||||
COPY --from=postgres-exporter /bin/postgres_exporter /bin/postgres_exporter
|
COPY --from=postgres-exporter /bin/postgres_exporter /bin/postgres_exporter
|
||||||
|
COPY --from=sql-exporter /bin/sql_exporter /bin/sql_exporter
|
||||||
COPY --from=pgbouncer /usr/local/pgbouncer/bin/pgbouncer /usr/local/bin/pgbouncer
|
COPY --from=pgbouncer /usr/local/pgbouncer/bin/pgbouncer /usr/local/bin/pgbouncer
|
||||||
|
|||||||
Reference in New Issue
Block a user