Monitoring PostgreSQL Server, Postgres replication

Dashboard

Dashboard que coleta as seguintes informações: OS: Linux Métrics: CPU, Memória, Disco, Swap, Processos, Load Averages, PostgreSQL, Postgres Replication
Last updated: 4 months ago

Downloads: 705

  • 1.png
    1.png
  • 3.PNG
    3.PNG
  • 2.PNG
    2.PNG
  • 4.PNG
    4.PNG
  • logo.png
    logo.png

Dashboard que coleta as seguintes informações: OS: Linux Métrics: CPU, Memória, Disco, Swap, Processos, Load Averages, PostgreSQL, Postgres Replication

Collector Configuration Details

Segue abaixo a configuração no telegraf:

###################################################################################

COLETANDO METRICAS GERAIS E DA REPLICAÇÃO NA BASE POSTGRES DO SERVIDOR MASTER

###################################################################################

[[inputs.postgresql]] address = "host=IP_SERVIDOR_MASTER dbname=postgres user=telegraf sslmode=disable" databases = ["postgres"]

[[inputs.postgresql_extensible]] address = "host=IP_SERVIDOR_MASTER dbname=postgres user=telegraf sslmode=disable" databases = ["postgres"]

[[inputs.postgresql_extensible.query]] sqlquery="select count(1) as amount, state from pg_stat_activity where usename != 'telegraf' group by state" version=901 withdbname=false tagvalue="state" measurement="pg_connections"

[[inputs.postgresql_extensible.query]] sqlquery="SELECT schema_name, pg_size_pretty(sum(table_size)::bigint) as disk_space, ((sum(table_size)::bigint) / 1024) / 1024 as size_MB FROM (SELECT pg_catalog.pg_namespace.nspname as schema_name, pg_relation_size(pg_catalog.pg_class.oid) as table_size FROM pg_catalog.pg_class JOIN pg_catalog.pg_namespace ON relnamespace = pg_catalog.pg_namespace.oid) t WHERE t.schema_name not in ('information_schema','pg_catalog','pg_toast') GROUP BY schema_name ORDER BY schema_name" version=901 withdbname=false tagvalue="schema_name" measurement="pg_schemas_size"

[[inputs.postgresql_extensible.query]] sqlquery="select pg_xlog_location_diff(sent_location, write_location)::integer as write_lag, pg_xlog_location_diff(sent_location, flush_location)::integer as flush_lag, pg_xlog_location_diff(sent_location, replay_location)::integer as replay_lag from pg_stat_replication;" version=901 withdbname=false tagvalue="" measurement="pg_stat_replication"

#########################################################################

COLETANDO METRICAS DA REPLICAÇÃO NA BASE POSTGRES DO SERVIDOR SLAVE

#########################################################################

[[inputs.postgresql_extensible]] address = "host=IP_SERVIDOR_SLAVE dbname=postgres user=telegraf sslmode=disable" databases = ["postgres"]

[[inputs.postgresql_extensible.query]] sqlquery="select case when pg_is_in_recovery() is true then 1 else 0 end as is_in_recovery;" version=901 withdbname=false tagvalue="" measurement="pg_is_in_recovery"

[[inputs.postgresql_extensible.query]] sqlquery="SELECT CASE WHEN pg_last_xlog_receive_location() = pg_last_xlog_replay_location() THEN 0 ELSE EXTRACT (EPOCH FROM now() - pg_last_xact_replay_timestamp()) END AS log_delay;" version=901 withdbname=false tagvalue="" measurement="pg_log_delay"