Cannot Login to Nagios After DB repair

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
cdrussell
Posts: 18
Joined: Fri Nov 14, 2014 10:49 am

Cannot Login to Nagios After DB repair

Post by cdrussell »

Not able to logon to Nagios Web page after fixing SQL crash with repairmysql.sh
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Cannot Login to Nagios After DB repair

Post by abrist »

Um, login has nothing to do with that database. What is the exact nature of the error? Do you get the login screen? Does it seem like a bad password?
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
cdrussell
Posts: 18
Joined: Fri Nov 14, 2014 10:49 am

Re: Cannot Login to Nagios After DB repair

Post by cdrussell »

no bad password. screen just refreshes. then i purposefully put a bad password and i do get password error
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Cannot Login to Nagios After DB repair

Post by abrist »

Try to log in again and then get a tail of your apache log and post it here in code wraps:

Code: Select all

tail -50 /var/log/httpd/error_log
Also, try to restart postgres just in case:

Code: Select all

service postgresql restart
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
cdrussell
Posts: 18
Joined: Fri Nov 14, 2014 10:49 am

Re: Cannot Login to Nagios After DB repair

Post by cdrussell »

Attached output
You do not have the required permissions to view the files attached to this post.
cdrussell
Posts: 18
Joined: Fri Nov 14, 2014 10:49 am

Re: Cannot Login to Nagios After DB repair

Post by cdrussell »

service postgresql restart
Stopping postgresql service: [ OK ]
Starting postgresql service: [FAILED]
[root@p26lxpnetm0001 cdrussell]# service postgresql start
Starting postgresql service: [FAILED]
[root@p26lxpnetm0001 cdrussell]#
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Cannot Login to Nagios After DB repair

Post by abrist »

Looks like postgres cannot start. Anything interesting in the startup logs:

Code: Select all

cat /var/lib/pgsql/pgstartup.log
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
cdrussell
Posts: 18
Joined: Fri Nov 14, 2014 10:49 am

Re: Cannot Login to Nagios After DB repair

Post by cdrussell »

The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

The database cluster will be initialized with locale en_US.UTF-8.
The default database encoding has accordingly been set to UTF8.
The default text search configuration will be set to "english".

fixing permissions on existing directory /var/lib/pgsql/data ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 32MB
creating configuration files ... ok
creating template1 database in /var/lib/pgsql/data/base/1 ... ok
initializing pg_authid ... ok
initializing dependencies ... ok
creating system views ... ok
loading system objects' descriptions ... ok
creating conversions ... ok
creating dictionaries ... ok
setting privileges on built-in objects ... ok
creating information schema ... ok
vacuuming database template1 ... ok
copying template1 to template0 ... ok
copying template1 to postgres ... ok

Success. You can now start the database server using:

/usr/bin/postgres -D /var/lib/pgsql/data
or
/usr/bin/pg_ctl -D /var/lib/pgsql/data -l logfile start

LOG: could not bind IPv6 socket: Cannot assign requested address
HINT: Is another postmaster already running on port 5432? If not, wait a few seconds and retry.
LOG: could not bind IPv4 socket: Cannot assign requested address
HINT: Is another postmaster already running on port 5432? If not, wait a few seconds and retry.
WARNING: could not create listen socket for "localhost"
FATAL: could not create any TCP/IP sockets
could not write to log file: No space left on device
could not write to log file: No space left on device
FATAL: could not write lock file "postmaster.pid": No space left on device
FATAL: could not write lock file "postmaster.pid": No space left on device
could not write to log file: No space left on device
FATAL: could not write lock file "postmaster.pid": No space left on device
FATAL: could not write lock file "postmaster.pid": No space left on device
cdrussell
Posts: 18
Joined: Fri Nov 14, 2014 10:49 am

Re: Cannot Login to Nagios After DB repair

Post by cdrussell »

I then try to start the databse server and get this:

postgres cannot access the server configuration file "/var/lib/pgsql/data/postgresql.conf": Permission denied
[cdrussell@p26lxpnetm0001 ~]$ The files belonging to this database system will be owned by user "postgres".
-bash: The: command not found
[cdrussell@p26lxpnetm0001 ~]$ This user must also own the server process.
-bash: This: command not found

The database cluster will be initialized with locale en_US.UTF-8.
[cdrussell@p26lxpnetm0001 ~]$
[cdrussell@p26lxpnetm0001 ~]$ The database cluster will be initialized with locale en_US.UTF-8.
-bash: The: command not found
[cdrussell@p26lxpnetm0001 ~]$ The default database encoding has accordingly been set to UTF8.
-bash: The: command not found
[cdrussell@p26lxpnetm0001 ~]$ The default text search configuration will be set to "english".
-bash: The: command not found
[cdrussell@p26lxpnetm0001 ~]$
[cdrussell@p26lxpnetm0001 ~]$ fixing permissions on existing directory /var/lib/pgsql/data ... ok
-bash: fixing: command not found
[cdrussell@p26lxpnetm0001 ~]$ creating subdirectories ... ok
-bash: creating: command not found
[cdrussell@p26lxpnetm0001 ~]$ selecting default max_connections ... 100
-bash: selecting: command not found
[cdrussell@p26lxpnetm0001 ~]$ selecting default shared_buffers ... 32MB
-bash: selecting: command not found
[cdrussell@p26lxpnetm0001 ~]$ creating configuration files ... ok
-bash: creating: command not found
[cdrussell@p26lxpnetm0001 ~]$ creating template1 database in /var/lib/pgsql/data/base/1 ... ok
-bash: creating: command not found
[cdrussell@p26lxpnetm0001 ~]$ initializing pg_authid ... ok
-bash: initializing: command not found
[cdrussell@p26lxpnetm0001 ~]$ initializing dependencies ... ok
-bash: initializing: command not found
could not write to log file: No space left on device
FATAL: could not write lock file "postmaster.pid": No space left on device
FATAL: could not write lock file "postmaster.pid": No space left on device
[cdrussell@p26lxpnetm0001 ~]$ creating system views ... ok
-bash: creating: command not found
[cdrussell@p26lxpnetm0001 ~]$ loading system objects' descriptions ... ok
> creating conversions ... ok
> creating dictionaries ... ok
> setting privileges on built-in objects ... ok
> creating information schema ... ok
> vacuuming database template1 ... ok
> copying template1 to template0 ... ok
> copying template1 to postgres ... ok
>
> Success. You can now start the database server using:
>
> /usr/bin/postgres -D /var/lib/pgsql/data
> or
> /usr/bin/pg_ctl -D /var/lib/pgsql/data -l logfile start
>
> LOG: could not bind IPv6 socket: Cannot assign requested address
> HINT: Is another postmaster already running on port 5432? If not, wait a few seconds and retry.
> LOG: could not bind IPv4 socket: Cannot assign requested address
> HINT: Is another postmaster already running on port 5432? If not, wait a few seconds and retry.
> WARNING: could not create listen socket for "localhost"
> FATAL: could not create any TCP/IP sockets
> could not write to log file: No space left on device
> could not write to log file: No space left on device
> FATAL: could not write lock file "postmaster.pid": No space left on device
> FATAL: could not write lock file "postmaster.pid": No space left on device
> could not write to log file: No space left on device
> FATAL: could not write lock file "postmaster.pid": No space left on device
> FATAL: could not write lock file "postmaster.pid": No space left on device
>
> ^C
[cdrussell@p26lxpnetm0001 ~]$ /usr/bin/pg_ctl -D /var/lib/pgsql/data -l logfile start
pg_ctl: could not open PID file "/var/lib/pgsql/data/postmaster.pid": Permission denied


Can you tell i am no Linux guru?
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Cannot Login to Nagios After DB repair

Post by lmiltchev »

You may need to run the vacuum on postgres in standalone mode. Try running the following commands one by one:

Code: Select all

service postgresql stop
su postgres
echo "VACUUM FULL;" > /tmp/fix.sql
postgres -D /var/lib/pgsql/data nagiosxi < /tmp/fix.sql
echo "VACUUM FULL;" > /tmp/fix.sql
postgres -D /var/lib/pgsql/data postgres < /tmp/fix.sql
echo "VACUUM FULL;" > /tmp/fix.sql
postgres -D /var/lib/pgsql/data template1 < /tmp/fix.sql
exit
service postgresql start
Let us know if this fixed your problem.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked