LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-23-2011, 05:27 PM   #1
rajesh22
LQ Newbie
 
Registered: Mar 2011
Posts: 19

Rep: Reputation: 0
Unhappy Nagios Help


Hi,

I have configured nagios on my local VM machine and i got no error

Total Warnings: 0
Total Errors: 0

Things look okay - No serious problems were detected during the pre-flight check


But when i am unable to start nagios
# service nagios start
nagios: unrecognized service

Can anybody help me to fix this issue ?

Thanks in advance
 
Old 03-23-2011, 05:29 PM   #2
corp769
LQ Guru
 
Registered: Apr 2005
Posts: 5,817

Rep: Reputation: 1002Reputation: 1002Reputation: 1002Reputation: 1002Reputation: 1002Reputation: 1002Reputation: 1002Reputation: 1002
Can you show me the output of the following:
Code:
ls -al /etc/rc.d/init.d/nagios*


---------- Post added 03-23-11 at 10:29 PM ----------

And what distro are you using?
 
Old 03-23-2011, 05:38 PM   #3
rajesh22
LQ Newbie
 
Registered: Mar 2011
Posts: 19

Original Poster
Rep: Reputation: 0
# ls -al /etc/rc.d/init.d/nagios*
ls: /etc/rc.d/init.d/nagios*: No such file or directory
 
Old 03-23-2011, 05:52 PM   #4
corp769
LQ Guru
 
Registered: Apr 2005
Posts: 5,817

Rep: Reputation: 1002Reputation: 1002Reputation: 1002Reputation: 1002Reputation: 1002Reputation: 1002Reputation: 1002Reputation: 1002
Create a new file called nagios in /etc/rc.d/init.d/ with the following command and chmod it to 755:
Code:
touch /etc/rc.d/init.d/nagios
chmod /etc/rc.d/init.d/nagios 755
Then use gedit or any program to edit the file, and paste the following contents into it and save it:
Code:
#!/bin/sh
# 
# chkconfig: - 99 01
# description: Nagios network monitor
#
# File : nagios
#
# Author : Jorge Sanchez Aymar (jsanchez@lanchile.cl)
# 
# Changelog :
#
# 1999-07-09 Karl DeBisschop <kdebisschop@infoplease.com>
#  - setup for autoconf
#  - add reload function
# 1999-08-06 Ethan Galstad <egalstad@nagios.org>
#  - Added configuration info for use with RedHat's chkconfig tool
#    per Fran Boon's suggestion
# 1999-08-13 Jim Popovitch <jimpop@rocketship.com>
#  - added variable for nagios/var directory
#  - cd into nagios/var directory before creating tmp files on startup
# 1999-08-16 Ethan Galstad <egalstad@nagios.org>
#  - Added test for rc.d directory as suggested by Karl DeBisschop
# 2000-07-23 Karl DeBisschop <kdebisschop@users.sourceforge.net>
#  - Clean out redhat macros and other dependencies
# 2003-01-11 Ethan Galstad <egalstad@nagios.org>
#  - Updated su syntax (Gary Miller)
#
# Description: Starts and stops the Nagios monitor
#              used to provide network services status.
#
  
status_nagios ()
{

	if test -x $NagiosCGI/daemonchk.cgi; then
		if $NagiosCGI/daemonchk.cgi -l $NagiosRunFile; then
		        return 0
		else
			return 1
		fi
	else
		if ps -p $NagiosPID > /dev/null 2>&1; then
		        return 0
		else
			return 1
		fi
	fi

	return 1
}


printstatus_nagios()
{
	status_nagios $1 $2
	RETVAL=$?
	if [ $RETVAL = 0 ]; then
		echo "nagios (pid $NagiosPID) is running..."
	else
		echo "nagios is not running"
	fi
	return $RETVAL
}


killproc_nagios ()
{

	kill $2 $NagiosPID

}


pid_nagios ()
{

	if test ! -f $NagiosRunFile; then
		echo "No lock file found in $NagiosRunFile"
		exit 1
	fi

	NagiosPID=`head -n 1 $NagiosRunFile`
}


# 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

prefix=/usr/share/nagios
exec_prefix=/var/lib/nagios
NagiosBin=/usr/sbin/nagios
NagiosCfgFile=/etc/nagios/nagios.cfg
NagiosStatusFile=/var/log/nagios/status.dat
NagiosRetentionFile=/var/log/nagios/retention.dat
NagiosCommandFile=/var/log/nagios/rw/nagios.cmd
NagiosVarDir=/var/log/nagios
NagiosRunFile=/var/run/nagios.pid
NagiosLockDir=/var/lock/subsys
NagiosLockFile=nagios
NagiosCGIDir=/usr/sbin
NagiosUser=nagios
NagiosGroup=nagios
          

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

# Check that nagios.cfg exists.
if [ ! -f $NagiosCfgFile ]; then
    echo "Configuration file $NagiosCfgFile not found.  Exiting."
    exit 1
fi
          
# See how we were called.
case "$1" in

	start)
		echo -n "Starting nagios:"
		$NagiosBin -v $NagiosCfgFile > /dev/null 2>&1;
		if [ $? -eq 0 ]; then
                        touch $NagiosVarDir/nagios.log $NagiosRetentionFile
                        chown $NagiosUser:$NagiosGroup $NagiosVarDir/nagios.log $NagiosRetentionFile
			rm -f $NagiosCommandFile
			touch $NagiosRunFile
			chown $NagiosUser:$NagiosGroup $NagiosRunFile
			[ -x /sbin/restorecon ] && /sbin/restorecon $NagiosRunFile
			$NagiosBin -d $NagiosCfgFile
                        pidof nagios > $NagiosRunFile
			if [ -d $NagiosLockDir ]; then touch $NagiosLockDir/$NagiosLockFile; fi
			echo " done."
			exit 0
		else
			echo "CONFIG ERROR!  Start aborted.  Check your Nagios configuration."
			exit 1
		fi
		;;

	stop)
		echo -n "Stopping nagios: "

		pid_nagios
		killproc_nagios nagios

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

		rm -f $NagiosStatusFile $NagiosRunFile $NagiosLockDir/$NagiosLockFile $NagiosCommandFile
		;;

	status)
		pid_nagios
		printstatus_nagios nagios
		exit $?
		;;

	checkconfig)
		printf "Running configuration check..."
		$NagiosBin -v $NagiosCfgFile > /dev/null 2>&1;
		if [ $? -eq 0 ]; then
			echo " OK."
		else
			echo " CONFIG ERROR!  Check your Nagios configuration."
			exit 1
		fi
		;;

	restart)
		printf "Running configuration check..."
		$NagiosBin -v $NagiosCfgFile > /dev/null 2>&1;
		if [ $? -eq 0 ]; then
			echo "done."
			$0 stop
			$0 start
		else
			echo " CONFIG ERROR!  Restart aborted.  Check your Nagios configuration."
			exit 1
		fi
		;;

	reload|force-reload)
		printf "Running configuration check..."
		$NagiosBin -v $NagiosCfgFile > /dev/null 2>&1;
		if [ $? -eq 0 ]; then
			echo "done."
			if test ! -f $NagiosRunFile; then
				$0 start
			else
				pid_nagios
				if status_nagios > /dev/null; then
					printf "Reloading nagios configuration..."
					killproc_nagios nagios -HUP
					echo "done"
				else
					$0 stop
					$0 start
				fi
			fi
		else
			echo " CONFIG ERROR!  Reload aborted.  Check your Nagios configuration."
			exit 1
		fi
		;;

	*)
		echo "Usage: nagios {start|stop|restart|reload|force-reload|status|checkconfig}"
		exit 2
		;;

esac
  
# End of this script
 
Old 03-23-2011, 06:02 PM   #5
rajesh22
LQ Newbie
 
Registered: Mar 2011
Posts: 19

Original Poster
Rep: Reputation: 0
# /etc/init.d/nagios start
/etc/init.d/nagios: line 1: kconfig:: command not found
Executable file /usr/sbin/nagios not found. Exiting.
 
Old 03-23-2011, 06:18 PM   #6
arunpmenon
LQ Newbie
 
Registered: Sep 2010
Posts: 10

Rep: Reputation: 0
Change these variable in init script according to your installation.

"NagiosBin="
"NagiosCfgFile="
 
Old 03-23-2011, 07:37 PM   #7
anishkumarv
Member
 
Registered: Feb 2010
Location: chennai - India
Distribution: centos
Posts: 289

Rep: Reputation: 10
Hi rajesh,

I think you forget this step while compiling nagios

Quote:
make install-init
once you install init you got that init config file so then you can able to start the nagios.!!!
 
Old 03-24-2011, 04:20 AM   #8
rajesh22
LQ Newbie
 
Registered: Mar 2011
Posts: 19

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by anishkumarv View Post
Hi rajesh,

I think you forget this step while compiling nagios



once you install init you got that init config file so then you can able to start the nagios.!!!
Thanks for your reply.I can able to start nagios service.But when i try to browse http://localhost/nagios. I am getting error as

Not Found

The requested URL /nagios was not found on this server.
Apache/2.2.3 (CentOS) Server at localhost Port 80

Any idea ?


I found both apache and nagios are running now.

Thanks
 
Old 03-24-2011, 04:23 AM   #9
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295
Hello,

You need to configure Apache in order to be able to access Nagios. Have a look at this documentation.

Kind regards,

Eric
 
Old 03-24-2011, 04:59 AM   #10
anishkumarv
Member
 
Registered: Feb 2010
Location: chennai - India
Distribution: centos
Posts: 289

Rep: Reputation: 10
Hi rajesh,


Please while compiling do with complete documents, for nagios in nagios forums itself most of the details available, so please go through documents first

http://www.ziddu.com/download/143199...agios.doc.html

Download this doc, i hope its really useful for you, with out entry in Apache also its work fine, please disable the SELINUX context and try.
 
Old 03-24-2011, 11:32 AM   #11
rajesh22
LQ Newbie
 
Registered: Mar 2011
Posts: 19

Original Poster
Rep: Reputation: 0
I have a doubt whether need to do nagios installation on /etc or we can do any location like / ?

---------- Post added 03-24-11 at 10:33 AM ----------

Quote:
Originally Posted by EricTRA View Post
Hello,

You need to configure Apache in order to be able to access Nagios. Have a look at this documentation.

Kind regards,

Eric
I am getting error by adding the above in httpd.conf

Last edited by rajesh22; 03-24-2011 at 11:48 AM.
 
Old 03-24-2011, 01:42 PM   #12
anishkumarv
Member
 
Registered: Feb 2010
Location: chennai - India
Distribution: centos
Posts: 289

Rep: Reputation: 10
Hi rajesh,

Its your wish only u can install anywhere!!!
 
Old 03-24-2011, 01:47 PM   #13
rajesh22
LQ Newbie
 
Registered: Mar 2011
Posts: 19

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by anishkumarv View Post
Hi rajesh,


Please while compiling do with complete documents, for nagios in nagios forums itself most of the details available, so please go through documents first

http://www.ziddu.com/download/143199...agios.doc.html

Download this doc, i hope its really useful for you, with out entry in Apache also its work fine, please disable the SELINUX context and try.


I have tried the steps mentioed in the wordfile and i get no error too.But i am not getting nagios page.I have disable setenforce 0 and tried but no lucky whether you have anyother idea ?
 
Old 03-24-2011, 02:06 PM   #14
anishkumarv
Member
 
Registered: Feb 2010
Location: chennai - India
Distribution: centos
Posts: 289

Rep: Reputation: 10
Hi,

still its showing ??

Total Warnings: 0
Total Errors: 0

or any other error messages!!! please post the logs
 
Old 03-24-2011, 02:11 PM   #15
rajesh22
LQ Newbie
 
Registered: Mar 2011
Posts: 19

Original Poster
Rep: Reputation: 0
Nagios Core 3.2.3
Copyright (c) 2009-2010 Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 10-03-2010
License: GPL

Website: http://www.nagios.org
Reading configuration data...
Read main config file okay...
Processing object config file '/usr/local/nagios/etc/objects/commands.cfg'...
Processing object config file '/usr/local/nagios/etc/objects/contacts.cfg'...
Processing object config file '/usr/local/nagios/etc/objects/timeperiods.cfg'...
Processing object config file '/usr/local/nagios/etc/objects/templates.cfg'...
Processing object config file '/usr/local/nagios/etc/objects/localhost.cfg'...
Read object config files okay...

Running pre-flight check on configuration data...

Checking services...
Checked 8 services.
Checking hosts...
Checked 1 hosts.
Checking host groups...
Checked 1 host groups.
Checking service groups...
Checked 0 service groups.
Checking contacts...
Checked 1 contacts.
Checking contact groups...
Checked 1 contact groups.
Checking service escalations...
Checked 0 service escalations.
Checking service dependencies...
Checked 0 service dependencies.
Checking host escalations...
Checked 0 host escalations.
Checking host dependencies...
Checked 0 host dependencies.
Checking commands...
Checked 24 commands.
Checking time periods...
Checked 5 time periods.
Checking for circular paths between hosts...
Checking for circular host and service dependencies...
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Nagios and Oreon (Nagios web front end) installation and Configuration LXer Syndicated Linux News 1 05-31-2016 08:26 AM
LXer: April Nagios Training Dates Include Advanced Nagios Class LXer Syndicated Linux News 0 03-18-2011 10:30 AM
Fail to install Nagios Pluggin nagios-plugins-1.4.15.tar.gz fred_xlf Linux - Software 1 11-27-2010 07:09 AM
Nagios Daemon, PID not found but rc.nagios runs agentc0re Slackware 1 07-03-2007 03:47 PM
LXer: Nagios 2.5 and Oreon 1.3 (Nagios web front end) installation with screenshots LXer Syndicated Linux News 0 08-11-2006 06:33 PM


All times are GMT -5. The time now is 12:31 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration