This alert will collect the size of each relation (table) in a Postgres Cluster. This example alert is used only for collecting data and would never alert anyone. This data is provided as input for another custom alert named "Postgres Relation Percent Growth". Also shown below is a query that will allow you to report on this data as collected in the DPA alert tables.
To create this alert, click on Alerts > Manage Alerts tab and create a Custom Alert of type Custom SQL Alert - Multiple Numeric Return making it look similar to this example.
Alert Name: Collect Top 50 Relation (Table) Sizes - Postgres
Execution Interval: 1 Day
Notification Text: <None required>
Available Instances: <choose any Postgres instances>
SELECT nspname || '.' || relname || ' Size=' || pg_size_pretty(pg_relation_size(C.oid)), pg_relation_size(C.oid) FROM pg_class C LEFT JOIN pg_namespace N ON (N.oid = C.relnamespace) WHERE nspname NOT IN ('pg_catalog', 'information_schema') ORDER BY pg_relation_size(C.oid) DESC LIMIT 50;
Execute Against: Monitored Database
High Threshold: Min: -2, Max: -1
REPORTING FROM THIS DATA
The data this alert collects is stored in the DPA alert tables and can be retrieved running a query similar to this.
Note: this query retrieves data collected by this alert for the last 14 days. If the alert name was changed from the default listed above, change the "where a.alertname" part of this query as well.
SolarWinds solutions are rooted in our deep connection to our user base in the THWACK® online community.
More than 150,000 members are here to solve problems, share technology and best practices, and directly
contribute to our product development process.