nagios db fluch and vacuum script help needed

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
User avatar
benhank
Posts: 1264
Joined: Tue Apr 12, 2011 12:29 pm

nagios db fluch and vacuum script help needed

Post by benhank »

In my relentless pursuit of nagiosisness, I came across this article from waaaaayyyy back:

Code: Select all

http://labs.nagios.com/2011/11/15/nagios-xi-benchmarking-experiments/
I am interested in making a script that does maintenance on my dbs. But when I run the commands :

Code: Select all

psql nagiosxi nagiosxi -c "vacuum;"
psql nagiosxi nagiosxi -c "vacuum analyze;"
psql nagiosxi nagiosxi -c "vacuum full;"
i get:

Code: Select all

 psql nagiosxi nagiosxi -c "vacuum;"
WARNING:  skipping "pg_authid" --- only superuser can vacuum it
WARNING:  skipping "pg_database" --- only superuser can vacuum it
WARNING:  skipping "pg_tablespace" --- only superuser can vacuum it
WARNING:  skipping "pg_pltemplate" --- only superuser can vacuum it
WARNING:  skipping "pg_shdepend" --- only superuser can vacuum it
WARNING:  skipping "pg_shdescription" --- only superuser can vacuum it
WARNING:  skipping "pg_auth_members" --- only superuser can vacuum it
VACUUM
[root@LKENNAGIOST01 ~]# psql nagiosxi nagiosxi -c "vacuum analyze;"
WARNING:  skipping "pg_authid" --- only superuser can vacuum it
WARNING:  skipping "pg_database" --- only superuser can vacuum it
WARNING:  skipping "pg_tablespace" --- only superuser can vacuum it
WARNING:  skipping "pg_pltemplate" --- only superuser can vacuum it
WARNING:  skipping "pg_shdepend" --- only superuser can vacuum it
WARNING:  skipping "pg_shdescription" --- only superuser can vacuum it
WARNING:  skipping "pg_auth_members" --- only superuser can vacuum it
VACUUM
[root@LKENNAGIOST01 ~]# psql nagiosxi nagiosxi -c "vacuum full;"
WARNING:  skipping "pg_authid" --- only superuser can vacuum it
WARNING:  skipping "pg_database" --- only superuser can vacuum it
WARNING:  skipping "pg_tablespace" --- only superuser can vacuum it
WARNING:  skipping "pg_pltemplate" --- only superuser can vacuum it
WARNING:  skipping "pg_shdepend" --- only superuser can vacuum it
WARNING:  skipping "pg_shdescription" --- only superuser can vacuum it
WARNING:  skipping "pg_auth_members" --- only superuser can vacuum it
VACUUM
this is on xi5 latest versions with postgress dbs. Any ideas on what I need to do to make it work?
thanks in advance!
Proudly running:
NagiosXI 5.4.12 2 node Prod Env 2500 hosts, 13,000 services
Nagiosxi 5.5.7(test env) 2500 hosts, 13,000 services
Nagios Logserver 2 node Prod Env 500 objects sending
Nagios Network Analyser
Nagios Fusion
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: nagios db fluch and vacuum script help needed

Post by ssax »

This should work for you:

Code: Select all

psql nagiosxi postgres -c "vacuum;"
psql nagiosxi postgres -c "vacuum analyze;"
psql nagiosxi postgres -c "vacuum full;"

Let us know the results.

Thank you
User avatar
benhank
Posts: 1264
Joined: Tue Apr 12, 2011 12:29 pm

Re: nagios db fluch and vacuum script help needed

Post by benhank »

worked beautifully thanks man!

how do i force it to flush and vacuum mysql?
Proudly running:
NagiosXI 5.4.12 2 node Prod Env 2500 hosts, 13,000 services
Nagiosxi 5.5.7(test env) 2500 hosts, 13,000 services
Nagios Logserver 2 node Prod Env 500 objects sending
Nagios Network Analyser
Nagios Fusion
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: nagios db fluch and vacuum script help needed

Post by ssax »

These should be handled automatically already by the settings in Admin > Performance Settings > Databases, they are the three optimize intervals.
User avatar
benhank
Posts: 1264
Joined: Tue Apr 12, 2011 12:29 pm

Re: nagios db fluch and vacuum script help needed

Post by benhank »

thanks man lock it up!
Proudly running:
NagiosXI 5.4.12 2 node Prod Env 2500 hosts, 13,000 services
Nagiosxi 5.5.7(test env) 2500 hosts, 13,000 services
Nagios Logserver 2 node Prod Env 500 objects sending
Nagios Network Analyser
Nagios Fusion
Locked