dwhitfield wrote:You will need to run vacuum on the postgres database. The following commands are different if you are using a version of PostgreSQL before v9. To determine which version you have execute the following command:
Based on that output, execute the commands specific to your version:
Versions BEFORE 9
Code: Select all
echo "vacuum;vacuum analyze;"|psql nagiosxi postgres
service postgresql restart
Versions 9 onwards
Code: Select all
echo "vacuum;vacuum analyze;vacuum full;"|psql nagiosxi postgres
service postgresql restart
To log in the postgres manually, run:
To view the tables, run:
and to exit:
If you tried to run the vacuum on the posgres or you attempted to log in manually in the database, but you see the following error message:
psql: FATAL: database is not accepting commands to avoid wraparound data loss in database "postgres"
HINT: Stop the postmaster and use a standalone backend to vacuum database "postgres".
You may notice either a high CPU usage for the postmaster process, or a repeated error message in the /var/lib/pgsql/data/pg_log file:
transaction ID wrap limit is 2147484146
You can try to fix the issue by running the following command in the command line:
Important: Run the commands one-by-one (don't run them with one go!)
Versions BEFORE PostgreSQL 9
Code: Select all
service postgresql stop
su postgres
echo "VACUUM;" > /tmp/fix.sql
postgres -D /var/lib/pgsql/data nagiosxi < /tmp/fix.sql
postgres -D /var/lib/pgsql/data postgres < /tmp/fix.sql
postgres -D /var/lib/pgsql/data template1 < /tmp/fix.sql
exit
service postgresql start
Note: The commands listed above may not work with some versions of PosgreSQL. If you see the following error:
postgres: invalid argument: "nagiosxi"
You will need to run the following commands instead:
Code: Select all
service postgresql stop
su postgres
echo "VACUUM;" > /tmp/fix.sql
postgres --single -D /var/lib/pgsql/data nagiosxi < /tmp/fix.sql
postgres --single -D /var/lib/pgsql/data postgres < /tmp/fix.sql
postgres --single -D /var/lib/pgsql/data template1 < /tmp/fix.sql
exit
service postgresql start
Versions 9 Onwards
Code: Select all
service postgresql stop
su postgres
echo "VACUUM FULL;" > /tmp/fix.sql
postgres -D /var/lib/pgsql/data nagiosxi < /tmp/fix.sql
postgres -D /var/lib/pgsql/data postgres < /tmp/fix.sql
postgres -D /var/lib/pgsql/data template1 < /tmp/fix.sql
exit
service postgresql start
Note: The commands listed above may not work with some versions of PosgreSQL. If you see the following error:
postgres: invalid argument: "nagiosxi"
You will need to run the following commands instead:
Code: Select all
service postgresql stop
su postgres
echo "VACUUM FULL;" > /tmp/fix.sql
postgres --single -D /var/lib/pgsql/data nagiosxi < /tmp/fix.sql
postgres --single -D /var/lib/pgsql/data postgres < /tmp/fix.sql
postgres --single -D /var/lib/pgsql/data template1 < /tmp/fix.sql
exit
service postgresql start
The vacuum went ok, but did not seem to correct the problem.
I did restart the nagios services and test a second time also.
I tried to schedule a downtime and received this message at the top of that screen:
" One or more scheduled commands could not be sent to Nagios Core."
I tried to set an acknowledgment, the input screen functioned ok with no error messages, but no new acknowledgment showed in the "Acknowledgements and Comments" screen.
The event log did not note any issues related to this either.
# postgres -V
postgres (PostgreSQL) 8.4.20
# echo "vacuum;vacuum analyze;"|psql nagiosxi postgres
VACUUM
VACUUM
# psql nagiosxi nagiosxi
psql (8.4.20)
Type "help" for help.
nagiosxi=> \d
List of relations
Schema | Name | Type | Owner
--------+---------------------------------+----------+----------
public | if_command_id_seq | sequence | nagiosxi
public | if_meta_id_seq | sequence | nagiosxi
public | if_option_id_seq | sequence | nagiosxi
public | if_sysstat_id_seq | sequence | nagiosxi
public | if_user_id_seq | sequence | nagiosxi
public | if_usermeta_id_seq | sequence | nagiosxi
public | xi_auditlog | table | nagiosxi
public | xi_auditlog_auditlog_id_seq | sequence | nagiosxi
public | xi_commands | table | nagiosxi
public | xi_commands_command_id_seq | sequence | nagiosxi
public | xi_eventqueue | table | nagiosxi
public | xi_eventqueue_eventqueue_id_seq | sequence | nagiosxi
public | xi_events | table | nagiosxi
public | xi_events_event_id_seq | sequence | nagiosxi
public | xi_incidents | table | nagiosxi
public | xi_incidents_id_seq | sequence | nagiosxi
public | xi_meta | table | nagiosxi
public | xi_meta_meta_id_seq | sequence | nagiosxi
public | xi_options | table | nagiosxi
public | xi_options_option_id_seq | sequence | nagiosxi
public | xi_sysstat | table | nagiosxi
public | xi_sysstat_sysstat_id_seq | sequence | nagiosxi
public | xi_usermeta | table | nagiosxi
public | xi_usermeta_usermeta_id_seq | sequence | nagiosxi
public | xi_users | table | nagiosxi
public | xi_users_user_id_seq | sequence | nagiosxi
(26 rows)