This discussion has been locked. The information referenced herein may be inaccurate due to age, software updates, or external references.
You can no longer post new replies to this discussion. If you have a similar question you can start a new discussion in this forum.

Custom Alert - PostgreSQL user role expires in N days

Description

As a PostgreSQL administrator, you may be responsible for creating user accounts and groups. You may also be responsible for granting and revoking privileges.  The alert will notify you when a user role is about to expire in N days. 

Alert Definition

To create the alert, click on Alerts > Manage Alerts tab and create a Custom Alert of type Custom SQL Alert - Multiple Numeric Return. Configure the alert with values similar to these:

Alert Name: User role expires in N days

Execution Interval: 1 days

Notification Text: Empty

SQL Statement:

select rolname, EXTRACT(DAYS FROM now()-rolvaliduntil) from pg_roles WHERE rolvaliduntil is not null

Execute Against: Monitored Instance

Units: Days

High Threshold: Min 2, Max 15