Skip to content

Simple example of using PostgreSQL exporters

Notifications You must be signed in to change notification settings

akmalovaa/postgresql-exporter-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple example of using PostgreSQL exporters

quay.io/prometheuscommunity/postgres-exporter

A PostgreSQL metric exporter for Prometheus

Used for DB metrics and config info (system monitoring)

burningalchemist/sql_exporter

Database agnostic SQL exporter for Prometheus - for SQL Queries.

Used to create SQL queries to the database, receive and output business metrics (to display real-time data from the database in Grafana)

Run

docker compose up -d

Import demo data for testing

docker compose exec db bash
psql -U pguser -d netflix < /tmp/netflix.sql 

Find the directors with the most movies in the database sql_collectors/netflix.collector.yml:

SELECT 
    director,
    COUNT(*) AS "Number of Movies"
FROM 
    netflix_shows
WHERE 
    type = 'Movie' and director is not null
GROUP BY 
    director
ORDER BY 
    "Number of Movies" DESC
LIMIT 5;

SQL Exporter

sql-exporter

PostgreSQL exporter

postgres-exporter