Page 1 of 1

Postgres Table Sizes Alert

Posted: Tue Oct 23, 2018 11:28 am
by TBT
Receiving the following alert on Postgres Table Sizes. Is this something that will recover once nightly DB maintenance is ran or should action be taken? Please advise.

Service: Postgres Table Sizes - nagiosxi
Host: THBYONA212NVLXVM9194
Alias: monitor4
Address: 127.0.0.1
State: CRITICAL
Info:
POSTGRES_RELATION_SIZE CRITICAL: DB nagiosxi (host:127.0.0.1) largest relation is table public.xi_meta: 118 MB
Date/Time: 2018-10-23 12:21:47

Re: Postgres Table Sizes Alert

Posted: Tue Oct 23, 2018 1:50 pm
by benjaminsmith
Hi@TBT

There is could be caused be a number of things. Let's first check the database performance settings in Nagios XI (or post of screen shot of your settings). See the Nagios Database Optimization Guide:
(https://assets.nagios.com/downloads/nag ... zation.pdf)

After checking the settings, are there any errors in the db maintenance log?

Code: Select all

tail /usr/local/nagiosxi/var/dbmaint.log
Lastly, what version of postgres are you using?

Code: Select all

postgres -V

Re: Postgres Table Sizes Alert

Posted: Tue Oct 23, 2018 2:12 pm
by TBT
benjaminsmith wrote:Hi@TBT

There is could be caused be a number of things. Let's first check the database performance settings in Nagios XI (or post of screen shot of your settings). See the Nagios Database Optimization Guide:
(https://assets.nagios.com/downloads/nag ... zation.pdf)

After checking the settings, are there any errors in the db maintenance log?

Code: Select all

tail /usr/local/nagiosxi/var/dbmaint.log
Lastly, what version of postgres are you using?

Code: Select all

postgres -V

I should also mention that we had an outage overnight for roughly 4 hours. Several XI Servers (this one included) could not reach thousands of network elements that are being monitored, however, this one XI Server in particular is the only experiencing the Postgres Table Sizes Alert.

Nagios XI Database
Max Commands Age: 480 Max time in minutes to keep commands.
Max Events Age: 480 Max time in minutes to keep events.
Optimize Interval: 60 Max time in minutes between optimization runs.

tail /usr/local/nagiosxi/var/dbmaint.log
SQL2: Deleted 529 (DELETE FROM xi_meta WHERE meta_id IN (SELECT xi_meta.meta_id FROM xi_meta LEFT JOIN xi_events ON xi_meta.metaobj_id=xi_events.event_id WHERE metatype_id='1' AND event_id IS NULL))
CLEANING nagiosxi TABLE 'auditlog'...
SQL: DELETE FROM xi_auditlog WHERE log_time < 1537729801::abstime::timestamp without time zone
CLEANING nagiosql TABLE 'logbook'...
SQL: DELETE FROM tbl_logbook WHERE time < FROM_UNIXTIME(1540293001)
Repair Complete: Removing Lock File

postgres -V
postgres (PostgreSQL) 8.4.20

Re: Postgres Table Sizes Alert

Posted: Tue Oct 23, 2018 2:50 pm
by benjaminsmith
Ok. That' looks normal.

Let's run vacuum on the postgres database to clean up the database.

Code: Select all

echo "vacuum;vacuum analyze;vacuum full;"|psql nagiosxi postgres

Re: Postgres Table Sizes Alert

Posted: Tue Oct 23, 2018 3:13 pm
by TBT
benjaminsmith wrote:Ok. That' looks normal.

Let's run vacuum on the postgres database to clean up the database.

Code: Select all

echo "vacuum;vacuum analyze;vacuum full;"|psql nagiosxi postgres
Resolved with vacuum.
POSTGRES_RELATION_SIZE OK: DB "nagiosxi" (host:127.0.0.1) largest relation is table "public.xi_meta": 33 MB

Thank you.

Re: Postgres Table Sizes Alert

Posted: Tue Oct 23, 2018 3:27 pm
by benjaminsmith
Thanks for getting back to us, and glad to know that resolved the issue. I will go ahead a close this forum topic.