{"id":29944,"date":"2022-05-02T16:40:15","date_gmt":"2022-05-02T16:40:15","guid":{"rendered":"https:\/\/www.devopsschool.com\/blog\/?p=29944"},"modified":"2022-12-23T05:53:01","modified_gmt":"2022-12-23T05:53:01","slug":"datadog-integration-with-postgres-for-metric-trace-log","status":"publish","type":"post","link":"https:\/\/www.devopsschool.com\/blog\/datadog-integration-with-postgres-for-metric-trace-log\/","title":{"rendered":"Datadog Integration with Postgres\u00a0For Metric, Trace &#038; Log"},"content":{"rendered":"\n<p>Database Monitoring provides deep visibility into your Postgres databases by exposing query metrics, query samples, explain plans, database states, failovers, and events.<\/p>\n\n\n\n<p>The Agent collects telemetry directly from the database by logging in as a read-only user. Do the following setup to enable Database Monitoring with your Postgres database:<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 1 &#8211; Install Datadog Agent<\/h2>\n\n\n\n<figure class=\"wp-block-embed is-type-wp-embed is-provider-devopsschool-com wp-block-embed-devopsschool-com\"><div class=\"wp-block-embed__wrapper\">\n<blockquote class=\"wp-embedded-content\" data-secret=\"QQczMMtRTq\"><a href=\"https:\/\/www.devopsschool.com\/blog\/how-to-install-datadog-agent-in-ubuntu\/\">How to install datadog agent in ubuntu?<\/a><\/blockquote><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" title=\"&#8220;How to install datadog agent in ubuntu?&#8221; &#8212; DevOpsSchool.com\" src=\"https:\/\/www.devopsschool.com\/blog\/how-to-install-datadog-agent-in-ubuntu\/embed\/#?secret=XHGCTyGcwh#?secret=QQczMMtRTq\" data-secret=\"QQczMMtRTq\" width=\"600\" height=\"338\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe>\n<\/div><\/figure>\n\n\n\n<figure class=\"wp-block-embed is-type-wp-embed is-provider-devopsschool-com wp-block-embed-devopsschool-com\"><div class=\"wp-block-embed__wrapper\">\n<blockquote class=\"wp-embedded-content\" data-secret=\"dB4HCyIxi3\"><a href=\"https:\/\/www.devopsschool.com\/blog\/how-to-install-datadog-agent-in-centos\/\">How to install datadog agent in centos<\/a><\/blockquote><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" title=\"&#8220;How to install datadog agent in centos&#8221; &#8212; DevOpsSchool.com\" src=\"https:\/\/www.devopsschool.com\/blog\/how-to-install-datadog-agent-in-centos\/embed\/#?secret=1mjOLZgkEJ#?secret=dB4HCyIxi3\" data-secret=\"dB4HCyIxi3\" width=\"600\" height=\"338\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe>\n<\/div><\/figure>\n\n\n\n<figure class=\"wp-block-embed is-type-wp-embed is-provider-devopsschool-com wp-block-embed-devopsschool-com\"><div class=\"wp-block-embed__wrapper\">\n<blockquote class=\"wp-embedded-content\" data-secret=\"kzxOXKVB4C\"><a href=\"https:\/\/www.devopsschool.com\/blog\/datadog-agent-setup-in-windows-step-by-step-guide\/\">Datadog Agent Setup in Windows Step by Step Guide<\/a><\/blockquote><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" title=\"&#8220;Datadog Agent Setup in Windows Step by Step Guide&#8221; &#8212; DevOpsSchool.com\" src=\"https:\/\/www.devopsschool.com\/blog\/datadog-agent-setup-in-windows-step-by-step-guide\/embed\/#?secret=nfHELt7bP3#?secret=kzxOXKVB4C\" data-secret=\"kzxOXKVB4C\" width=\"600\" height=\"338\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe>\n<\/div><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Step 2 &#8211; Install and Configure postgresql&nbsp;<\/h2>\n\n\n\n<figure class=\"wp-block-embed is-type-wp-embed is-provider-devopsschool-com wp-block-embed-devopsschool-com\"><div class=\"wp-block-embed__wrapper\">\n<blockquote class=\"wp-embedded-content\" data-secret=\"C3jMTHgkmn\"><a href=\"https:\/\/www.devopsschool.com\/blog\/postgresql-installation-and-configuration-tutorial-guide\/\">postgresql Installation and Configuration Tutorial Guide<\/a><\/blockquote><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" title=\"&#8220;postgresql Installation and Configuration Tutorial Guide&#8221; &#8212; DevOpsSchool.com\" src=\"https:\/\/www.devopsschool.com\/blog\/postgresql-installation-and-configuration-tutorial-guide\/embed\/#?secret=Ikhn2wi4gv#?secret=C3jMTHgkmn\" data-secret=\"C3jMTHgkmn\" width=\"600\" height=\"338\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe>\n<\/div><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Step 3 &#8211; Prepare Postgres &amp; Configurations<\/h2>\n\n\n\n<p>To get started with the PostgreSQL integration, create a read-only&nbsp;<code>datadog<\/code>&nbsp;user with proper access to your PostgreSQL server. Start&nbsp;<code>psql<\/code>&nbsp;on your PostgreSQL database<\/p>\n\n\n\n<p>Connect to the chosen database as a superuser (or another user with sufficient permissions). For example, if your chosen database is <strong>postgres<\/strong>, connect as the <strong>postgres <\/strong>user using <strong>psql <\/strong>by running:<\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p>$ psql -h mydb.example.com -d postgres -U postgres<\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\"><span class=\"hljs-keyword\">For<\/span> PostgreSQL version <span class=\"hljs-number\">10<\/span> <span class=\"hljs-keyword\">and<\/span> above, run:\n\ncreate user datadog with password <span class=\"hljs-string\">'&lt;PASSWORD&gt;'<\/span>;\n\ngrant SELECT ON pg_stat_database to datadog;\n\n<span class=\"hljs-comment\"># Create the following schema in every database:<\/span>\nCREATE SCHEMA datadog;\nGRANT USAGE ON SCHEMA datadog TO datadog;\nGRANT USAGE ON SCHEMA <span class=\"hljs-keyword\">public<\/span> TO datadog;\nGRANT pg_monitor TO datadog;\nCREATE EXTENSION <span class=\"hljs-keyword\">IF<\/span> NOT EXISTS pg_stat_statements;\n\nWhen generating custom metrics that <span class=\"hljs-keyword\">require<\/span> querying additional tables, you may need to grant the SELECT permission on those tables to the datadog user. \n\ngrant SELECT on &lt;TABLE_NAME&gt; to datadog<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p>To verify the permissions are correct, run the following command:<\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\">psql -h localhost -U datadog postgres -c \\\n<span class=\"hljs-string\">\"select * from pg_stat_database LIMIT(1);\"<\/span> \\\n&amp;&amp; <span class=\"hljs-keyword\">echo<\/span> -e <span class=\"hljs-string\">\"\\e&#91;0;32mPostgres connection - OK\\e&#91;0m\"<\/span> \\\n|| <span class=\"hljs-keyword\">echo<\/span> -e <span class=\"hljs-string\">\"\\e&#91;0;31mCannot connect to Postgres\\e&#91;0m\"<\/span>\n\npsql -h localhost -U datadog postgres -A \\\n  -c <span class=\"hljs-string\">\"select * from pg_stat_database limit 1;\"<\/span> \\\n  &amp;&amp; <span class=\"hljs-keyword\">echo<\/span> -e <span class=\"hljs-string\">\"\\e&#91;0;32mPostgres connection - OK\\e&#91;0m\"<\/span> \\\n  || <span class=\"hljs-keyword\">echo<\/span> -e <span class=\"hljs-string\">\"\\e&#91;0;31mCannot connect to Postgres\\e&#91;0m\"<\/span>\n\npsql -h localhost -U datadog postgres -A \\\n  -c <span class=\"hljs-string\">\"select * from pg_stat_activity limit 1;\"<\/span> \\\n  &amp;&amp; <span class=\"hljs-keyword\">echo<\/span> -e <span class=\"hljs-string\">\"\\e&#91;0;32mPostgres pg_stat_activity read OK\\e&#91;0m\"<\/span> \\\n  || <span class=\"hljs-keyword\">echo<\/span> -e <span class=\"hljs-string\">\"\\e&#91;0;31mCannot read from pg_stat_activity\\e&#91;0m\"<\/span>\n\npsql -h localhost -U datadog postgres -A \\\n  -c <span class=\"hljs-string\">\"select * from pg_stat_statements limit 1;\"<\/span> \\\n  &amp;&amp; <span class=\"hljs-keyword\">echo<\/span> -e <span class=\"hljs-string\">\"\\e&#91;0;32mPostgres pg_stat_statements read OK\\e&#91;0m\"<\/span> \\\n  || <span class=\"hljs-keyword\">echo<\/span> -e <span class=\"hljs-string\">\"\\e&#91;0;31mCannot read from pg_stat_statements\\e&#91;0m\"<\/span>\n\nWhen it prompts <span class=\"hljs-keyword\">for<\/span> a password, enter the one used in the first command.<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-2\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p><strong>Note<\/strong>: When generating custom metrics that require querying additional tables, you may need to grant the&nbsp;<code>SELECT<\/code>&nbsp;permission on those tables to the&nbsp;<code>datadog<\/code>&nbsp;user. Example:&nbsp;<code>grant SELECT on &lt;TABLE_NAME&gt; to datadog;<\/code>. Check the FAQ section for more information.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 4 &#8211; Host configure to check for an Agent for Metric collection<\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li>Edit the <strong>postgres.d\/conf.yaml<\/strong> file to point to your host \/ port and set the masters to monitor. <\/li><\/ul>\n\n\n\n<ul class=\"wp-block-list\"><li>Restart the Agent.<\/li><\/ul>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-3\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\">init_config:\ninstances:\n  - dbm: <span class=\"hljs-keyword\">true<\/span>\n    host: localhost\n    port: <span class=\"hljs-number\">5432<\/span>\n    username: datadog\n    password: <span class=\"hljs-string\">'&lt;PASSWORD&gt;'<\/span>\n    <span class=\"hljs-comment\">## Optional: Connect to a different database if needed for `custom_queries`<\/span>\n    <span class=\"hljs-comment\"># dbname: '&lt;DB_NAME&gt;'<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-3\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-4\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\">init_config:\n\ninstances:\n  <span class=\"hljs-comment\">## @param host - string - required<\/span>\n  <span class=\"hljs-comment\">## The hostname to connect to.<\/span>\n  <span class=\"hljs-comment\">## <span class=\"hljs-doctag\">NOTE:<\/span> Even if the server name is \"localhost\", the agent connects to<\/span>\n  <span class=\"hljs-comment\">## PostgreSQL using TCP\/IP, unless you also provide a value for the sock key.<\/span>\n  <span class=\"hljs-comment\">#<\/span>\n  - host: localhost\n\n    <span class=\"hljs-comment\">## @param port - integer - required<\/span>\n    <span class=\"hljs-comment\">## Port to use when connecting to PostgreSQL.<\/span>\n    <span class=\"hljs-comment\">#<\/span>\n    port: <span class=\"hljs-number\">5432<\/span>\n\n    <span class=\"hljs-comment\">## @param user - string - required<\/span>\n    <span class=\"hljs-comment\">## Datadog Username created to connect to PostgreSQL.<\/span>\n    <span class=\"hljs-comment\">#<\/span>\n    username: datadog\n\n    <span class=\"hljs-comment\">## @param pass - string - required<\/span>\n    <span class=\"hljs-comment\">## Password associated with the Datadog user.<\/span>\n    <span class=\"hljs-comment\">#<\/span>\n    password: <span class=\"hljs-string\">\"&lt;PASSWORD&gt;\"<\/span>\n\n    <span class=\"hljs-comment\">## @param dbname - string - optional - default: postgres<\/span>\n    <span class=\"hljs-comment\">## Name of the PostgresSQL database to monitor.<\/span>\n    <span class=\"hljs-comment\">## <span class=\"hljs-doctag\">Note:<\/span> If omitted, the default system postgres database is queried.<\/span>\n    <span class=\"hljs-comment\">#<\/span>\n    dbname: <span class=\"hljs-string\">\"&lt;DB_NAME&gt;\"<\/span>\n\n    <span class=\"hljs-comment\"># @param disable_generic_tags - boolean - optional - default: false<\/span>\n    <span class=\"hljs-comment\"># The integration will stop sending server tag as is reduntant with host tag<\/span>\n    disable_generic_tags: <span class=\"hljs-keyword\">true<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-4\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Step 5 &#8211; Configure Postgres settings<\/h2>\n\n\n\n<p>Configure the following parameters in the <strong>postgresql.conf<\/strong> file and then<strong> restart the server<\/strong> for the settings to take effect.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"969\" height=\"570\" src=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2022\/05\/image-6.png\" alt=\"\" class=\"wp-image-29945\" srcset=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2022\/05\/image-6.png 969w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2022\/05\/image-6-300x176.png 300w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2022\/05\/image-6-768x452.png 768w\" sizes=\"auto, (max-width: 969px) 100vw, 969px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Step 6 &#8211; verify<\/h2>\n\n\n\n<p><strong>Restart a agent Postgres<\/strong> <\/p>\n\n\n\n<p>$ sudo datadog-agent status<br><strong>Run the Agent\u2019s status subcommand and look for postgres under the Checks section. Or visit the Databases page to get started!<\/strong><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Integrtion metrics <\/h2>\n\n\n\n<p>The following metrics will be tracked by this integration:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Name<\/th><th>Units<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td>postgres.replication_delay_bytes<\/td><td>bytes<\/td><td>Deprecated please use postgresql.replication_delay_bytes instead<\/td><\/tr><tr><td>postgresql.active_queries<\/td><td><\/td><td>The number of active queries in this database.<\/td><\/tr><tr><td>postgresql.active_waiting_queries<\/td><td><\/td><td>The number of waiting queries in this database in state active.<\/td><\/tr><tr><td>postgresql.analyzed<\/td><td><\/td><td>The number of times this table has been manually analyzed.<\/td><\/tr><tr><td>postgresql.autoanalyzed<\/td><td><\/td><td>The number of times this table has been analyzed by the autovacuum daemon.<\/td><\/tr><tr><td>postgresql.autovacuumed<\/td><td><\/td><td>The number of times this table has been vacuumed by the autovacuum daemon.<\/td><\/tr><tr><td>postgresql.before_xid_wraparound<\/td><td>transactions<\/td><td>The number of transactions that can occur until a transaction wraparound.<\/td><\/tr><tr><td>postgresql.bgwriter.buffers_alloc<\/td><td><\/td><td>The number of buffers allocated<\/td><\/tr><tr><td>postgresql.bgwriter.buffers_backend<\/td><td>buffers<\/td><td>The number of buffers written directly by a backend.<\/td><\/tr><tr><td>postgresql.bgwriter.buffers_backend_fsync<\/td><td><\/td><td>The of times a backend had to execute its own fsync call instead of the background writer.<\/td><\/tr><tr><td>postgresql.bgwriter.buffers_checkpoint<\/td><td><\/td><td>The number of buffers written during checkpoints.<\/td><\/tr><tr><td>postgresql.bgwriter.buffers_clean<\/td><td><\/td><td>The number of buffers written by the background writer.<\/td><\/tr><tr><td>postgresql.bgwriter.checkpoints_requested<\/td><td><\/td><td>The number of requested checkpoints that were performed.<\/td><\/tr><tr><td>postgresql.bgwriter.checkpoints_timed<\/td><td><\/td><td>The number of scheduled checkpoints that were performed.<\/td><\/tr><tr><td>postgresql.bgwriter.maxwritten_clean<\/td><td><\/td><td>The number of times the background writer stopped a cleaning scan due to writing too many buffers.<\/td><\/tr><tr><td>postgresql.bgwriter.sync_time<\/td><td>milliseconds<\/td><td>The total amount of checkpoint processing time spent synchronizing files to disk.<\/td><\/tr><tr><td>postgresql.bgwriter.write_time<\/td><td>milliseconds<\/td><td>The total amount of checkpoint processing time spent writing files to disk.<\/td><\/tr><tr><td>postgresql.buffer_hit<\/td><td>hits\/second<\/td><td>The number of times disk blocks were found in the buffer cache, preventing the need to read from the database.<\/td><\/tr><tr><td>postgresql.commits<\/td><td>transactions\/second<\/td><td>The number of transactions that have been committed in this database.<\/td><\/tr><tr><td>postgresql.connections<\/td><td>connections<\/td><td>The number of active connections to this database. If DBM is enabled, this metric is tagged with state, app, db and user<\/td><\/tr><tr><td>postgresql.database_size<\/td><td>bytes<\/td><td>The disk space used by this database.<\/td><\/tr><tr><td>postgresql.db.count<\/td><td>items<\/td><td>The number of available databases.<\/td><\/tr><tr><td>postgresql.dead_rows<\/td><td>rows<\/td><td>The estimated number of dead rows.<\/td><\/tr><tr><td>postgresql.deadlocks<\/td><td><\/td><td>The number of deadlocks detected in this database<\/td><\/tr><tr><td>postgresql.disk_read<\/td><td>blocks\/second<\/td><td>The number of disk blocks read in this database.<\/td><\/tr><tr><td>postgresql.function.calls<\/td><td><\/td><td>The number of calls made to a function.<\/td><\/tr><tr><td>postgresql.heap_blocks_hit<\/td><td>hits\/second<\/td><td>The number of buffer hits in this table.<\/td><\/tr><tr><td>postgresql.heap_blocks_read<\/td><td>blocks\/second<\/td><td>The number of disk blocks read from this table.<\/td><\/tr><tr><td>postgresql.index_bloat<\/td><td>percent<\/td><td>The estimated percentage of index bloat.<\/td><\/tr><tr><td>postgresql.index_blocks_hit<\/td><td>hits\/second<\/td><td>The number of buffer hits in all indexes on this table.<\/td><\/tr><tr><td>postgresql.index_blocks_read<\/td><td>blocks\/second<\/td><td>The number of disk blocks read from all indexes on this table.<\/td><\/tr><tr><td>postgresql.index_rel_rows_fetched<\/td><td>rows\/second<\/td><td>The number of live rows fetched by index scans.<\/td><\/tr><tr><td>postgresql.index_rel_scans<\/td><td><\/td><td>The overall number of index scans initiated on this table.<\/td><\/tr><tr><td>postgresql.index_rows_fetched<\/td><td>rows\/second<\/td><td>The number of live rows fetched by index scans.<\/td><\/tr><tr><td>postgresql.index_rows_read<\/td><td>rows\/second<\/td><td>The number of index entries returned by scans on this index.<\/td><\/tr><tr><td>postgresql.index_scans<\/td><td><\/td><td>The number of index scans initiated on this table, tagged by index.<\/td><\/tr><tr><td>postgresql.index_size<\/td><td>bytes<\/td><td>The total disk space used by indexes attached to the specified table.<\/td><\/tr><tr><td>postgresql.live_rows<\/td><td>rows<\/td><td>The estimated number of live rows.<\/td><\/tr><tr><td>postgresql.locks<\/td><td>locks<\/td><td>The number of locks active for this database.<\/td><\/tr><tr><td>postgresql.max_connections<\/td><td>connections<\/td><td>The maximum number of client connections allowed to this database.<\/td><\/tr><tr><td>postgresql.percent_usage_connections<\/td><td>fractions<\/td><td>The number of connections to this database as a fraction of the maximum number of allowed connections.<\/td><\/tr><tr><td>postgresql.queries.count<\/td><td>queries<\/td><td>The total query execution count per query_signature, db, and user. (DBM only)<\/td><\/tr><tr><td>postgresql.queries.duration.max<\/td><td>nanoseconds<\/td><td>The age of the longest running query per user, db and app. (DBM only)<\/td><\/tr><tr><td>postgresql.queries.duration.sum<\/td><td>nanoseconds<\/td><td>The sum of the age of all running queries per user, db and app. (DBM only)<\/td><\/tr><tr><td>postgresql.queries.local_blks_dirtied<\/td><td>blocks<\/td><td>Total number of local blocks dirtied per query_signature, db, and user. (DBM only)<\/td><\/tr><tr><td>postgresql.queries.local_blks_hit<\/td><td>blocks<\/td><td>Total number of local block cache hits per query_signature, db, and user. (DBM only)<\/td><\/tr><tr><td>postgresql.queries.local_blks_read<\/td><td>blocks<\/td><td>Total number of local blocks read per query_signature, db, and user. (DBM only)<\/td><\/tr><tr><td>postgresql.queries.local_blks_written<\/td><td>blocks<\/td><td>Total number of local blocks written per query_signature, db, and user. (DBM only)<\/td><\/tr><tr><td>postgresql.queries.rows<\/td><td>rows<\/td><td>The total number of rows retrieved or affected per query_signature, db, and user. (DBM only)<\/td><\/tr><tr><td>postgresql.queries.shared_blks_dirtied<\/td><td>blocks<\/td><td>Total number of shared blocks dirtied per query_signature, db, and user. (DBM only)<\/td><\/tr><tr><td>postgresql.queries.shared_blks_hit<\/td><td>blocks<\/td><td>Total number of shared block cache hits per query_signature, db, and user. (DBM only)<\/td><\/tr><tr><td>postgresql.queries.shared_blks_read<\/td><td>blocks<\/td><td>Total number of shared blocks read per query_signature, db, and user. (DBM only)<\/td><\/tr><tr><td>postgresql.queries.shared_blks_written<\/td><td>blocks<\/td><td>Total number of shared blocks written per query_signature, db, and user. (DBM only)<\/td><\/tr><tr><td>postgresql.queries.temp_blks_read<\/td><td>blocks<\/td><td>Total number of temp blocks read per query_signature, db, and user. (DBM only)<\/td><\/tr><tr><td>postgresql.queries.temp_blks_written<\/td><td>blocks<\/td><td>Total number of temp blocks written per query_signature, db, and user. (DBM only)<\/td><\/tr><tr><td>postgresql.queries.time<\/td><td>nanoseconds<\/td><td>The total query execution time per query_signature, db, and user. (DBM only)<\/td><\/tr><tr><td>postgresql.replication.wal_flush_lag<\/td><td>seconds<\/td><td>Time elapsed between flushing recent WAL locally and receiving notification that this standby server has written and flushed it (but not yet applied it). This can be used to gauge the delay that synchronous_commit level on incurred while committing if this server was configured as a synchronous standby. Only available with postgresql 10 and newer.<\/td><\/tr><tr><td>postgresql.replication.wal_replay_lag<\/td><td>seconds<\/td><td>Time elapsed between flushing recent WAL locally and receiving notification that this standby server has written, flushed and applied it. This can be used to gauge the delay that synchronous_commit level remote_apply incurred while committing if this server was configured as a synchronous standby. Only available with postgresql 10 and newer.<\/td><\/tr><tr><td>postgresql.replication.wal_write_lag<\/td><td>seconds<\/td><td>Time elapsed between flushing recent WAL locally and receiving notification that this standby server has written it (but not yet flushed it or applied it). This can be used to gauge the delay that synchronous_commit level remote_write incurred while committing if this server was configured as a synchronous standby. Only available with postgresql 10 and newer.<\/td><\/tr><tr><td>postgresql.replication_delay<\/td><td>seconds<\/td><td>The current replication delay in seconds. Only available with postgresql 9.1 and newer<\/td><\/tr><tr><td>postgresql.replication_delay_bytes<\/td><td>bytes<\/td><td>The current replication delay in bytes. Only available with postgresql 9.2 and newer<\/td><\/tr><tr><td>postgresql.rollbacks<\/td><td>transactions\/second<\/td><td>The number of transactions that have been rolled back in this database.<\/td><\/tr><tr><td>postgresql.rows_deleted<\/td><td>rows\/second<\/td><td>The number of rows deleted by queries in this database<\/td><\/tr><tr><td>postgresql.rows_fetched<\/td><td>rows\/second<\/td><td>The number of rows fetched by queries in this database<\/td><\/tr><tr><td>postgresql.rows_hot_updated<\/td><td>rows\/second<\/td><td>The number of rows HOT updated, meaning no separate index update was needed.<\/td><\/tr><tr><td>postgresql.rows_inserted<\/td><td>rows\/second<\/td><td>The number of rows inserted by queries in this database<\/td><\/tr><tr><td>postgresql.rows_returned<\/td><td>rows\/second<\/td><td>The number of rows returned by queries in this database<\/td><\/tr><tr><td>postgresql.rows_updated<\/td><td>rows\/second<\/td><td>The number of rows updated by queries in this database<\/td><\/tr><tr><td>postgresql.seq_rows_read<\/td><td>rows\/second<\/td><td>The number of live rows fetched by sequential scans.<\/td><\/tr><tr><td>postgresql.seq_scans<\/td><td><\/td><td>The number of sequential scans initiated on this table.<\/td><\/tr><tr><td>postgresql.table.count<\/td><td>tables<\/td><td>The number of user tables in this database.<\/td><\/tr><tr><td>postgresql.table_bloat<\/td><td>percent<\/td><td>The estimated percentage of table bloat.<\/td><\/tr><tr><td>postgresql.table_size<\/td><td>bytes<\/td><td>The total disk space used by the specified table. Includes TOAST, free space map, and visibility map. Excludes indexes.<\/td><\/tr><tr><td>postgresql.temp_bytes<\/td><td>bytes\/second<\/td><td>The amount of data written to temporary files by queries in this database.<\/td><\/tr><tr><td>postgresql.temp_files<\/td><td>files\/second<\/td><td>The number of temporary files created by queries in this database.<\/td><\/tr><tr><td>postgresql.toast_blocks_hit<\/td><td>hits\/second<\/td><td>The number of buffer hits in this table&#8217;s TOAST table.<\/td><\/tr><tr><td>postgresql.toast_blocks_read<\/td><td>blocks\/second<\/td><td>The number of disk blocks read from this table&#8217;s TOAST table.<\/td><\/tr><tr><td>postgresql.toast_index_blocks_hit<\/td><td>blocks\/second<\/td><td>The number of buffer hits in this table&#8217;s TOAST table index.<\/td><\/tr><tr><td>postgresql.toast_index_blocks_read<\/td><td>blocks\/second<\/td><td>The number of disk blocks read from this table&#8217;s TOAST table index.<\/td><\/tr><tr><td>postgresql.total_size<\/td><td>bytes<\/td><td>The total disk space used by the table, including indexes and TOAST data.<\/td><\/tr><tr><td>postgresql.transactions.duration.max<\/td><td>nanoseconds<\/td><td>The age of the longest running transaction per user, db and app. (DBM only)<\/td><\/tr><tr><td>postgresql.transactions.duration.sum<\/td><td>nanoseconds<\/td><td>The sum of the age of all running transactions per user, db and app. (DBM only)<\/td><\/tr><tr><td>postgresql.transactions.idle_in_transaction<\/td><td>transactions<\/td><td>The number of &#8216;idle in transaction&#8217; transactions in this database.<\/td><\/tr><tr><td>postgresql.transactions.open<\/td><td>transactions<\/td><td>The number of open transactions in this database.<\/td><\/tr><tr><td>postgresql.vacuumed<\/td><td><\/td><td>The number of times this table has been manually vacuumed.<\/td><\/tr><tr><td>postgresql.waiting_queries<\/td><td><\/td><td>The number of waiting queries in this database.<\/td><\/tr><tr><td>postgresql.wal_age<\/td><td>seconds<\/td><td>The age in seconds of the oldest WAL file.<\/td><\/tr><\/tbody><\/table><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Database Monitoring provides deep visibility into your Postgres databases by exposing query metrics, query samples, explain plans, database states, failovers, and events. The Agent collects telemetry directly from the database&#8230; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_joinchat":[],"footnotes":""},"categories":[2],"tags":[],"class_list":["post-29944","post","type-post","status-publish","format-standard","hentry","category-uncategorised"],"_links":{"self":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/29944","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/comments?post=29944"}],"version-history":[{"count":4,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/29944\/revisions"}],"predecessor-version":[{"id":29950,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/29944\/revisions\/29950"}],"wp:attachment":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media?parent=29944"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/categories?post=29944"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/tags?post=29944"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}