Commit with pg_exporter
This commit is contained in:
parent
401cd7a01c
commit
811e12363b
@ -1,4 +1,4 @@
|
|||||||
name: last_version_test_1
|
name: dev
|
||||||
description: A minimal OpenStack Python Pulumi program
|
description: A minimal OpenStack Python Pulumi program
|
||||||
runtime:
|
runtime:
|
||||||
name: python
|
name: python
|
||||||
|
24
config.json
24
config.json
@ -27,6 +27,30 @@
|
|||||||
"network_mode": "testNetwork",
|
"network_mode": "testNetwork",
|
||||||
"ports": [{"internal": 80, "external": 5050}]
|
"ports": [{"internal": 80, "external": 5050}]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "postgres-exporter",
|
||||||
|
"image": "wrouesnel/postgres_exporter:latest",
|
||||||
|
"envs": {
|
||||||
|
"DATA_SOURCE_NAME": "postgresql://admin:admin@admin:5432/admin?sslmode=disable"
|
||||||
|
},
|
||||||
|
"network_mode": "testNetwork",
|
||||||
|
"ports": [
|
||||||
|
{
|
||||||
|
"internal": 9187,
|
||||||
|
"external": 9187
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"volumes": [
|
||||||
|
{
|
||||||
|
"host_path": "./queries.yaml",
|
||||||
|
"container_path": "/etc/postgres_exporter/queries.yaml"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"command": [
|
||||||
|
"--extend.query-path=/etc/postgres_exporter/queries.yaml",
|
||||||
|
"--log.level=debug"
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "odoo",
|
"name": "odoo",
|
||||||
"image": "odoo_custom",
|
"image": "odoo_custom",
|
||||||
|
14
exporter.Dockerfile
Normal file
14
exporter.Dockerfile
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
# Base image: postgres-exporter
|
||||||
|
FROM wrouesnel/postgres_exporter:latest as exporter_custom
|
||||||
|
|
||||||
|
# Add your custom queries.yaml to the image
|
||||||
|
COPY queries.yaml /etc/postgres_exporter/queries.yaml
|
||||||
|
|
||||||
|
# Expose the default port
|
||||||
|
EXPOSE 9187
|
||||||
|
|
||||||
|
# Command to run the exporter with the custom query path
|
||||||
|
CMD [ \
|
||||||
|
"--extend.query-path=/etc/postgres_exporter/queries.yaml", \
|
||||||
|
"--log.level=debug" \
|
||||||
|
]
|
@ -1,8 +1,8 @@
|
|||||||
scrape_configs:
|
scrape_configs:
|
||||||
- job_name: 'postgres'
|
- job_name: 'postgres-exporter'
|
||||||
static_configs:
|
static_configs:
|
||||||
- targets: ['localhost:8000'] # Le script expose les métriques sur ce port
|
- targets: ['postgres-exporter:9187']
|
||||||
|
|
||||||
- job_name: 'odoo'
|
- job_name: 'odoo'
|
||||||
static_configs:
|
static_configs:
|
||||||
- targets: ['localhost:8000'] # Idem pour Odoo
|
- targets: ['localhost:8069'] # Idem pour Odoo
|
||||||
|
15
queries.yaml
Normal file
15
queries.yaml
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
pg_stat_statements:
|
||||||
|
query: "SELECT query, calls, total_exec_time FROM pg_stat_statements"
|
||||||
|
metrics:
|
||||||
|
- name: "pg_stat_statements_total_exec_time"
|
||||||
|
help: "Total execution time of the query"
|
||||||
|
type: "counter"
|
||||||
|
value: "total_exec_time"
|
||||||
|
labels:
|
||||||
|
- "query"
|
||||||
|
- name: "pg_stat_statements_calls"
|
||||||
|
help: "Total number of calls for the query"
|
||||||
|
type: "counter"
|
||||||
|
value: "calls"
|
||||||
|
labels:
|
||||||
|
- "query"
|
Loading…
Reference in New Issue
Block a user