Conversation
|
I myself prefer my version of pgwatch instead of the prometheus exporter, but maybe it will be useful to someone, thanks for the contribution. I suggest moving the variables to main.yml under Netdata (monitoring section). |
|
It may be worth combining the tasks into one "prometeus" role. |
|
Argee |
|
@vitabaks I’ve refactored the PR—could you take a look and let me know if everything’s good now? |
|
|
||
| ###################################################################### | ||
| # Copied from | ||
| # https://github.com/wrouesnel/postgres_exporter/blob/1afbd62ab194c045a88488d77de2f116400dedb7/queries.yaml |
There was a problem hiding this comment.
It looks like the data state of this commit was 8 years ago. Perhaps newer metrics should be used?
Latest version 0.17.1 / 2025-02-26
There was a problem hiding this comment.
let's update this part, we would not like to add old versions of metrics.
| # node exporter | ||
| node_exporter_version: "1.9.1" | ||
| node_exporter_package_repo: "https://github.com/prometheus/node_exporter/releases/download/v{{ node_exporter_version }}/node_exporter-{{ node_exporter_version }}.linux-{{ prometheus_architecture_map[ansible_architecture] }}.tar.gz" | ||
|
|
||
| # postgres exporter | ||
| postgres_exporter_version: "0.17.1" | ||
| postgres_exporter_package_repo: "https://github.com/prometheus-community/postgres_exporter/releases/download/v{{ postgres_exporter_version }}/postgres_exporter-{{ postgres_exporter_version }}.linux-{{ prometheus_architecture_map[ansible_architecture] }}.tar.gz" | ||
|
|
There was a problem hiding this comment.
I think _version variables can be moved to main.yml, and _package_repo variables we can define them in the task (I don't think anyone will need to redefine this).
| # More options you can specify in the roles/netdata/templates/netdata.conf.j2 | ||
| # https://learn.netdata.cloud/docs/netdata-agent/configuration | ||
|
|
||
| ### Metric ### |
There was a problem hiding this comment.
| ### Metric ### | |
| ### Prometheus ### |
| postgres_exporter_data_source_name: "user={{ postgres_exporter_user }} dbname={{ postgres_exporter_db }} host={{ postgresql_unix_socket_dir }} sslmode=disable" | ||
| postgres_exporter_query_filenames: | ||
| - queries-default.yml | ||
| # - queries-pg_stat_statements.yml |
There was a problem hiding this comment.
| # - queries-pg_stat_statements.yml | |
| - queries-pg_stat_statements.yml |
I suggest setting pg_stat_statements by default
postgresql_extensions:
- { ext: "pg_stat_statements", db: "postgres" }| # - queries-pg_stat_statements.yml | ||
| # - queries-pg_statio_user_tables.yml |
There was a problem hiding this comment.
why do we disable these metrics?
| # {{ ansible_managed }} | ||
|
|
||
| # This requires the pg_stat_statements module (disabled by default) | ||
| # https://www.postgresql.org/docs/9.6/static/pgstatstatements.html |
There was a problem hiding this comment.
| # https://www.postgresql.org/docs/9.6/static/pgstatstatements.html | |
| # https://www.postgresql.org/docs/current/pgstatstatements.html |
| - role: netdata | ||
|
|
||
| - role: prometheus | ||
| when: with_metric_exporters | bool |
There was a problem hiding this comment.
perhaps it is better to rename with_metric_exporters to prometheus_metrics or prometheus_exporters.
Add two new roles to deploy and configure Prometheus exporters: