Upgrading from 3.5.1 to 4.0.0

An open discussion forum for obtaining help with Nagios Core. Nagios Core users of all experience levels are welcome here. Subforum have been created for the discussion of Nagios Core and Nagios Plugin development.

NOTE: The SourceForge.net mailing lists have been deprecated in favor of this forum in order to expedite support and provide additional features not available on the old mailing list.

Re: Upgrading from 3.5.1 to 4.0.0

Postby mlong » Mon Sep 23, 2013 5:32 pm

abrist wrote:They are just warnings. Lets see if it works. If not, it is time to post a bug report at: tracker.nagios.org. But try to reinstall first anyways.


Well that seems to have worked. I ran the configure script, then make all (still receivedthe warnings), and make install.
then I ran
Code: Select all
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

and received this (excluding things that reference my servers)
Code: Select all
Nagios Core 4.0.0                                                                                                             
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors                                           
Copyright (c) 1999-2009 Ethan Galstad                                                                                         
Last Modified: 09-20-2013                                                                                                     
License: GPL                                                                                                                 
                                                                                                                             
Website: http://www.nagios.org                                                                                               
Reading configuration data...                                                                                                 
Warning: use_embedded_perl_implicitly is deprecated and will be removed.                                                     
Warning: enable_embedded_perl is deprecated and will be removed.                                                             
Warning: p1_file is deprecated and will be removed.                                                                           
Warning: sleep_time is deprecated and will be removed.                                                                       
Warning: external_command_buffer_slots is deprecated and will be removed. All commands are always processed upon arrival     
Warning: command_check_interval is deprecated and will be removed. Commands are always handled on arrival                     
   Read main config file okay...                                                                                             
Warning: failure_prediction_enabled is obsoleted and no longer has any effect in host type objects (config file '/usr/local/na
giosql/hosttemplates.cfg', starting at line 14)                                                                               
Warning: failure_prediction_enabled is obsoleted and no longer has any effect in service type objects (config file '/usr/local
/nagiosql/servicetemplates.cfg', starting at line 14)

---Redacted---

Running pre-flight check on configuration data...                                                                             
                                                                                                                             
Checking objects...                                                                                                           
        Checked 221 services.                                                                                                 
        Checked 42 hosts.                                                                                                     
        Checked 23 host groups.                                                                                               
        Checked 13 service groups.                                                                                           
        Checked 16 contacts.                                                                                                 
        Checked 4 contact groups.                                                                                             
        Checked 41 commands.                                                                                                 
        Checked 5 time periods.                                                                                               
        Checked 0 host escalations.                                                                                           
        Checked 0 service escalations.                                                                                       
Checking for circular paths...                                                                                               
        Checked 42 hosts                                                                                                     
        Checked 0 service dependencies                                                                                       
        Checked 0 host dependencies                                                                                           
        Checked 5 timeperiods                                                                                                 
Checking global event handlers...                                                                                             
Checking obsessive compulsive processor commands...                                                                           
Checking misc settings...                                                                                                     
                                                                                                                             
Total Warnings: 0                                                                                                             
Total Errors:   0                                                                                                             
                                                                                                                             
Things look okay - No serious problems were detected during the pre-flight check


and when I ran
/etc/init.d/nagios restart
It was successful.

I am a little uncomfortable without the updated init file though.
mlong
 
Posts: 26
Joined: Mon Aug 12, 2013 12:36 pm

Re: Upgrading from 3.5.1 to 4.0.0

Postby abrist » Tue Sep 24, 2013 9:34 am

mlong wrote:I am a little uncomfortable without the updated init file though.

In what way?
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.
abrist
Red Shirt
 
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Upgrading from 3.5.1 to 4.0.0

Postby mlong » Tue Sep 24, 2013 10:31 am

abrist wrote:
mlong wrote:I am a little uncomfortable without the updated init file though.

In what way?


Nothing specific, just concerned about potential conflicts. I don't know how different the scripts are.
mlong
 
Posts: 26
Joined: Mon Aug 12, 2013 12:36 pm

Re: Upgrading from 3.5.1 to 4.0.0

Postby abrist » Tue Sep 24, 2013 10:52 am

You could always compare them, though as far as I am aware, there were no big changes to init options in core 4.
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.
abrist
Red Shirt
 
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Upgrading from 3.5.1 to 4.0.0

Postby magna.vis » Tue Sep 24, 2013 9:59 pm

This happens on a clean install as well. The init file is pointing to the wrong place by default. I had the same issue and rolled back using snapshots. I stood up a new VM with Ubuntu server 12.04 and followed the quick start steps for Ubuntu and it gave the exact same issue. The problem here obviously being that if someone doesn't have a backup, or if someone is trying to do a fresh install of Core 4.0.0 on Ubuntu, it won't work. Here's the bug report: http://tracker.nagios.org/view.php?id=460

Seems like a lot of people are having the issue, or issues resulting from the same underlying issue.
magna.vis
 
Posts: 8
Joined: Tue Sep 24, 2013 9:37 pm

Re: Upgrading from 3.5.1 to 4.0.0

Postby abrist » Wed Sep 25, 2013 10:30 am

Was there a file named:
Code: Select all
init-script.debian

in your nagios source folder?
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.
abrist
Red Shirt
 
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Upgrading from 3.5.1 to 4.0.0

Postby magna.vis » Wed Sep 25, 2013 6:08 pm

It doesn't seem to be there. I expanded the search, just in case I was doing something silly:

Code: Select all
root@Nagios:~# find / -iname 'init-script.debian'
root@Nagios:~# find / -iname 'init'
/sbin/init
/usr/src/linux-headers-3.8.0-29/init
/usr/src/linux-headers-3.8.0-29-generic/include/config/init
/usr/src/linux-headers-3.8.0-29-generic/init
/usr/share/initramfs-tools/init
/usr/lib/os-probes/init
/etc/apparmor/init
/etc/init
/lib/init
magna.vis
 
Posts: 8
Joined: Tue Sep 24, 2013 9:37 pm

Re: Upgrading from 3.5.1 to 4.0.0

Postby abrist » Thu Sep 26, 2013 9:23 am

No, it looks like you are doing everything right.

mlong: Can you post the init script you are currently using in code wraps?
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.
abrist
Red Shirt
 
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Upgrading from 3.5.1 to 4.0.0

Postby magna.vis » Thu Sep 26, 2013 1:46 pm

Looks like this guy may have some input as well: http://roger.steneteg.org/492/installing-nagios-from-source/

I'm also thinking about cloning my current setup, and upgrading without doing the make install-init command and seeing if it still works. If I get around to it in the next couple of days, I'll post my results.

And here it is in code brackets:
Code: Select all
#! /bin/sh
### BEGIN INIT INFO
# Provides:          nagios
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: start and stop Nagios monitoring server
# Description:       Nagios is a service monitoring system
### END INIT INFO

# Author: Foo Bar <roger@steneteg.org>
#
# Please remove the "Author" lines above and replace them
# with your own name if you copy and modify this script.

# Do NOT "set -e"

# PATH should only include /usr/* if it runs after the mountnfs.sh script
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="Nagios monitoring system"
NAME=nagios
PREFIX=/srv/nagios
STATEDIR=/var/nagios
CONFIGDIR=/etc/nagios
CONFIGFILE="$CONFIGDIR/nagios.cfg"
DAEMON="${PREFIX}/bin/${NAME}"
DAEMON_ARGS="-d $CONFIGFILE"
SCRIPTNAME=/etc/init.d/$NAME
PIDFILE=/var/run/$NAME.pid
USER="nagios"
GROUP="nagios"

# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0

# Read configuration variable file if it is present
[ -r /etc/default/$NAME ] && . /etc/default/$NAME

# Load the VERBOSE setting and other rcS variables
. /lib/init/vars.sh

# Define LSB log_* functions.
# Depend on lsb-base (>= 3.2-14) to ensure that this file is present
# and status_of_proc is working.
. /lib/lsb/init-functions

check_config() {
   RESULTFILE="$STATEDIR/configcheck$$"
   CHECKRESULT=`$DAEMON -v $CONFIGFILE > $RESULTFILE`
   WARN=`grep ^"Total Warnings:" $RESULTFILE | awk -F: '{print $2}' |sed s/' '//g`
   ERR=`grep ^"Total Errors:" $RESULTFILE | awk -F: '{print $2}' |sed s/' '//g`

   if test "${WARN}" = "0" && test "${ERR}" = "0"; then
      echo "OK - Configuration check verified"
      return 0
   else
      cat $RESULTFILE
      exit 8
   fi
}

#
# Function that starts the daemon/service
#
do_start()
{
   # Return
   #   0 if daemon has been started
   #   1 if daemon was already running
   #   2 if daemon could not be started

   test -x $DAEMON || exit 2
   test -f $CONFIGGILE || exit 2
   if test "$1" = "checkconfig"; then
      check_config
   fi
   echo -n "Starting $NAME .."
   start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null || return 1
   start-stop-daemon --start --quiet --make-pidfile --pidfile $PIDFILE --exec $DAEMON -- $DAEMON_ARGS || return 2
   echo ". $NAME started"
}

#
# Function that stops the daemon/service
#
do_stop()
{
   # Return
   #   0 if daemon has been stopped
   #   1 if daemon was already stopped
   #   2 if daemon could not be stopped
   #   other if a failure occurred
   echo -n "Stopping $NAME .."
#   start-stop-daemon --stop --quiet --retry=5 --pidfile $PIDFILE --name $NAME
#   RETVAL="$?"
#   [ "$RETVAL" = 2 ] && return 2
   # Wait for children to finish too if this is a daemon that forks
   # and if the daemon is only ever run from this initscript.
   # If the above conditions are not satisfied then add some other code
   # that waits for the process to drop all resources that could be
   # needed by services started subsequently.  A last resort is to
   # sleep for some time.
   start-stop-daemon --stop --quiet --oknodo --retry=5 --exec $DAEMON
   RETVAL="$?"
   [ "$RETVAL" = 2 ] && return 2
   # Many daemons don't delete their pidfiles when they exit.
   rm -f $PIDFILE
   echo ". $NAME stopped"
   return "$RETVAL"
}

#
# Function that sends a SIGHUP to the daemon/service
#
do_reload() {
   #
   # If the daemon can reload its configuration without
   # restarting (for example, when it is sent a SIGHUP),
   # then implement that here.
   #
   check_config
   # This does not seem to be working
   #start-stop-daemon --stop --signal HUP --quiet --pidfile $PIDFILE --name $NAME
   echo "There is something wrong with the reload function, use restart instead"
   return 0
}

case "$1" in
  start)
   [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
   do_start "checkconfig"
   case "$?" in
      0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
      2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
   esac
   ;;
  stop)
   [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
   do_stop
   case "$?" in
      0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
      2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
   esac
   ;;
  status)
   status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
   ;;
  reload)
   #
   # If do_reload() is not implemented then leave this commented out
   # and leave 'force-reload' as an alias for 'restart'.
   #
   log_daemon_msg "Reloading $DESC" "$NAME"
   do_reload
   log_end_msg $?
   ;;
  restart)
   #
   # If the "reload" option is implemented then remove the
   # 'force-reload' alias
   #
   log_daemon_msg "Restarting $DESC" "$NAME"
   check_config
   do_stop
   case "$?" in
     0|1)
      do_start
      case "$?" in
         0) log_end_msg 0 ;;
         1) log_end_msg 1 ;; # Old process is still running
         *) log_end_msg 1 ;; # Failed to start
      esac
      ;;
     *)
      # Failed to stop
      log_end_msg 1
      ;;
   esac
   ;;
  *)
   echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
   exit 3
   ;;
esac
magna.vis
 
Posts: 8
Joined: Tue Sep 24, 2013 9:37 pm

Re: Upgrading from 3.5.1 to 4.0.0

Postby lmiltchev » Thu Sep 26, 2013 5:02 pm

We will do some digging on that. We have a "workaround" (by abrist) but it's not pretty... See below:

Code: Select all
#!/bin/sh

# Nagios        Startup script for the Nagios monitoring daemon
#
# chkconfig:    - 85 15
# description:  Nagios is a service monitoring system
# processname: nagios
# config: /etc/nagios/nagios.cfg
# pidfile: /var/nagios/nagios.pid
#
### BEGIN INIT INFO
# Provides:             nagios
# Required-Start:       $local_fs $syslog $network
# Required-Stop:        $local_fs $syslog $network
# Short-Description:    start and stop Nagios monitoring server
# Description:          Nagios is is a service monitoring system
### END INIT INFO

# Source function library.
# . /etc/rc.d/init.d/functions
. /lib/lsb/init-functions

prefix="/usr/local/nagios"
exec_prefix="${prefix}"
exec="${exec_prefix}/bin/nagios"
prog="nagios"
config="${prefix}/etc/nagios.cfg"
pidfile="${prefix}/var/nagios.lock"
user="nagios"
group="nagios"
checkconfig="false"
ramdiskdir="/var/nagios/ramcache"

test -e /etc/sysconfig/$prog && . /etc/sysconfig/$prog

lockfile=/var/lock/$prog
USE_RAMDISK=${USE_RAMDISK:-0}

if test "$USE_RAMDISK" -ne 0 && test "$RAMDISK_SIZE"X != "X"; then
        ramdisk=`mount |grep "$ramdiskdir type tmpfs"`
        if [ "$ramdisk"X == "X" ]; then
                mkdir -p -m 0755 $ramdiskdir
                mount -t tmpfs -o size=${RAMDISK_SIZE}m tmpfs $ramdiskdir
                mkdir -p -m 0755 $ramdiskdir/checkresults
                chown -R $user:$group $ramdiskdir
        fi
fi

check_config() {
        TMPFILE="/tmp/.configtest.$$"
        /usr/sbin/service nagios configtest > "$TMPFILE"
        WARN=`grep ^"Total Warnings:" "$TMPFILE" |awk -F: '{print \$2}' |sed s/' '//g`
        ERR=`grep ^"Total Errors:" "$TMPFILE" |awk -F: '{print \$2}' |sed s/' '//g`

        if test "$WARN" = "0" && test "${ERR}" = "0"; then
                echo "OK - Configuration check verified" > /var/run/nagios.configtest
                chmod 0644 /var/run/nagios.configtest
                /bin/rm "$TMPFILE"
        return 0
        else
                # We'll write out the errors to a file we can have a
                # script watching for
                echo "WARNING: Errors in config files - see log for details: $TMPFILE" > /var/run/nagios.configtest
                egrep -i "(^warning|^error)" "$TMPFILE" >> /var/run/nagios.configtest
                chmod 0644 /var/run/nagios.configtest
                cat "$TMPFILE"
        exit 8
        fi
}

start() {
        test -x $exec || exit 5
        test -f $config || exit 6
        if test "$checkconfig" = "false"; then
                check_config
        fi
        echo -n $"Starting $prog: "
        # We need to _make sure_ the precache is there and verified
        # Raise priority to make it run better
        daemon --user=$user -- $exec -d $config
        #touch $lockfile
        retval=$?
        echo
        test $retval -eq 0 && touch $lockfile
        return $retval
}

stop() {
        echo -n $"Stopping $prog: "
        killproc -p ${pidfile}  $exec
        retval=$?
        echo
        test $retval -eq 0 && rm -f $lockfile
        return $retval
}


restart() {
        check_config
        checkconfig="true"
        stop
        start
}

reload() {
        echo -n $"Reloading $prog: "
        killproc -p ${pidfile} $exec -HUP
        RETVAL=$?
        echo
}

force_reload() {
        restart
}

case "$1" in
        start)
                status_of_proc $prog && exit 0
                $1
                ;;
        stop)
                status_of_proc $prog|| exit 0
                $1
                ;;
        restart)
                $1
                ;;
        reload)
                status_of_proc $prog || exit 7
                $1
                ;;
        force-reload)
                force_reload
                ;;
        status)
                status_of_proc $prog
                ;;
        condrestart|try-restart)
                status_of_proc $prog|| exit 0
                restart
                ;;
        configtest)
                $nice su -s /bin/bash - nagios -c "$corelimit >/dev/null 2>&1 ; $exec -vp $config"
                RETVAL=$?
                ;;
        *)
                echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload|configtest}"
                exit 2
esac
exit $?


We will try to find a better solution for Debian.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
lmiltchev
QA Manager
 
Posts: 12447
Joined: Mon May 23, 2011 12:15 pm

PreviousNext

Return to Nagios Core

Who is online

Users browsing this forum: admincauce and 33 guests