# PostgresDB remote monitoring extension 2.0

**URL:** <https://community.dynatrace.com/t/postgresdb-remote-monitoring-extension-2-0/45326>\
**Category:** Extensions\
**Tags:** databases, postgresql, extensions, remote-monitoring\
**Created:** [April 26, 2024, 11:07pm UTC](https://community.dynatrace.com/t/postgresdb-remote-monitoring-extension-2-0/45326 "2024-04-26T23:07:10Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ASE](https://avatars.discourse-cdn.com/v4/letter/a/7cd45c/32.png) [@ASE](https://community.dynatrace.com/u/ASE)\
**Post date:** [April 26, 2024, 11:07pm UTC](https://community.dynatrace.com/t/postgresdb-remote-monitoring-extension-2-0/45326/1 "2024-04-26T23:07:10Z")

</div>

We are currently reviewing the new&nbsp;[PostgresDB (remote monitoring)](https://www.dynatrace.com/hub/detail/postgresdb-remote-monitoring/) extension to see if we want to utilize this in our environment and take advantage of what it provides.

It mentions that the Dynatrace database user we need to create would need **superuser** role permissions in order to query/collect WAL metrics.

However, the concern is that the **superuser** role would technically have access to everything else the role inherently has access to.

As a company that follows a “least privilege” policy, is the **superuser** role required?

Could we not create a new role that only has SELECT access to the specific schemas/tables that Dynatrace needs to execute the WAL queries?

---

<div class="post-metadata">

**Author:** ![florent\_duchate](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/florent_duchate/32/12258_2.png) [@florent\_duchate](https://community.dynatrace.com/u/florent_duchate)\
**Post date:** [April 29, 2024, 8:25am UTC](https://community.dynatrace.com/t/postgresdb-remote-monitoring-extension-2-0/45326/2 "2024-04-29T08:25:10Z")

</div>

This is as per Postgres documentation. Only a superuser can access the WAL metrics, this is not our decision but comes from postgres. Our database data source is unable to run any modifications by the way.

If it is still a problem, disable WAL metrics.

---

<div class="post-metadata">

**Author:** ![vagiz\_duseev](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/vagiz_duseev/32/39484_2.png) [@vagiz\_duseev](https://community.dynatrace.com/u/vagiz_duseev)\
**Post date:** [April 29, 2024, 9:40am UTC](https://community.dynatrace.com/t/postgresdb-remote-monitoring-extension-2-0/45326/3 "2024-04-29T09:40:30Z")

</div>

An alternative to using **superuser** &nbsp;would be to grant the&nbsp; **pg\_read\_all\_stats** role to the user. Or, what is even more commonly done, is to grant the&nbsp; **pg\_monitor** role.

Here is an excerpt from the Postgres v15 documentation:

> The&nbsp;pg\_monitor,&nbsp;pg\_read\_all\_settings,&nbsp;pg\_read\_all\_stats&nbsp;and&nbsp;pg\_stat\_scan\_tables&nbsp;roles are intended to allow administrators to easily configure a role for the purpose of monitoring the database server. They grant a set of common privileges allowing the role to read various useful configuration settings, statistics and other system information normally restricted to superusers.
> 
> pg\_monitor: Read/execute various monitoring views and functions. This role is a member of&nbsp;pg\_read\_all\_settings,&nbsp;pg\_read\_all\_stats&nbsp;and&nbsp;pg\_stat\_scan\_tables.

We will look into updating the hub tile with the recommendation of using&nbsp; **pg\_monitor** or&nbsp; **pg\_read\_all\_stats** role.

---

<div class="post-metadata">

**Author:** ![ASE](https://avatars.discourse-cdn.com/v4/letter/a/7cd45c/32.png) [@ASE](https://community.dynatrace.com/u/ASE)\
**Post date:** [April 29, 2024, 5:58pm UTC](https://community.dynatrace.com/t/postgresdb-remote-monitoring-extension-2-0/45326/4 "2024-04-29T17:58:48Z")

</div>

Thank you, Vagiz.

The current documentation states to grant the Dynatrace user the **pg\_monitor** role.

Based on the PostgreSQL info you’ve shared, there is no need to grant the Dynatrace user the **superuser** role. Is this correct?

It looks like the only role the Dynatrace user needs is the **pg\_monitor** role, which is already a member of the **pg\_read\_all\_stats** role.

If this is the case, then this addresses our security concerns.

We just need the “Get started” documentation to be updated accordingly.

Thank you so much for your response.

 ![ASE_0-1714412477434.png](https://global.discourse-cdn.com/dynatrace/original/2X/8/8d273fce81651e7fac5fef927b26a4d71833ba84.png)

---

<div class="post-metadata">

**Author:** ![ASE](https://avatars.discourse-cdn.com/v4/letter/a/7cd45c/32.png) [@ASE](https://community.dynatrace.com/u/ASE)\
**Post date:** [April 29, 2024, 6:01pm UTC](https://community.dynatrace.com/t/postgresdb-remote-monitoring-extension-2-0/45326/5 "2024-04-29T18:01:55Z")

</div>

Thank you for your response.

We want to view/use the WAL metrics.

We just don’t want to make the Dynatrace user a **superuser**.

See Vagiz’s response below.
