nagios 3.51 problem restart debian 8xxx
-
rumarcin11
- Posts: 36
- Joined: Thu Feb 25, 2016 7:42 am
nagios 3.51 problem restart debian 8xxx
Job for nagios3.service failed. See 'systemctl status nagios3.service' and 'journalctl -xn' for details.
Re: nagios 3.51 problem restart debian 8xxx
Could you please send the output of the following commands:
Code: Select all
systemctl status nagios3.service'
journalctl -xn
nagios -v /etc/nagios/nagios.cfg
or
nagios -v /usr/local/nagios/etc/nagios.cfg
Rob Hassing


-
rumarcin11
- Posts: 36
- Joined: Thu Feb 25, 2016 7:42 am
Re: nagios 3.51 problem restart debian 8xxx
agios3.service - LSB: nagios host/service/network monitoring and management system
Loaded: loaded (/etc/init.d/nagios3)
Active: failed (Result: exit-code) since Ĺro 2016-03-23 14:01:11 CET; 3min 23s ago
Process: 5887 ExecStart=/etc/init.d/nagios3 start (code=exited, status=1/FAILURE)
mar 23 14:01:11 Nagios systemd[1]: Unit nagios3.service entered failed state.
mar 23 14:01:11 Nagios nagios3[5887]: ***> One or more problems was encountered while processing the config files...
mar 23 14:01:11 Nagios nagios3[5887]: Check your configuration file(s) to ensure that they contain valid mar 23 14:01:11 Nagios nagios3[5887]: directives and data defintions. If you are upgrading from a previous mar 23 14:01:11 Nagios nagios3[5887]: version of Nagios, you should be aware that some variables/definitions mar 23 14:01:11 Nagios nagios3[5887]: may have been removed or modified in this version. Make sure to read mar 23 14:01:11 Nagios nagios3[5887]: the HTML documentation regarding the config files, as well as the mar 23 14:01:11 Nagios nagios3[5887]: 'Whats New' section to find out what has changed.
mar 23 14:01:11 Nagios nagios3[5887]: errors in config! ... failed!
mar 23 14:01:11 Nagios nagios3[5887]: failed!
Loaded: loaded (/etc/init.d/nagios3)
Active: failed (Result: exit-code) since Ĺro 2016-03-23 14:01:11 CET; 3min 23s ago
Process: 5887 ExecStart=/etc/init.d/nagios3 start (code=exited, status=1/FAILURE)
mar 23 14:01:11 Nagios systemd[1]: Unit nagios3.service entered failed state.
mar 23 14:01:11 Nagios nagios3[5887]: ***> One or more problems was encountered while processing the config files...
mar 23 14:01:11 Nagios nagios3[5887]: Check your configuration file(s) to ensure that they contain valid mar 23 14:01:11 Nagios nagios3[5887]: directives and data defintions. If you are upgrading from a previous mar 23 14:01:11 Nagios nagios3[5887]: version of Nagios, you should be aware that some variables/definitions mar 23 14:01:11 Nagios nagios3[5887]: may have been removed or modified in this version. Make sure to read mar 23 14:01:11 Nagios nagios3[5887]: the HTML documentation regarding the config files, as well as the mar 23 14:01:11 Nagios nagios3[5887]: 'Whats New' section to find out what has changed.
mar 23 14:01:11 Nagios nagios3[5887]: errors in config! ... failed!
mar 23 14:01:11 Nagios nagios3[5887]: failed!
Re: nagios 3.51 problem restart debian 8xxx
Can you please verify the configuration as @rhassing mentioned above, and post the output?
Code: Select all
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
Former Nagios Employee
-
rumarcin11
- Posts: 36
- Joined: Thu Feb 25, 2016 7:42 am
Re: nagios 3.51 problem restart debian 8xxx
I have a catalog /etc/nagios3/nagios.cfg
no command -v
no command -v
-
rumarcin11
- Posts: 36
- Joined: Thu Feb 25, 2016 7:42 am
Re: nagios 3.51 problem restart debian 8xxx
kwi 05 12:59:54 Nagios nagios3[8254]: directives and data defintions. If you are upgrading from a previous kwi 05 12:59:54 Nagios nagios3[8254]: version of Nagios, you should be aware that some variables/definitions kwi 05 12:59:54 Nagios nagios3[8254]: may have been removed or modified in this version. Make sure to read kwi 05 12:59:54 Nagios nagios3[8254]: the HTML documentation regarding the config files, as well as the kwi 05 12:59:54 Nagios nagios3[8254]: 'Whats New' section to find out what has changed.
kwi 05 12:59:54 Nagios systemd[1]: nagios3.service: control process exited, code=exited status=1 kwi 05 12:59:54 Nagios systemd[1]: Failed to start LSB: nagios host/service/network monitoring and management system.
kwi 05 12:59:54 Nagios systemd[1]: Unit nagios3.service entered failed state.
kwi 05 12:59:54 Nagios nagios3[8254]: errors in config! ... failed!
kwi 05 12:59:54 Nagios nagios3[8254]: failed!
kwi 05 12:59:54 Nagios systemd[1]: nagios3.service: control process exited, code=exited status=1 kwi 05 12:59:54 Nagios systemd[1]: Failed to start LSB: nagios host/service/network monitoring and management system.
kwi 05 12:59:54 Nagios systemd[1]: Unit nagios3.service entered failed state.
kwi 05 12:59:54 Nagios nagios3[8254]: errors in config! ... failed!
kwi 05 12:59:54 Nagios nagios3[8254]: failed!
Re: nagios 3.51 problem restart debian 8xxx
Can you post this file from your Nagios server so we can review it?
Code: Select all
/etc/init.d/nagios3Be sure to check out our Knowledgebase for helpful articles and solutions!
-
rumarcin11
- Posts: 36
- Joined: Thu Feb 25, 2016 7:42 am
Re: nagios 3.51 problem restart debian 8xxx
root@Nagios:/# /etc/init.d/nagios3 restart [....] Restarting nagios3 (via systemctl): nagios3.serviceJob for nagios3.service failed. See 'systemctl status nagios3.service' and 'journalctl -xn' for details.
failed!
root@Nagios:/#
failed!
root@Nagios:/#
Re: nagios 3.51 problem restart debian 8xxx
Can you run the following and post the output here?
Code: Select all
cat /etc/init.d/nagios3
journalctl -xnBe sure to check out our Knowledgebase for helpful articles and solutions!
-
rumarcin11
- Posts: 36
- Joined: Thu Feb 25, 2016 7:42 am
Re: nagios 3.51 problem restart debian 8xxx
#! /bin/sh
# Written by Miquel van Smoorenburg <[email protected]>.
# Modified for Debian GNU/Linux
# by Ian Murdock <[email protected]>.
# Clamav version by Magnus Ekdahl <[email protected]>
# Nagios version by Sean Finney <[email protected]> and probably others
# nagios2 version by Marc Haber <[email protected]>
# nagios3 version by Alexander Wirt <[email protected]>
### BEGIN INIT INFO
# Provides: nagios3
# Required-Start: $local_fs $remote_fs $syslog $named $network $time
# Required-Stop: $local_fs $remote_fs $syslog $named $network
# Should-Start:
# Should-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: nagios host/service/network monitoring and management system
# Description: nagios is a monitoring and management system for hosts, services and networks.
### END INIT INFO
set -e
. /lib/lsb/init-functions
DAEMON=/usr/sbin/nagios3
NAME="nagios3"
DESC="nagios3 monitoring daemon"
NAGIOSCFG="/etc/nagios3/nagios.cfg"
CGICFG="/etc/nagios3/cgi.cfg"
NICENESS=5
[ -x "$DAEMON" ] || exit 0
[ -r /etc/default/nagios3 ] && . /etc/default/nagios3
# this is from madduck on IRC, 2006-07-06 # There should be a better possibility to give daemon error messages # and/or to log things
log()
{
case "$1" in
[[:digit:]]*) success=$1; shift;;
*) :;;
esac
log_action_begin_msg "$1"; shift
log_action_end_msg ${success:-0} "$*"
}
check_run () {
if [ ! -d '/var/run/nagios3' ];
then
mkdir /var/run/nagios3
chown nagios:nagios /var/run/nagios3
chmod 0750 /var/run/nagios3
fi
}
check_started () {
#nagios3-core can be installed without -cgi
if [ -e $CGICFG ];
then
check_cmd=$(get_config nagios_check_command $CGICFG)
if [ ! "$check_cmd" ]; then
log 6 "unable to determine nagios_check_command from $CGICFG!"
return 6
fi
else
#use hardcoded default version
check_cmd="/usr/lib/nagios/plugins/check_nagios /var/cache/nagios3/status.dat 5 '/usr/sbin/nagios3'"
fi
eval $check_cmd >/dev/null
if [ -f "$THEPIDFILE" ]; then
pid="$(cat $THEPIDFILE)"
if [ "$pid" ] && kill -0 $pid >/dev/null 2>/dev/null; then
return 0 # Is started
fi
fi
return 1 # Isn't started
}
#
# get_config()
#
# grab a config option from nagios.cfg (or possibly another nagios config
# file if specified). everything after the '=' is echo'd out, making
# this a nice generalized way to get requested settings.
#
get_config () {
if [ "$2" ]; then
set -- `grep ^$1 $2 | sed 's@=@ @'`
else
set -- `grep ^$1 $NAGIOSCFG | sed 's@=@ @'`
fi
shift
echo $*
}
check_config () {
if $DAEMON -v $NAGIOSCFG >/dev/null 2>&1 ; then
# First get the user/group etc Nagios is running as
nagios_user="$(get_config nagios_user)"
nagios_group="$(get_config nagios_group)"
log_file="$(get_config log_file)"
log_dir="$(dirname $log_file)"
return 0 # Config is ok
else
# config is not okay, so let's barf the error to the user
$DAEMON -v $NAGIOSCFG
fi
}
check_named_pipe () {
nagiospipe="$(get_config command_file)"
if [ -p "$nagiospipe" ]; then
return 1 # a named pipe exists
elif [ -e "$nagiospipe" ];then
return 1
else
return 0 # no named pipe exists
fi
}
if [ ! -f "$NAGIOSCFG" ]; then
log_failure_msg "There is no configuration file for Nagios 3."
exit 6
fi
THEPIDFILE=$(get_config "lock_file")
[ -n "$THEPIDFILE" ] || THEPIDFILE='/var/run/nagios3/nagios.pid'
start () {
if [ "$ENABLED" = "no" ]; then
log_warning_msg "Not starting Nagios3 - set ENABLED to yes in /etc/default/nagios3"
exit 0
fi
if ! check_started; then
if ! check_named_pipe; then
log_action_msg "named pipe exists - removing"
rm -f $nagiospipe
fi
if check_config; then
start_daemon -n $NICENESS -p $THEPIDFILE $DAEMON -d $NAGIOSCFG
ret=$?
else
log_failure_msg "errors in config!"
log_end_msg 1
exit 1
fi
else
log_warning_msg "already running!"
fi
return $ret
}
stop () {
killproc -p $THEPIDFILE
ret=$?
if [ `pidof nagios3 | wc -l ` -gt 0 ]; then
echo -n "Waiting for $NAME daemon to die.."
cnt=0
while [ `pidof nagios3 | wc -l ` -gt 0 ]; do
cnt=`expr "$cnt" + 1`
if [ "$cnt" -gt 15 ]; then
kill -9 `pidof nagios3`
break
fi
sleep 1
echo -n "."
done
fi
echo
if ! check_named_pipe; then
rm -f $nagiospipe
fi
if [ -n "$ret" ]; then
return $ret
else
return $?
fi
}
status()
{
log_action_begin_msg "checking $DAEMON"
if check_started; then
log_action_end_msg 0 "running"
else
if [ -e "$THEPIDFILE" ]; then
log_action_end_msg 1 "$DAEMON failed"
exit 1
else
log_action_end_msg 1 "not running"
exit 3
fi
fi
}
reload () {
# Check first
if check_config; then
if check_started; then
killproc -p $THEPIDFILE $DAEMON 1
else
log_warning_msg "Not running."
fi
else
log_failure_msg "errors in config!"
log_end_msg 6
exit 6
fi
}
check() {
$DAEMON -v $NAGIOSCFG
}
check_run
case "$1" in
start)
log_daemon_msg "Starting $DESC" "$NAME"
start
log_end_msg $?
;;
stop)
log_daemon_msg "Stopping $DESC" "$NAME"
stop
log_end_msg $?
;;
restart)
log_daemon_msg "Restarting $DESC" "$NAME"
stop
if [ -z "$?" -o "$?" = "0" ]; then
start
fi
log_end_msg $?
;;
reload|force-reload)
log_daemon_msg "Reloading $DESC configuration files" "$NAME"
reload
log_end_msg $?
;;
status)
status
;;
check)
check
;;
*)
log_failure_msg "Usage: $0 {start|stop|restart|reload|force-reload|status}" >&2
exit 1
;;
esac
exit 0
# Written by Miquel van Smoorenburg <[email protected]>.
# Modified for Debian GNU/Linux
# by Ian Murdock <[email protected]>.
# Clamav version by Magnus Ekdahl <[email protected]>
# Nagios version by Sean Finney <[email protected]> and probably others
# nagios2 version by Marc Haber <[email protected]>
# nagios3 version by Alexander Wirt <[email protected]>
### BEGIN INIT INFO
# Provides: nagios3
# Required-Start: $local_fs $remote_fs $syslog $named $network $time
# Required-Stop: $local_fs $remote_fs $syslog $named $network
# Should-Start:
# Should-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: nagios host/service/network monitoring and management system
# Description: nagios is a monitoring and management system for hosts, services and networks.
### END INIT INFO
set -e
. /lib/lsb/init-functions
DAEMON=/usr/sbin/nagios3
NAME="nagios3"
DESC="nagios3 monitoring daemon"
NAGIOSCFG="/etc/nagios3/nagios.cfg"
CGICFG="/etc/nagios3/cgi.cfg"
NICENESS=5
[ -x "$DAEMON" ] || exit 0
[ -r /etc/default/nagios3 ] && . /etc/default/nagios3
# this is from madduck on IRC, 2006-07-06 # There should be a better possibility to give daemon error messages # and/or to log things
log()
{
case "$1" in
[[:digit:]]*) success=$1; shift;;
*) :;;
esac
log_action_begin_msg "$1"; shift
log_action_end_msg ${success:-0} "$*"
}
check_run () {
if [ ! -d '/var/run/nagios3' ];
then
mkdir /var/run/nagios3
chown nagios:nagios /var/run/nagios3
chmod 0750 /var/run/nagios3
fi
}
check_started () {
#nagios3-core can be installed without -cgi
if [ -e $CGICFG ];
then
check_cmd=$(get_config nagios_check_command $CGICFG)
if [ ! "$check_cmd" ]; then
log 6 "unable to determine nagios_check_command from $CGICFG!"
return 6
fi
else
#use hardcoded default version
check_cmd="/usr/lib/nagios/plugins/check_nagios /var/cache/nagios3/status.dat 5 '/usr/sbin/nagios3'"
fi
eval $check_cmd >/dev/null
if [ -f "$THEPIDFILE" ]; then
pid="$(cat $THEPIDFILE)"
if [ "$pid" ] && kill -0 $pid >/dev/null 2>/dev/null; then
return 0 # Is started
fi
fi
return 1 # Isn't started
}
#
# get_config()
#
# grab a config option from nagios.cfg (or possibly another nagios config
# file if specified). everything after the '=' is echo'd out, making
# this a nice generalized way to get requested settings.
#
get_config () {
if [ "$2" ]; then
set -- `grep ^$1 $2 | sed 's@=@ @'`
else
set -- `grep ^$1 $NAGIOSCFG | sed 's@=@ @'`
fi
shift
echo $*
}
check_config () {
if $DAEMON -v $NAGIOSCFG >/dev/null 2>&1 ; then
# First get the user/group etc Nagios is running as
nagios_user="$(get_config nagios_user)"
nagios_group="$(get_config nagios_group)"
log_file="$(get_config log_file)"
log_dir="$(dirname $log_file)"
return 0 # Config is ok
else
# config is not okay, so let's barf the error to the user
$DAEMON -v $NAGIOSCFG
fi
}
check_named_pipe () {
nagiospipe="$(get_config command_file)"
if [ -p "$nagiospipe" ]; then
return 1 # a named pipe exists
elif [ -e "$nagiospipe" ];then
return 1
else
return 0 # no named pipe exists
fi
}
if [ ! -f "$NAGIOSCFG" ]; then
log_failure_msg "There is no configuration file for Nagios 3."
exit 6
fi
THEPIDFILE=$(get_config "lock_file")
[ -n "$THEPIDFILE" ] || THEPIDFILE='/var/run/nagios3/nagios.pid'
start () {
if [ "$ENABLED" = "no" ]; then
log_warning_msg "Not starting Nagios3 - set ENABLED to yes in /etc/default/nagios3"
exit 0
fi
if ! check_started; then
if ! check_named_pipe; then
log_action_msg "named pipe exists - removing"
rm -f $nagiospipe
fi
if check_config; then
start_daemon -n $NICENESS -p $THEPIDFILE $DAEMON -d $NAGIOSCFG
ret=$?
else
log_failure_msg "errors in config!"
log_end_msg 1
exit 1
fi
else
log_warning_msg "already running!"
fi
return $ret
}
stop () {
killproc -p $THEPIDFILE
ret=$?
if [ `pidof nagios3 | wc -l ` -gt 0 ]; then
echo -n "Waiting for $NAME daemon to die.."
cnt=0
while [ `pidof nagios3 | wc -l ` -gt 0 ]; do
cnt=`expr "$cnt" + 1`
if [ "$cnt" -gt 15 ]; then
kill -9 `pidof nagios3`
break
fi
sleep 1
echo -n "."
done
fi
echo
if ! check_named_pipe; then
rm -f $nagiospipe
fi
if [ -n "$ret" ]; then
return $ret
else
return $?
fi
}
status()
{
log_action_begin_msg "checking $DAEMON"
if check_started; then
log_action_end_msg 0 "running"
else
if [ -e "$THEPIDFILE" ]; then
log_action_end_msg 1 "$DAEMON failed"
exit 1
else
log_action_end_msg 1 "not running"
exit 3
fi
fi
}
reload () {
# Check first
if check_config; then
if check_started; then
killproc -p $THEPIDFILE $DAEMON 1
else
log_warning_msg "Not running."
fi
else
log_failure_msg "errors in config!"
log_end_msg 6
exit 6
fi
}
check() {
$DAEMON -v $NAGIOSCFG
}
check_run
case "$1" in
start)
log_daemon_msg "Starting $DESC" "$NAME"
start
log_end_msg $?
;;
stop)
log_daemon_msg "Stopping $DESC" "$NAME"
stop
log_end_msg $?
;;
restart)
log_daemon_msg "Restarting $DESC" "$NAME"
stop
if [ -z "$?" -o "$?" = "0" ]; then
start
fi
log_end_msg $?
;;
reload|force-reload)
log_daemon_msg "Reloading $DESC configuration files" "$NAME"
reload
log_end_msg $?
;;
status)
status
;;
check)
check
;;
*)
log_failure_msg "Usage: $0 {start|stop|restart|reload|force-reload|status}" >&2
exit 1
;;
esac
exit 0