Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I would sugest that you check that you've created the nagios user and group
as following the output of your command ls -la /usr/local/nagios/var/ nagios should run under nagios user and nagios group.
if you did edit your nagios.cfg
Code:
vi /usr/local/nagios/etc/nagios.cfg
and change the nagios_user and nagios_group to nagios
ODB2:/usr/local/nagios/etc# cat /etc/init.d/nagios
#!/bin/sh
#
# chkconfig: 345 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()
{
if status_nagios $1 $2; then
echo "nagios (pid $NagiosPID) is running..."
else
echo "nagios is not running"
fi
}
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/local/nagios
exec_prefix=${prefix}
NagiosBin=${exec_prefix}/bin/nagios
NagiosCfgFile=${prefix}/etc/nagios.cfg
NagiosStatusFile=${prefix}/var/status.dat
NagiosRetentionFile=${prefix}/var/retention.dat
NagiosCommandFile=${prefix}/var/rw/nagios.cmd
NagiosVarDir=${prefix}/var
NagiosRunFile=${prefix}/var/nagios.lock
NagiosLockDir=/var/lock/subsys
NagiosLockFile=nagios
NagiosCGIDir=${exec_prefix}/sbin
NagiosUser=nagiosadmin
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
su - $NagiosUser -c "touch $NagiosVarDir/nagios.log $NagiosRetentionFile"
rm -f $NagiosCommandFile
touch $NagiosRunFile
chown $NagiosUser:$NagiosGroup $NagiosRunFile
$NagiosBin -d $NagiosCfgFile
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
;;
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 1
;;
esac
# End of this script
ODB2:/usr/local/nagios/etc# cat /etc/init.d/nagios
#!/bin/sh
#
# chkconfig: 345 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()
{
if status_nagios $1 $2; then
echo "nagios (pid $NagiosPID) is running..."
else
echo "nagios is not running"
fi
}
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/local/nagios
exec_prefix=${prefix}
NagiosBin=${exec_prefix}/bin/nagios
NagiosCfgFile=${prefix}/etc/nagios.cfg
NagiosStatusFile=${prefix}/var/status.dat
NagiosRetentionFile=${prefix}/var/retention.dat
NagiosCommandFile=${prefix}/var/rw/nagios.cmd
NagiosVarDir=${prefix}/var
NagiosRunFile=${prefix}/var/nagios.lock
NagiosLockDir=/var/lock/subsys
NagiosLockFile=nagios
NagiosCGIDir=${exec_prefix}/sbin
NagiosUser=nagiosadmin
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
su - $NagiosUser -c "touch $NagiosVarDir/nagios.log $NagiosRetentionFile"
rm -f $NagiosCommandFile
touch $NagiosRunFile
chown $NagiosUser:$NagiosGroup $NagiosRunFile
$NagiosBin -d $NagiosCfgFile
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
;;
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 1
;;
esac
# End of this script
Thanks
find the variable of NagiosUser in your configuration file change this value
value as per your file is nagiosadmin change it to nagios
Code:
NagiosUser=nagios
now try to start or restart nagios service
let us know if you get any error
And the pages now load. One final thing. It seems there is a slight issue with the current status->map and alerts->histrogram
Code:
The requested URL /nagios/cgi-bin/statusmap.cgi was not found on this server.
Code:
The requested URL /nagios/cgi-bin/histogram.cgi was not found on this server.
Should they be there on a new install or are they something that is populated later on?
Thanks for all your help guys, this is certainly the most helpful forum I have ever used! I have only been into Linux for a month or so and have been learning extensively.
Check your nagios path for the files and see if they are there. You'd need to see where apache is sending your request.
I'm assuming you have a alias and scriptalias directive setup?
See where the /cgibin/ is taking you then look for the file in the path.
you should also be able to look at your apache logs to see the path its looking at for those files.
Thanks, I found this in the logs.
Code:
[Wed Jul 21 14:20:48 2010] [error] [client 192.168.0.239] script not found or unable to stat: /usr/local/nagios/sbin/histogram.cgi, referer: http://192.168.$
[Wed Jul 21 14:20:49 2010] [error] [client 192.168.0.239] script not found or unable to stat: /usr/local/nagios/sbin/histogram.cgi, referer: http://192.168.$
Directory
Code:
ODB2:/# cd /usr/local/nagios/sbin
ODB2:/usr/local/nagios/sbin# ls
avail.cgi config.cgi history.cgi outages.cgi status.cgi statuswrl.cgi tac.cgi
cmd.cgi extinfo.cgi notifications.cgi showlog.cgi statuswml.cgi summary.cgi
ODB2:/usr/local/nagios/sbin#
Trying to access the statusmap, trends, or histogram CGIs from the web interface either results in a 404 error (missing document) or produces errors.
Solution:
The most probable cause of this is that you do not have the gd library and/or its required libraries (i.e. libpng, libjpeg, and zlib). If you do have the libraries installed on your system, the configure script may not have properly detected them before you compiled the CGIs. Here's what you can do to solve the issue:
Install the gd, png, jpeg, and zlib libraries on your system. You will also have to install the gd-devel, png-devel, jpeg-devel, and zlib-devel libraries. If you want RPMs for these libraries, try searching rpmfind.net for the following libraries:
Thanks guys, I have looked at that article and also searched aptitude, but what version(s) do I need?
Code:
ODB2:/usr/local/nagios/sbin# aptitude search libgd
p libgd-barcode-perl - Library to create barcode images (GD::Barcode)
v libgd-dev -
p libgd-gd2-noxpm-perl - Perl module wrapper for libgd - gd2 variant without XPM support
p libgd-gd2-perl - Perl module wrapper for libgd - gd2 variant
p libgd-graph-perl - Graph Plotting Module for Perl 5
p libgd-graph3d-perl - Create 3D Graphs with GD and GD::Graph
p libgd-ruby - Extension library to use GD graphics library from Ruby
p libgd-ruby1.8 - Extension library to use GD graphics library from Ruby
p libgd-securityimage-perl - Security image (captcha) generator
p libgd-svg-perl - Seamlessly enable SVG output from scripts written using GD
p libgd-text-perl - Text utilities for use with GD
i libgd-tools - GD command line tools and example code
v libgd2 -
c libgd2-noxpm - GD Graphics Library version 2 (without XPM support)
p libgd2-noxpm-dev - GD Graphics Library version 2 (development version)
i libgd2-xpm - GD Graphics Library version 2
i libgd2-xpm-dev - GD Graphics Library version 2 (development version)
p libgda-4.0-4 - data abstraction library based on GLib
p libgda-4.0-4-dbg - data abstraction library based on GLib -- debug files
p libgda-4.0-bin - data abstraction library based on GLib -- binary files
p libgda-4.0-common - data abstraction library based on GLib -- common files
p libgda-4.0-dev - data abstraction library based on GLib -- development files
p libgda-4.0-doc - data abstraction library based on GLib -- documentation files
p libgda-4.0-mysql - MySQL provider for libgda database abstraction library
p libgda-4.0-postgres - PostgreSQL provider for libgda database abstraction library
p libgda-ruby - GNOME Data Access bindings for the Ruby Language
p libgda-ruby1.8 - GNOME Data Access bindings for the Ruby Language
p libgda2-3 - GNOME Data Access library for GNOME2
p libgda2-3-dbg - GDA2 library and debugging symbols
p libgda2-bin - Binary files for GNOME Data Access library for GNOME2
p libgda2-common - Common files for GNOME Data Access library for GNOME2
p libgda2-dev - Development files for GNOME Data Access library for GNOME2
p libgda2-doc - Documentation files for GNOME Data Access library for GNOME2
p libgda3-3 - GNOME Data Access library for GNOME2
p libgda3-3-dbg - GDA3 library and debugging symbols
p libgda3-bin - Binary files for GNOME Data Access library for GNOME2
p libgda3-common - Common files for GNOME Data Access library for GNOME2
p libgda3-dev - Development files for GNOME Data Access library for GNOME2
p libgda3-doc - Documentation files for GNOME Data Access library for GNOME2
p libgda3-mysql - MySQL backend plugin for GNOME Data Access library for GNOME2
p libgda3-odbc - ODBC backend plugin for GNOME Data Access library for GNOME2
p libgda3-postgres - PostgreSQL backend plugin for GNOME Data Access library for GNOME2
p libgda3-sqlite - SQLite backend plugin for GNOME Data Access library for GNOME2
v libgdal-dev -
p libgdal-doc - Documentation for the Geospatial Data Abstraction Library
p libgdal-perl - Perl bindings to the Geospatial Data Abstraction Library
p libgdal-ruby - Ruby bindings to the Geospatial Data Abstraction Library
p libgdal-ruby1.8 - Ruby 1.8 bindings to the Geospatial Data Abstraction Library
p libgdal1-1.5.0 - Geospatial Data Abstraction Library
p libgdal1-1.5.0-grass - GRASS extension for the Geospatial Data Abstraction Library
p libgdal1-1.6.0 - Geospatial Data Abstraction Library
p libgdal1-1.6.0-grass - GRASS extension for the GDAL library
p libgdal1-dev - Geospatial Data Abstraction Library - Development files
p libgdamm1.3-8 - C++ wrappers for libgda2 (shared library)
p libgdamm1.3-dev - C++ wrappers for libgda2 (development files)
p libgdamm3.0-10 - C++ wrappers for libgda3
p libgdamm3.0-dev - C++ wrappers for libgda3 (library headers)
p libgdamm3.0-doc - C++ wrappers for libgda3 (documentation)
p libgdata-cil-dev - Google GData CLI client library
p libgdata-common - Library for accessing GData webservices - common data files
p libgdata-dev - Library for accessing GData webservices - development files
p libgdata-doc - Library for accessing GData webservices - documentation
p libgdata-google1.2-1 - Client library for accessing Google POA through SOAP interface
p libgdata-google1.2-dev - Client library for accessing Google POA (development files)
p libgdata-java - simple standard protocol for reading and writing data on the web
p libgdata1.2-1 - Client library for accessing Google POA through SOAP interface
p libgdata1.2-dev - Client library for accessing Google POA (development files)
p libgdata1.4-cil - Google GData CLI client library
p libgdata7 - Library for accessing GData webservices - shared libraries
p libgdb-dev - The GNU Debugger (libgdb.a)
p libgdbm-dev - GNU dbm database routines (development files)
p libgdbm-gst - GDBM bindings for GNU Smalltalk
p libgdbm-ruby - GDBM interface for Ruby
p libgdbm-ruby1.8 - GDBM interface for Ruby 1.8
p libgdbm-ruby1.9 - GDBM interface for Ruby 1.9
p libgdbm-ruby1.9.1 - GDBM interface for Ruby 1.9.1
i libgdbm3 - GNU dbm database routines (runtime version)
v libgdchart -
v libgdchart-gd2-dev -
p libgdchart-gd2-noxpm - Generate graphs using the GD library
p libgdchart-gd2-noxpm-dev - Generate graphs using the GD library (development version)
p libgdchart-gd2-xpm - Generate graphs using the GD library
p libgdchart-gd2-xpm-dev - Generate graphs using the GD library (development version)
p libgdcm-cil - Grassroots DICOM CLI bindings
p libgdcm-java - Grassroots DICOM Java bindings
p libgdcm-tools - Grassroots DICOM tools and utilities
p libgdcm2-dev - Grassroots DICOM development libraries and headers
p libgdcm2.0 - Grassroots DICOM runtime libraries
p libgdcm2.0-dbg - Grassroots DICOM runtime libraries, debug version
p libgdict-1.0-6 - GNOME Dictionary base library - runtime
p libgdict-1.0-dev - GNOME Dictionary base library - development files
p libgdiplus - interface library for System.Drawing of Mono
v libgdk-imlib11 -
p libgdk-pixbuf-dev - The GdkPixBuf library - development files
p libgdk-pixbuf2 - The GdkPixBuf image library, gtk+ 1.2 version
p libgdk-pixbuf2-ruby - Gdk-Pixbuf 2 bindings for the Ruby language
p libgdk-pixbuf2-ruby1.8 - Gdk-Pixbuf 2 bindings for the Ruby language
p libgdk-pixbuf2-ruby1.8-dbg - Gdk-Pixbuf 2 bindings for the Ruby language
p libgdkcutter-pixbuf-dev - Cutter Gdk-pixbuf support (Development files)
p libgdkcutter-pixbuf0 - Cutter Gdk-pixbuf support (Shared library)
p libgdl-1-0 - GNOME DevTool libraries
p libgdl-1-0-dbg - GNOME DevTool libraries - debug files
p libgdl-1-3 - GNOME DevTool libraries
p libgdl-1-common - GNOME DevTool libraries - common files
p libgdl-1-dbg - GNOME DevTool libraries - debug files
p libgdl-1-dev - GNOME DevTool libraries - development files
v libgdl-dev -
p libgdl-gnome-1-0 - GNOME DevTool libraries (GNOME)
p libgdl-gnome-1-0-dbg - GNOME DevTool libraries (GNOME)- debug files
p libgdome2-0 - DOM level2 library for accessing XML files
p libgdome2-cpp-smart-dev - C++ bindings for GDome2 DOM implementation
p libgdome2-cpp-smart0c2a - C++ bindings for GDome2 DOM implementation
p libgdome2-dev - Development files for libgdome2
p libgdome2-ocaml - OCaml bindings for GDome2 DOM implementation
p libgdome2-ocaml-dev - OCaml bindings for GDome2 DOM implementation
v libgdome2-ocaml-dev-oi6i1 -
v libgdome2-ocaml-oi6i1 -
p libgdraw4 - font editor - runtime graphics and widget library
p libgdu-dev - GObject based Disk Utility Library - development files
p libgdu-gtk-dev - GTK+ standard dialog library for libgdu - development files
p libgdu-gtk0 - GTK+ standard dialog library for libgdu
p libgdu0 - GObject based Disk Utility Library
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.