PostgreSQL is an open source object-relational database system.
The PostgreSQL monitoring extension captures metrics from a PostgreSQL database and displays them in the AppDynamics Metric Browser.
Before the extension is installed, the prerequisites mentioned here need to be met. Please do not proceed with the extension installation if the specified prerequisites are not met.
target
directory as "PostgreSQLMonitor" and copy the "PostgreSQLMonitor" directory to <MachineAgentHome>/monitors/
<task-arguments>
<argument name="config-file" is-required="true" default-value="monitors/PostgreSQLMonitor/config.yml" />
</task-arguments>
Please place the extension in the "monitors" directory of your Machine Agent installation directory. Do not place the extension in the "extensions" directory of your Machine Agent installation directory.
Note : Please make sure not to use tab (\t) while editing yaml files. You can validate the yaml file using a yaml validator
Configure the extension by editing the config.yml file in <MachineAgentHome>/monitors/PostgreSQLMonitor/
. The metricPrefix of the extension has to be configured as specified here. Please make sure that the right metricPrefix is chosen based on your machine agent deployment, otherwise this could lead to metrics not being visible in the controller.
servers
. Also specify the databases that have to be monitored. You can specify multiple servers in the same config.yml file.
servers:
- displayName: "Local cluster"
host: "127.0.0.1"
useIpv6: "false"
port: "5432"
user: ""
password: ""
encryptedPassword: ""
# optionalConnectionProperties:
# connectTimeout: 100
# tcpKeepAlive: true
databases:
...
- displayName: "Local cluster"
host: "::1"
useIpv6: "true"
port: "5432"
user: ""
password: ""
encryptedPassword: ""
databases:
...
useIpv6: "false"
. Additional connection properties can be set using optionalConnectionProperties
, you can refer here for all connection parameters.databases:
- dbName: "test"
queries:
...
Only queries that start with SELECT are allowed.
The extension supports getting values from multiple columns at once but it can only pull the metrics from the latest value from the row returned.
The name of the metric displayed on the Metric Browser will be the "name" value that is specified in columns.
queries : You can add multiple queries under this field, each query configured will consist of the following
Example, Consider the below query for server Local Cluster
databases:
- dbName: "test"
queries:
# Add where clauses to query to filter databases
- name: "Database Stats"
serverLvlQuery: "true"
queryStmt: "SELECT datname, numbackends
FROM pg_stat_database"
# the columns are the metrics to be extracted
columns:
- name: "datname"
type: "metricPath"
- name: "numbackends"
type: "metricValue"
properties:
alias: "Number of connections"
aggregationType: "OBSERVATION"
timeRollUpType: "AVERAGE"
clusterRollUpType: "INDIVIDUAL"
The above query will return 1 metric, with metric path -
Custom Metrics|Local Cluster|Database Stats|<datname>|Number of connections
. Since the above query has serverLvlQuery: true
dbName won't be a part of the metric path.
Consider the below query for server Local Cluster
databases:
- dbName: "test"
queries:
- name: "Table Stats"
serverLvlQuery: "false"
# add where clause to the query to filter tables
queryStmt: "SELECT relname, seq_scan, seq_tup_read
FROM pg_stat_user_tables where relname = 'myTable'"
columns:
- name: "relname"
type: "metricPath"
- name: "seq_scan"
type: "metricValue"
properties:
alias: "Sequential Scans"
delta: "true"
aggregationType: "OBSERVATION"
timeRollUpType: "AVERAGE"
clusterRollUpType: "INDIVIDUAL"
- name: "seq_tup_read"
type: "metricValue"
properties:
alias: "Tuples fetched by Sequential Scans"
delta: "true"
aggregationType: "OBSERVATION"
timeRollUpType: "AVERAGE"
clusterRollUpType: "INDIVIDUAL"
Assume that this query returns -
relname | seq_scan | seq_tup_read |
---|---|---|
myTable | 10 | 200 |
The above query will return 2 metrics-
Custom Metrics|Local Cluster|test|Table Stats|relname|Sequential Scans = 10
Custom Metrics|Local Cluster|test|Table Stats|relname|Tuples fetched by Sequential Scans = 200
Use the following formula for calculating numberOfThreads
numberOfThreads = for each server (1 + number_of(databases)). For example if you have 1 server and 2 databases then numberOfThreads = 1 + 2 = 3
Please visit this page to get detailed instructions on configuring Metric Path Character sequence replacements in Extensions.
Please visit this page to get detailed instructions on password encryption. The steps in this document will guide you through the whole process.
Workbench is an inbuilt feature provided with each extension in order to assist you to fine tune the extension setup before you actually deploy it on the controller. Please review the following document for how to use the Extensions WorkBench
Please follow the steps listed in the troubleshooting document in order to troubleshoot your issue. These are a set of common issues that customers might have faced during the installation of the extension.
Always feel free to fork and contribute any changes directly via GitHub.
Name | Version |
---|---|
Extension Version | 3.0.2 |
Postgres Version Support | 9.4 or later |
Last Update | 10/08/2021 |
Changes list | ChangeLog |
Note: While extensions are maintained and supported by customers under the open-source licensing model, they interact with agents and Controllers that are subject to AppDynamics’ maintenance and support policy. Some extensions have been tested with AppDynamics 4.5.13+ artifacts, but you are strongly recommended against using versions that are no longer supported.
Owner
Contributors
Categories
Products
AppDynamicsProgramming Languages
JavaLicense
Code Exchange Community
Get help, share code, and collaborate with other developers in the Code Exchange community.View Community