前提条件として、次の3つがインストールされている必要があります。

TelegrafをCoordinator上にインストール

curl -s https://packagecloud.io/install/repositories/wavefront/telegraf/script.rpm.sh | sudo bash
sudo yum install telegraf -y
cat <<EOF | sudo tee -a /etc/telegraf/telegraf.d/10-wavefront.conf
[[outputs.wavefront]]
url = "http://wf-proxy.orb.local:2878"
metric_separator = "."
source_override = ["proxyname", "agent_host", "node_host"]
convert_paths = true
EOF

TelegrafでGreenplumをモニタリング

cat <<'EOF' | sudo tee -a /etc/telegraf/telegraf.d/greenplum.conf

[[inputs.postgresql_extensible]]
name_prefix = "greenplum."
# specify address via a url matching:
# postgres://[user[:password]]@localhost[/dbname]?sslmode=...
# or a simple string:
#   host=localhost user=gpadmin password=... sslmode=... dbname=gpperfmon
#
# All connection parameters are optional.  
# Without the dbname parameter, the driver will default to a database
# with the same name as the user. This dbname is just for instantiating a
# connection with the server and doesn't restrict the databases we are trying
# to grab metrics for.
# 
address = "postgres://gpadmin@localhost/gpperfmon"

# The parameter host specifies the IP address of master host of Greenplum.
# The parameter port specifies the port in which the Greenplum database is configured. It is 5432 by default.
# A list of databases to pull metrics about. If not specified, metrics for all
# databases are gathered.
# databases = ["app_production", "testing"]

## Whether to use prepared statements when connecting to the database.
## This should be set to false when connecting through a PgBouncer instance
## with pool_mode set to transaction.
prepared_statements = false

# Define the toml config where the sql queries are stored.
# New queries can be added, if the withdbname is set to true and there is no
# databases defined in the 'databases field', the sql query is ended by a 'is
# not null' in order to make the query succeed.
# Be careful that the sqlquery must contain the where clause with a part of
# the filtering, the plugin will add a 'IN (dbname list)' clause if the
# withdbname is set to true
# Example :
# The sqlquery : "SELECT * FROM pg_stat_database where datname" become
# "SELECT * FROM pg_stat_database where datname IN ('postgres', 'pgbench')"
# because the databases variable was set to ['postgres', 'pgbench' ] and the
# withdbname was true.
# Be careful that if the withdbname is set to false, you don't have to define
# the where clause (aka with the dbname).
#
# The tagvalue field is used to define custom tags (separated by commas).
# The query is expected to return columns which match the names of the
# defined tags. The values in these columns must be of a string-type,
# a number-type or a blob-type.
[inputs.postgresql_extensible.tags]
cluster_name = "orbstack"
# The parameter cluster_name specifies a unique name for the Greenplum integration.
#
# Structure :
# [[inputs.postgresql_extensible.query]]
# sqlquery string
# version string
# withdbname boolean
# tagvalue string (coma separated)
# timestamp string
# Query Metrics
[[inputs.postgresql_extensible.query]]
sqlquery = "select ctime::timestamptz at time zone 'UTC' as currtime, queries_total, queries_finished, queries_blocked, queries_running, queries_queued from gpmetrics.gpcc_database_history where ctime::timestamptz between NOW() - INTERVAL '1 minutes' and NOW()"
version = 803
withdbname = false
timestamp = "currtime"
# Memory Metrics
[[inputs.postgresql_extensible.query]]
sqlquery = "select ctime::timestamptz at time zone 'UTC' as currtime, total_bytes, bytes_used, bytes_available,hostname, filesystem from gpmetrics.gpcc_disk_history where ctime::timestamptz between NOW() - INTERVAL '1 minutes' and NOW()"
version = 803
withdbname = false
tagvalue = "hostname,filesystem"
timestamp = "currtime"
# Segment Metrics
[[inputs.postgresql_extensible.query]]
sqlquery = "select count(*) as upsegments from pg_catalog.gp_segment_configuration where status = 'u' and content != -1"
version = 803
withdbname = false
tagvalue = ""
[[inputs.postgresql_extensible.query]]
sqlquery = "select count(*) as downsegments from pg_catalog.gp_segment_configuration where status = 'd' and content != -1"
version = 803
withdbname = false
tagvalue = ""
[[inputs.postgresql_extensible.query]]
sqlquery = "select count(*) as preferred_role from pg_catalog.gp_segment_configuration where role = preferred_role and content != -1"
version = 803
withdbname = false
tagvalue = ""
[[inputs.postgresql_extensible.query]]
sqlquery = "select count(*) as nonpreferred_role from pg_catalog.gp_segment_configuration where role != preferred_role and content != -1"
version = 803
withdbname = false
tagvalue = ""
[[inputs.postgresql_extensible.query]]
sqlquery = "select count(*) as mode_synced from pg_catalog.gp_segment_configuration where mode = 's' and content != -1"
version = 803
withdbname = false
tagvalue = ""
[[inputs.postgresql_extensible.query]]
sqlquery = "select count(*) as mode_nonsynced from pg_catalog.gp_segment_configuration where mode != 's' and content != -1"
version = 803
withdbname = false
tagvalue = ""
[[inputs.postgresql_extensible.query]]
sqlquery = "select count(distinct hostname) as segment_hosts from pg_catalog.gp_segment_configuration where content != -1"
version = 803
withdbname = false
tagvalue = ""
[[inputs.postgresql_extensible.query]]
sqlquery = "select extract(epoch from now()-pg_postmaster_start_time()) as uptime"
version = 803
withdbname = false
tagvalue = ""
[[inputs.postgresql_extensible.query]]
sqlquery = "select case when (status = 'u') then 1 else 0 end as status, case when (mode = 's') then 'Synced' else 'Non Synced' end as mode, case when (role = 'p') then 'Primary' else 'Mirror' end as role, case when (preferred_role = 'p') then 'Primary' else 'Mirror' end as preferred_role, address, port, dbid, hostname, content from pg_catalog.gp_segment_configuration where content != -1"
version = 803
withdbname = false
tagvalue = "hostname,port,address,role,preferred_role,dbid,mode,content"
[[inputs.postgresql_extensible.query]]
sqlquery = "select count(*)-1 as connections from pg_stat_activity"
version = 803
withdbname = false
tagvalue = ""
# Host Metrics
[[inputs.postgresql_extensible.query]]
sqlquery="select ctime::timestamptz at time zone 'UTC' as currtime, hostname, cpu_user, cpu_sys, cpu_iowait, cpu_idle, disk_rb_rate, disk_wb_rate, disk_ro_rate, disk_wo_rate, net_rb_rate, net_wb_rate, net_rp_rate, net_wp_rate, load0, load1, load2, swap_total, swap_used, swap_page_in, swap_page_out, quantum from gpmetrics.gpcc_system_history where ctime::timestamptz between NOW() - INTERVAL '1 minutes' and NOW()"
version=803
withdbname=false
tagvalue="hostname"
timestamp="currtime"

EOF
sudo service telegraf start

WavefrontにGreenplumのダッシュボードをインストール

https://docs.wavefront.com/greenplum.html

"Integrations" -> "VMware Tanzu Greenplum"

image image image image image
Found a mistake? Update the entry.
Share this article: