Database Backend Is Not Running

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Database Backend Is Not Running

Post by tgriep »

Try this to fix it.

Code: Select all

service ndo2db stop
killall -9 ndo2db
rm /usr/local/nagios/var/ndo2db.lock
service ndo2db start
service nagios restart
Then run this and post the output

Code: Select all

 ps -aef |grep ndo2db
Be sure to check out our Knowledgebase for helpful articles and solutions!
mcwhorts
Posts: 60
Joined: Fri Oct 07, 2011 11:59 am

Re: Database Backend Is Not Running

Post by mcwhorts »

ps -aef |grep ndo2db
nagios 2878 1 0 12:14 ? 00:00:00 /usr/local/nagios/bin/ndo2db -c /usr/local/nagios/etc/ndo2db.cfg
nagios 3948 2878 1 12:14 ? 00:00:00 /usr/local/nagios/bin/ndo2db -c /usr/local/nagios/etc/ndo2db.cfg
nagios 3949 3948 16 12:14 ? 00:00:02 /usr/local/nagios/bin/ndo2db -c /usr/local/nagios/etc/ndo2db.cfg
513 4809 7449 0 12:14 pts/2 00:00:00 grep ndo2db

and still the DB backend isn't running.
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Database Backend Is Not Running

Post by tgriep »

It might take a minute to update the status.
In the XI GUI, can you go to Admin > System Status, under the XI System Component Status dashlet, hover your cursor over the Database Backend status icon, does it show a PID number for ndo2db?
Be sure to check out our Knowledgebase for helpful articles and solutions!
mcwhorts
Posts: 60
Joined: Fri Oct 07, 2011 11:59 am

Re: Database Backend Is Not Running

Post by mcwhorts »

When I hover over it,"ndo2db is not running but subsystem locked" is displayed.
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Database Backend Is Not Running

Post by tgriep »

Strange, ndo2db is running.

Can you run the following and post back the results?

Code: Select all

cat /usr/local/nagios/var/ndo2db.lock
cat /etc/init.d/ndo2db
Lets try and restart everything.

Code: Select all

service nagios stop
killall -9 nagios
service ndo2db stop
service mysqld stop
service crond stop
service mysqld start
service ndo2db start
service nagios start
service crond start
Be sure to check out our Knowledgebase for helpful articles and solutions!
mcwhorts
Posts: 60
Joined: Fri Oct 07, 2011 11:59 am

Re: Database Backend Is Not Running

Post by mcwhorts »

cat /usr/local/nagios/var/ndo2db.lock
returned nothing
cat /etc/init.d/ndo2db
returned
#!/bin/sh
#
### BEGIN INIT INFO
# Provides: ndo2db
# Required-Start:
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Nagios NDO2DB Initscript
# Description: Nagios Data Out Daemon
### END INIT INFO

# chkconfig: 345 99 01
#
# File : ndo2db
#
# Author : Jorge Sanchez Aymar ([email protected])
#
# Changelog :
#
# 1999-07-09 Karl DeBisschop <[email protected]>
# - setup for autoconf
# - add reload function
# 1999-08-06 Ethan Galstad <[email protected]>
# - Added configuration info for use with RedHat's chkconfig tool
# per Fran Boon's suggestion
# 1999-08-13 Jim Popovitch <[email protected]>
# - added variable for nagios/var directory
# - cd into nagios/var directory before creating tmp files on startup
# 1999-08-16 Ethan Galstad <[email protected]>
# - Added test for rc.d directory as suggested by Karl DeBisschop
# 2000-07-23 Karl DeBisschop <[email protected]>
# - Clean out redhat macros and other dependencies
# 2003-01-11 Ethan Galstad <[email protected]>
# - Updated su syntax (Gary Miller)
# 2009-07-11 Hendrik Bäcker <[email protected]>
# - Rewrite ndo2db init script, inspired by Sascha Runschke
#
#

status_ndo2db ()
{

pid_ndo2db

if ps -p $Ndo2dbPID > /dev/null 2>&1; then
return 0
else
if test -f $Ndo2dbLockDir/$Ndo2dbLockFile; then
return 2
else
return 1
fi
fi

return 1
}

printstatus_ndo2db()
{
if status_ndo2db $1 $2; then
echo "$servicename (pid $Ndo2dbPID) is running..."
exit 0
elif test $? == 2; then
echo "$servicename is not running but subsystem locked"
exit 1
else
echo "$servicename is not running"
exit 1
fi
}


killproc_ndo2db ()
{

kill $2 $Ndo2dbPID

}


pid_ndo2db ()
{

if test ! -f $Ndo2dbRunFile; then
return 1
fi

Ndo2dbPID=`head -n 1 $Ndo2dbRunFile`
return 0
}


# Source function library
# Solaris doesn't have an rc.d directory, so do a test first
if [ -f /etc/rc.d/init.d/functions ]; then
. /etc/rc.d/init.d/functions
elif [ -f /etc/init.d/functions ]; then
. /etc/init.d/functions
fi

servicename=ndo2db
prefix=/usr/local/nagios
exec_prefix=/usr/local/nagios
Ndo2dbBin=/usr/local/nagios/bin/ndo2db
Ndo2dbCfgFile=/usr/local/nagios/etc/ndo2db.cfg
Ndo2dbVarDir=/usr/local/nagios/var
Ndo2dbRunFile=$Ndo2dbVarDir/ndo2db.lock
#Ndo2dbLockDir=/var/lock/subsys
Ndo2dbLockDir=/usr/local/nagiosxi/var/subsys
Ndo2dbLockFile=ndo2db
Ndo2dbUser=nagios
Ndo2dbGroup=nagios


# Check that ndo2db exists.
if [ ! -f $Ndo2dbBin ]; then
echo "Executable file $Ndo2dbBin not found. Exiting."
exit 1
fi

# Check that ndo2db.cfg exists.
if [ ! -f $Ndo2dbCfgFile ]; then
echo "Configuration file $Ndo2dbCfgFile not found. Exiting."
exit 1
fi

# See how we were called.
case "$1" in

start)
status_ndo2db
if [ $? -eq 0 ]; then
echo "$servicename already started..."
exit 1
fi
echo -n "Starting $servicename:"

rm -f $Ndo2dbLockDir/$Ndo2dbLockFile
rm -f $Ndo2dbVarDir/ndo.sock

touch $Ndo2dbRunFile
chown $Ndo2dbUser:$Ndo2dbGroup $Ndo2dbRunFile
$Ndo2dbBin -c $Ndo2dbCfgFile
if [ -d $Ndo2dbLockDir ]; then
touch $Ndo2dbLockDir/$Ndo2dbLockFile;
chown $Ndo2dbUser:$Ndo2dbGroup $Ndo2dbLockDir/$Ndo2dbLockFile;
fi
echo " done."
exit 0
;;

stop)
status_ndo2db
if ! [ $? -eq 0 ]; then
echo "$servicename was not running... could not stop"
exit 1
fi
echo -n "Stopping $servicename: "

pid_ndo2db
killproc_ndo2db ndo2db

# now we have to wait for ndo2db to exit and remove its
# own Ndo2dbRunFile, otherwise a following "start" could
# happen, and then the exiting ndo2db will remove the
# new Ndo2dbRunFile, allowing multiple ndo2db daemons
# to (sooner or later) run - John Sellens
#echo -n 'Waiting for ndo2db to exit .'
for i in 1 2 3 4 5 6 7 8 9 10 ; do
if status_ndo2db > /dev/null; then
echo -n '.'
sleep 1
else
break
fi
done
if status_ndo2db > /dev/null; then
echo ''
echo 'Warning - $servicename did not exit in a timely manner'
else
echo 'done.'
fi

rm -f $Ndo2dbStatusFile $Ndo2dbRunFile $Ndo2dbLockDir/$Ndo2dbLockFile $Ndo2dbCommandFile
;;

status)
printstatus_ndo2db
;;

restart)
$0 stop
$0 start
;;

*)
echo "Usage: $servicename {start|stop|restart|status}"
exit 1
;;

esac

# End of this script
jolson
Attack Rabbit
Posts: 2560
Joined: Thu Feb 12, 2015 12:40 pm

Re: Database Backend Is Not Running

Post by jolson »

It would be good to see your ndo2db configuration, and to check whether mysql is listening:

Code: Select all

cat /usr/local/nagios/etc/ndo2db.cfg
netstat -na | grep 3306
Twits Blog
Show me a man who lives alone and has a perpetually clean kitchen, and 8 times out of 9 I'll show you a man with detestable spiritual qualities.
mcwhorts
Posts: 60
Joined: Fri Oct 07, 2011 11:59 am

Re: Database Backend Is Not Running

Post by mcwhorts »

#####################################################################
# NDO2DB DAEMON CONFIG FILE
#####################################################################


lock_file=/usr/local/nagiosxi/var/subsys/ndo2db.lock

ndo2db_user=nagios
ndo2db_group=nagios

socket_type=unix

socket_name=/usr/local/nagios/var/ndo.sock

tcp_port=5668


db_servertype=mysql
db_host=localhost
db_port=3306

db_name=nagios
db_prefix=nagios_

db_user=ndoutils
db_pass=n@gweb



## TABLE TRIMMING OPTIONS
# Several database tables containing Nagios event data can become quite large
# over time. Most admins will want to trim these tables and keep only a
# certain amount of data in them. The options below are used to specify the
# age (in MINUTES) that data should be allowd to remain in various tables
# before it is deleted. Using a value of zero (0) for any value means that
# that particular table should NOT be automatically trimmed.

# Keep timed events for 24 hours
max_timedevents_age=1440

# Keep system commands for 1 week
max_systemcommands_age=10080

# Keep service checks for 1 week
max_servicechecks_age=10080

# Keep host checks for 1 week
max_hostchecks_age=10080

# Keep event handlers for 31 days
max_eventhandlers_age=44640





# DEBUG LEVEL
# This option determines how much (if any) debugging information will
# be written to the debug file. OR values together to log multiple
# types of information.
# Values: -1 = Everything
# 0 = Nothing
# 1 = Process info
# 2 = SQL queries

debug_level=0



# DEBUG VERBOSITY
# This option determines how verbose the debug log out will be.
# Values: 0 = Brief output
# 1 = More detailed
# 2 = Very detailed

debug_verbosity=1



# DEBUG FILE
# This option determines where the daemon should write debugging information.

debug_file=/usr/local/nagios/var/ndo2db.debug



# MAX DEBUG FILE SIZE
# This option determines the maximum size (in bytes) of the debug file. If
# the file grows larger than this size, it will be renamed with a .old
# extension. If a file already exists with a .old extension it will
# automatically be deleted. This helps ensure your disk space usage doesn't
# get out of control when debugging.

max_debug_file_size=1000000




netstat -na | grep 3306
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Database Backend Is Not Running

Post by tgriep »

One more thing to run.

Code: Select all

 ll /usr/local/nagiosxi/var/subsys
Be sure to check out our Knowledgebase for helpful articles and solutions!
mcwhorts
Posts: 60
Joined: Fri Oct 07, 2011 11:59 am

Re: Database Backend Is Not Running

Post by mcwhorts »

ll /usr/local/nagiosxi/var/subsys
total 20
drwxr-xr-x 2 nagios nagios 4096 Jul 15 12:51 ./
drwxr-xr-x 4 nagios nagios 4096 Jul 15 12:50 ../
-rw-r--r-- 1 nagios nagios 0 May 1 17:08 0
-rw-r--r-- 1 nagios nagios 204 May 1 17:07 cookie.txt
-rw-r--r-- 1 nagios nagios 0 Jul 15 12:51 nagios
-rw-r--r-- 1 nagios nagios 0 Jul 15 12:51 ndo2db
-rw-r--r-- 1 nagios nagios 6 Jul 15 12:51 ndo2db.lock
-rw-r--r-- 1 nagios nagios 0 Jul 15 10:19 npcd
-rw-r--r-- 1 nagios nagios 4 Jul 15 10:19 npcd.pid
Locked