Upgrading from 3.5.1 to 4.0.0

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
mlong
Posts: 26
Joined: Mon Aug 12, 2013 12:36 pm

Upgrading from 3.5.1 to 4.0.0

Post by mlong »

I tried to upgrade from Core 3.5.1 to 4.0.0 and I found errors when running the make all command
here is the output:

Code: Select all

root@nagios downloads/nagios# make all                                                                                        
cd ./base && make                                                                                                             
make[1]: Entering directory `/root/downloads/nagios/base'                                                                     
gcc -Wall -I.. -g -O2 -DHAVE_CONFIG_H -DNSCORE -c -o nagios.o nagios.c                                                        
gcc -Wall -I.. -g -O2 -DHAVE_CONFIG_H -DNSCORE   -c -o broker.o broker.c                                                      
gcc -Wall -I.. -g -O2 -DHAVE_CONFIG_H -DNSCORE   -c -o nebmods.o nebmods.c                                                    
nebmods.c: In function 'neb_load_module':                                                                                     
nebmods.c:170: warning: unused variable 'dest_fd'                                                                             
gcc -Wall -I.. -g -O2 -DHAVE_CONFIG_H -DNSCORE -c -o ../common/shared.o ../common/shared.c                                    
gcc -Wall -I.. -g -O2 -DHAVE_CONFIG_H -DNSCORE   -c -o nerd.o nerd.c                                                          
gcc -Wall -I.. -g -O2 -DHAVE_CONFIG_H -DNSCORE   -c -o query-handler.o query-handler.c                                        
gcc -Wall -I.. -g -O2 -DHAVE_CONFIG_H -DNSCORE -c -o workers.o workers.c                                                      
gcc -Wall -I.. -g -O2 -DHAVE_CONFIG_H -DNSCORE   -c -o checks.o checks.c                                                      
gcc -Wall -I.. -g -O2 -DHAVE_CONFIG_H -DNSCORE   -c -o config.o config.c                                                      
gcc -Wall -I.. -g -O2 -DHAVE_CONFIG_H -DNSCORE   -c -o commands.o commands.c                                                  
commands.c: In function 'process_passive_service_check':                                                                      
commands.c:2240: warning: assignment discards qualifiers from pointer target type                                             
commands.c: In function 'process_passive_host_check':                                                                         
commands.c:2332: warning: assignment discards qualifiers from pointer target type                                             
gcc -Wall -I.. -g -O2 -DHAVE_CONFIG_H -DNSCORE   -c -o events.o events.c                                                      
gcc -Wall -I.. -g -O2 -DHAVE_CONFIG_H -DNSCORE   -c -o flapping.o flapping.c                                                  
gcc -Wall -I.. -g -O2 -DHAVE_CONFIG_H -DNSCORE   -c -o logging.o logging.c                                                    
gcc -Wall -I.. -g -O2 -DHAVE_CONFIG_H -DNSCORE -c -o macros-base.o ../common/macros.c                                         
gcc -Wall -I.. -g -O2 -DHAVE_CONFIG_H -DNSCORE   -c -o netutils.o netutils.c                                                  
gcc -Wall -I.. -g -O2 -DHAVE_CONFIG_H -DNSCORE   -c -o notifications.o notifications.c                                        
gcc -Wall -I.. -g -O2 -DHAVE_CONFIG_H -DNSCORE   -c -o sehandlers.o sehandlers.c                                              
gcc -Wall -I.. -g -O2 -DHAVE_CONFIG_H -DNSCORE   -c -o utils.o utils.c                                                        
gcc -Wall -I.. -g -O2 -DHAVE_CONFIG_H -DNSCORE -c -o retention-base.o sretention.c                                            
gcc -Wall -I.. -g -O2 -DHAVE_CONFIG_H -DNSCORE -c -o xretention-base.o ../xdata/xrddefault.c                                  
gcc -Wall -I.. -g -O2 -DHAVE_CONFIG_H -DNSCORE -c -o comments-base.o ../common/comments.c                                     
gcc -Wall -I.. -g -O2 -DHAVE_CONFIG_H -DNSCORE -c -o xcomments-base.o ../xdata/xcddefault.c                                   
gcc -Wall -I.. -g -O2 -DHAVE_CONFIG_H -DNSCORE -c -o objects-base.o ../common/objects.c                                       
gcc -Wall -I.. -g -O2 -DHAVE_CONFIG_H -DNSCORE -c -o xobjects-base.o ../xdata/xodtemplate.c                                   
gcc -Wall -I.. -g -O2 -DHAVE_CONFIG_H -DNSCORE -c -o statusdata-base.o ../common/statusdata.c                                 
gcc -Wall -I.. -g -O2 -DHAVE_CONFIG_H -DNSCORE -c -o xstatusdata-base.o ../xdata/xsddefault.c                                 
gcc -Wall -I.. -g -O2 -DHAVE_CONFIG_H -DNSCORE -c -o perfdata-base.o perfdata.c                                               
gcc -Wall -I.. -g -O2 -DHAVE_CONFIG_H -DNSCORE -c -o xperfdata-base.o ../xdata/xpddefault.c                                   
gcc -Wall -I.. -g -O2 -DHAVE_CONFIG_H -DNSCORE -c -o downtime-base.o ../common/downtime.c                                     
gcc -Wall -I.. -g -O2 -DHAVE_CONFIG_H -DNSCORE -c -o xdowntime-base.o ../xdata/xdddefault.c                                   
make -C ../lib                                                                                                                
make[2]: Entering directory `/root/downloads/nagios/lib'                                                                      
gcc -g -O2 -DHAVE_CONFIG_H -c squeue.c -o squeue.o                                                                            
gcc -g -O2 -DHAVE_CONFIG_H -c kvvec.c -o kvvec.o                                                                              
gcc -g -O2 -DHAVE_CONFIG_H -c iocache.c -o iocache.o                                                                          
gcc -g -O2 -DHAVE_CONFIG_H -c iobroker.c -o iobroker.o                                                                        
gcc -g -O2 -DHAVE_CONFIG_H -c bitmap.c -o bitmap.o                                                                            
gcc -g -O2 -DHAVE_CONFIG_H -c dkhash.c -o dkhash.o                                                                            
gcc -g -O2 -DHAVE_CONFIG_H -c runcmd.c -o runcmd.o                                                                            
gcc -g -O2 -DHAVE_CONFIG_H -c nsutils.c -o nsutils.o                                                                          
gcc -g -O2 -DHAVE_CONFIG_H -c fanout.c -o fanout.o                                                                            
gcc -g -O2 -DHAVE_CONFIG_H -c pqueue.c -o pqueue.o                                                                            
gcc -g -O2 -DHAVE_CONFIG_H -c worker.c -o worker.o                                                                            
gcc -g -O2 -DHAVE_CONFIG_H -c skiplist.c -o skiplist.o                                                                        
gcc -g -O2 -DHAVE_CONFIG_H -c nsock.c -o nsock.o                                                                              
gcc -g -O2 -DHAVE_CONFIG_H -c nspath.c -o nspath.o                                                                            
ar cr libnagios.a squeue.o kvvec.o iocache.o iobroker.o bitmap.o dkhash.o runcmd.o nsutils.o fanout.o pqueue.o worker.o skipli
st.o nsock.o nspath.o                                                                                                         
make[2]: Leaving directory `/root/downloads/nagios/lib'                                                                       
gcc -Wall -I.. -g -O2 -DHAVE_CONFIG_H -DNSCORE -o nagios nagios.o broker.o nebmods.o ../common/shared.o nerd.o query-handler.o
 workers.o checks.o config.o commands.o events.o flapping.o logging.o macros-base.o netutils.o notifications.o sehandlers.o ut
ils.o retention-base.o xretention-base.o comments-base.o xcomments-base.o objects-base.o xobjects-base.o statusdata-base.o xst
atusdata-base.o perfdata-base.o xperfdata-base.o downtime-base.o xdowntime-base.o  -Wl,-export-dynamic   -lm  -ldl  ../lib/lib
nagios.a                                                                                                                      
gcc -Wall -I.. -g -O2 -DHAVE_CONFIG_H -DNSCORE -o nagiostats nagiostats.c  -lm  ../lib/libnagios.a                            
make[1]: Leaving directory `/root/downloads/nagios/base'                                                                      
cd ./cgi && make                                                                                                              
make[1]: Entering directory `/root/downloads/nagios/cgi'                                                                      
gcc -Wall -I.. -g -O2 -DHAVE_CONFIG_H -DNSCGI   -c -o getcgi.o getcgi.c                                                       
gcc -Wall -I.. -g -O2 -DHAVE_CONFIG_H -DNSCGI   -c -o cgiutils.o cgiutils.c                                                   
gcc -Wall -I.. -g -O2 -DHAVE_CONFIG_H -DNSCGI   -c -o cgiauth.o cgiauth.c                                                     
gcc -Wall -I.. -g -O2 -DHAVE_CONFIG_H -DNSCGI -c -o macros-cgi.o ../common/macros.c                                           
gcc -Wall -I.. -g -O2 -DHAVE_CONFIG_H -DNSCGI -c -o objects-cgi.o ../common/objects.c                                         
gcc -Wall -I.. -g -O2 -DHAVE_CONFIG_H -DNSCGI -c -o xobjects-cgi.o ../xdata/xodtemplate.c                                     
gcc -Wall -I.. -g -O2 -DHAVE_CONFIG_H -DNSCGI -c -o statusdata-cgi.o ../common/statusdata.c                                   
gcc -Wall -I.. -g -O2 -DHAVE_CONFIG_H -DNSCGI -c -o xstatusdata-cgi.o ../xdata/xsddefault.c                                   
gcc -Wall -I.. -g -O2 -DHAVE_CONFIG_H -DNSCGI -c -o comments-cgi.o ../common/comments.c                                       
gcc -Wall -I.. -g -O2 -DHAVE_CONFIG_H -DNSCGI -c -o downtime-cgi.o ../common/downtime.c                                       
gcc -Wall -I.. -g -O2 -DHAVE_CONFIG_H -DNSCGI  -o avail.cgi avail.c ../common/shared.o getcgi.o cgiutils.o cgiauth.o macros-cg
i.o  objects-cgi.o xobjects-cgi.o statusdata-cgi.o xstatusdata-cgi.o comments-cgi.o downtime-cgi.o ../lib/libnagios.a         
gcc -Wall -I.. -g -O2 -DHAVE_CONFIG_H -DNSCGI   -c -o extcmd_list.o extcmd_list.c                                             
gcc -Wall -I.. -g -O2 -DHAVE_CONFIG_H -DNSCGI  -o cmd.cgi cmd.c extcmd_list.o ../common/shared.o getcgi.o cgiutils.o cgiauth.o
 macros-cgi.o  objects-cgi.o xobjects-cgi.o statusdata-cgi.o xstatusdata-cgi.o comments-cgi.o downtime-cgi.o ../lib/libnagios.
a                                                                                                                             
gcc -Wall -I.. -g -O2 -DHAVE_CONFIG_H -DNSCGI  -o config.cgi config.c  ../common/shared.o getcgi.o cgiutils.o cgiauth.o macros
-cgi.o  objects-cgi.o xobjects-cgi.o statusdata-cgi.o xstatusdata-cgi.o comments-cgi.o downtime-cgi.o ../lib/libnagios.a      
gcc -Wall -I.. -g -O2 -DHAVE_CONFIG_H -DNSCGI  -o extinfo.cgi extinfo.c ../common/shared.o getcgi.o cgiutils.o cgiauth.o macro
s-cgi.o  objects-cgi.o xobjects-cgi.o statusdata-cgi.o xstatusdata-cgi.o comments-cgi.o downtime-cgi.o ../lib/libnagios.a     
gcc -Wall -I.. -g -O2 -DHAVE_CONFIG_H -DNSCGI  -o history.cgi history.c ../common/shared.o getcgi.o cgiutils.o cgiauth.o macro
s-cgi.o  objects-cgi.o xobjects-cgi.o statusdata-cgi.o xstatusdata-cgi.o comments-cgi.o downtime-cgi.o ../lib/libnagios.a     
gcc -Wall -I.. -g -O2 -DHAVE_CONFIG_H -DNSCGI  -o notifications.cgi notifications.c ../common/shared.o getcgi.o cgiutils.o cgi
auth.o macros-cgi.o  objects-cgi.o xobjects-cgi.o statusdata-cgi.o xstatusdata-cgi.o comments-cgi.o downtime-cgi.o ../lib/libn
agios.a                                                                                                                       
gcc -Wall -I.. -g -O2 -DHAVE_CONFIG_H -DNSCGI  -o outages.cgi outages.c ../common/shared.o getcgi.o cgiutils.o cgiauth.o macro
s-cgi.o  objects-cgi.o xobjects-cgi.o statusdata-cgi.o xstatusdata-cgi.o comments-cgi.o downtime-cgi.o ../lib/libnagios.a     
gcc -Wall -I.. -g -O2 -DHAVE_CONFIG_H -DNSCGI  -o showlog.cgi showlog.c ../common/shared.o getcgi.o cgiutils.o cgiauth.o macro
s-cgi.o  objects-cgi.o xobjects-cgi.o statusdata-cgi.o xstatusdata-cgi.o comments-cgi.o downtime-cgi.o ../lib/libnagios.a     
gcc -Wall -I.. -g -O2 -DHAVE_CONFIG_H -DNSCGI  -o status.cgi status.c ../common/shared.o getcgi.o cgiutils.o cgiauth.o macros-
cgi.o  objects-cgi.o xobjects-cgi.o statusdata-cgi.o xstatusdata-cgi.o comments-cgi.o downtime-cgi.o ../lib/libnagios.a       
gcc -Wall -I.. -g -O2 -DHAVE_CONFIG_H -DNSCGI  -o statuswml.cgi statuswml.c ../common/shared.o getcgi.o cgiutils.o cgiauth.o m
acros-cgi.o  objects-cgi.o xobjects-cgi.o statusdata-cgi.o xstatusdata-cgi.o comments-cgi.o downtime-cgi.o ../lib/libnagios.a 
gcc -Wall -I.. -g -O2 -DHAVE_CONFIG_H -DNSCGI  -o summary.cgi summary.c ../common/shared.o getcgi.o cgiutils.o cgiauth.o macro
s-cgi.o  objects-cgi.o xobjects-cgi.o statusdata-cgi.o xstatusdata-cgi.o comments-cgi.o downtime-cgi.o ../lib/libnagios.a     
gcc -Wall -I.. -g -O2 -DHAVE_CONFIG_H -DNSCGI  -o tac.cgi tac.c ../common/shared.o getcgi.o cgiutils.o cgiauth.o macros-cgi.o 
 objects-cgi.o xobjects-cgi.o statusdata-cgi.o xstatusdata-cgi.o comments-cgi.o downtime-cgi.o ../lib/libnagios.a             
gcc -Wall -I.. -g -O2 -DHAVE_CONFIG_H -DNSCGI  -o statuswrl.cgi statuswrl.c ../common/shared.o getcgi.o cgiutils.o cgiauth.o m
acros-cgi.o  objects-cgi.o xobjects-cgi.o statusdata-cgi.o xstatusdata-cgi.o comments-cgi.o downtime-cgi.o ../lib/libnagios.a 
-lm                                                                                                                           
gcc -Wall -I.. -g -O2 -DHAVE_CONFIG_H -DNSCGI  -o statusmap.cgi statusmap.c ../common/shared.o getcgi.o cgiutils.o cgiauth.o m
acros-cgi.o  objects-cgi.o xobjects-cgi.o statusdata-cgi.o xstatusdata-cgi.o comments-cgi.o downtime-cgi.o ../lib/libnagios.a 
-lgd  -lpng -ljpeg -lz -lm                                                                                                    
gcc -Wall -I.. -g -O2 -DHAVE_CONFIG_H -DNSCGI  -o trends.cgi trends.c ../common/shared.o getcgi.o cgiutils.o cgiauth.o macros-
cgi.o  objects-cgi.o xobjects-cgi.o statusdata-cgi.o xstatusdata-cgi.o comments-cgi.o downtime-cgi.o ../lib/libnagios.a -lgd  
-lpng -ljpeg -lz -lm                                                                                                          
gcc -Wall -I.. -g -O2 -DHAVE_CONFIG_H -DNSCGI  -o histogram.cgi histogram.c ../common/shared.o getcgi.o cgiutils.o cgiauth.o m
acros-cgi.o  objects-cgi.o xobjects-cgi.o statusdata-cgi.o xstatusdata-cgi.o comments-cgi.o downtime-cgi.o ../lib/libnagios.a 
-lgd  -lpng -ljpeg -lz -lm                                                                                                    
make[1]: Leaving directory `/root/downloads/nagios/cgi'                                                                       
cd ./html && make                                                                                                             
make[1]: Entering directory `/root/downloads/nagios/html'                                                                     
make[1]: Nothing to be done for `all'.                                                                                        
make[1]: Leaving directory `/root/downloads/nagios/html'                                                                      
if [ xyes = xyes ]; then \                                                                                                    
                cd ./module && make; \                                                                                        
        fi                                                                                                                    
make[1]: Entering directory `/root/downloads/nagios/module'                                                                   
gcc -I.. -fPIC -g -O2 -DHAVE_CONFIG_H -o helloworld.o helloworld.c -shared                                                    
make[1]: Leaving directory `/root/downloads/nagios/module'                                                                    
cd ./worker && make all                                                                                                       
make[1]: Entering directory `/root/downloads/nagios/worker'                                                                   
cd ./ping && make all                                                                                                         
make[2]: Entering directory `/root/downloads/nagios/worker/ping'                                                              
gcc -I.. -I ../../include -I ../.. -g -O2 -DHAVE_CONFIG_H -o worker-ping worker-ping.c -L ../../lib -l nagios                 
make[2]: Leaving directory `/root/downloads/nagios/worker/ping'                                                               
make[1]: Leaving directory `/root/downloads/nagios/worker'                                                                    
                                                                                                                              
*** Compile finished ***                                                                                                      
                                                                                                                              
If the main program and CGIs compiled without any errors, you                                                                 
can continue with installing Nagios as follows (type 'make'                                                                   
without any arguments for a list of all possible options):                                                                    
                                                                                                                              
  make install                                                                                                                
     - This installs the main program, CGIs, and HTML files                                                                   
                                                                                                                              
  make install-init                                                                                                           
     - This installs the init script in /etc/init.d                                                                           
                                                                                                                              
  make install-commandmode                                                                                                    
     - This installs and configures permissions on the                                                                        
       directory for holding the external command file                                                                        
                                                                                                                              
  make install-config                                                                                                         
     - This installs *SAMPLE* config files in /usr/local/nagios/etc                                                           
       You'll have to modify these sample files before you can                                                                
       use Nagios.  Read the HTML documentation for more info                                                                 
       on doing this.  Pay particular attention to the docs on                                                                
       object configuration files, as they determine what/how                                                                 
       things get monitored!                                                                                                  
                                                                                                                              
  make install-webconf                                                                                                        
     - This installs the Apache config file for the Nagios                                                                    
       web interface                                                                                                          
                                                                                                                              
  make install-exfoliation                                                                                                    
     - This installs the Exfoliation theme for the Nagios                                                                     
       web interface                                                                                                          
                                                                                                                              
  make install-classicui                                                                                                      
     - This installs the classic theme for the Nagios                                                                         
       web interface                                                                                                          
                                                                                                                              
                                                                                                                              
*** Support Notes *******************************************                                                                 
                                                                                                                              
If you have questions about configuring or running Nagios,                                                                    
please make sure that you:                                                                                                    
                                                                                                                              
     - Look at the sample config files                                                                                        
     - Read the documentation on the Nagios Library at:                                                                       
           http://library.nagios.com                                                                                          
                                                                                                                              
before you post a question to one of the mailing lists.                                                                       
Also make sure to include pertinent information that could                                                                    
help others help you.  This might include:                                                                                    
                                                                                                                              
     - What version of Nagios you are using                                                                                   
     - What version of the plugins you are using                                                                              
     - Relevant snippets from your config files                                                                               
     - Relevant error messages from the Nagios log file                                                                       
                                                                                                                              
For more information on obtaining support for Nagios, visit:                                                                  
                                                                                                                              
       http://support.nagios.com                                                                                              
                                                                                                                              
*************************************************************                                                                 
                                                                                                                              
Enjoy.                                                                                                                        
 
There seem to be three warnings, that I saw. First this one,

Code: Select all

gcc -Wall -I.. -g -O2 -DHAVE_CONFIG_H -DNSCORE   -c -o nebmods.o nebmods.c                                                    
nebmods.c: In function 'neb_load_module':                                                                                     
nebmods.c:170: warning: unused variable 'dest_fd'  
and then these 2

Code: Select all

                                            
commands.c: In function 'process_passive_service_check':                                                                      
commands.c:2240: warning: assignment discards qualifiers from pointer target type                                             
commands.c: In function 'process_passive_host_check':                                                                         
commands.c:2332: warning: assignment discards qualifiers from pointer target type                                           
If I ignore them and try to complete the installation, I get this error when I try to restart the Nagios service

Code: Select all

root@nagios downloads/nagios# /etc/init.d/nagios restart                                                                      
.: 20: Can't open /etc/rc.d/init.d/functions
This also prevents Nagios from starting on boot. it almost seems like a permissions issue, but I cant quite track it down.

I am running on a Turnkey Lamp server (Debian Squeeze)
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Upgrading from 3.5.1 to 4.0.0

Post by scottwilkerson »

What ./configure command did you run before running the make all?

did you also run ?

Code: Select all

make install
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Upgrading from 3.5.1 to 4.0.0

Post by abrist »

What are the permissions:

Code: Select all

ls -la /etc/rc.d/init.d/functions
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.
mlong
Posts: 26
Joined: Mon Aug 12, 2013 12:36 pm

Re: Upgrading from 3.5.1 to 4.0.0

Post by mlong »

scottwilkerson wrote:What ./configure command did you run before running the make all?

did you also run ?

Code: Select all

make install
This is my ./configure

Code: Select all

./configure --with-nagios-group=nagios --with-command-group=nagios --with-mail=/usr/sbin/mail   
 
and yes I ran the make install after the make install- no errors
I also ran
make install-init
make install-commandmode
make install-webconf
all with no errors.
Last edited by mlong on Mon Sep 23, 2013 4:37 pm, edited 1 time in total.
mlong
Posts: 26
Joined: Mon Aug 12, 2013 12:36 pm

Re: Upgrading from 3.5.1 to 4.0.0

Post by mlong »

abrist wrote:What are the permissions:

Code: Select all

ls -la /etc/rc.d/init.d/functions

Code: Select all

ls: cannot access /etc/rc.d/init.d/functions: No such file or directory
I think the problem here is that the rc.d does not exist. I have rc0.d through rc6.d and rcS.d

init.d is in /etc/
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Upgrading from 3.5.1 to 4.0.0

Post by abrist »

The init script probably needs to be edited. Could you post the contents of /etc/init.d/nagios 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.
mlong
Posts: 26
Joined: Mon Aug 12, 2013 12:36 pm

Re: Upgrading from 3.5.1 to 4.0.0

Post by mlong »

abrist wrote:The init script probably needs to be edited. Could you post the contents of /etc/init.d/nagios in code wraps?

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

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/subsys/$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.$$"
	/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 -ud $config
	retval=$?
	echo
	test $retval -eq 0 && touch $lockfile
	return $retval
}

stop() {
	echo -n $"Stopping $prog: "
	killproc -p ${pidfile} -d 10 $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 $prog && exit 0
		$1
		;;
	stop)
		status $prog|| exit 0
		$1
		;;
	restart)
		$1
		;;
	reload)
		status $prog || exit 7
		$1
		;;
	force-reload)
		force_reload
		;;
	status)
		status $prog
		;;
	condrestart|try-restart)
		status $prog|| exit 0
		restart
		;;
	configtest)
		$nice runuser -s /bin/bash - $user -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 $?
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Upgrading from 3.5.1 to 4.0.0

Post by abrist »

The line you need to most likely change is:

Code: Select all

# Source function library.
. /etc/rc.d/init.d/functions
You will have to hunt down the path to the 'functions', or look for a different init script. What happened to your old init script? Is it still in one of your rc folders, or did make install-init overwrite it?
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.
mlong
Posts: 26
Joined: Mon Aug 12, 2013 12:36 pm

Re: Upgrading from 3.5.1 to 4.0.0

Post by mlong »

abrist wrote:The line you need to most likely change is:

Code: Select all

# Source function library.
. /etc/rc.d/init.d/functions
You will have to hunt down the path to the 'functions', or look for a different init script. What happened to your old init script? Is it still in one of your rc folders, or did make install-init overwrite it?
yes I ran make install-init and overwrote it... :oops:

I may restore from backup and re run the install with out the make install-init. Of course that still doesn't get me past the warnings with the make all
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Upgrading from 3.5.1 to 4.0.0

Post by abrist »

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.
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.
Locked