Page 1 of 1

Apply Configuration fails with XI 2014* on RHEL 6.6

Posted: Tue Apr 14, 2015 10:14 pm
by wakeaney
I've installed XI on 2 different RHEL systems, and encountered the same problem on both.
restart_nagios_with_export.sh attempts to execute su root -c "./manage_services.sh restart nagios", which fails because su(1) can't get a tty for the password prompt:

Code: Select all

cmdsubsys.log
Things look okay - No serious problems were detected during the pre-flight check
RET: 0
standard in must be a tty
OUTPUT=RET: 0
RETURNCODE=6
Instead, restart_nagios_with_export.sh should be using sudo(8), as is configured in /etc/sudoers(5):

Code: Select all

/etc/sudoers
NAGIOSXIWEB ALL = NOPASSWD:/usr/local/nagiosxi/scripts/manage_services.sh *
Here's a proposed patch, that works on both installations:

Code: Select all

restart_nagios_with_export.diff
--- restart_nagios_with_export.sh.orig  2015-04-14 22:54:00.535043805 -0400
+++ restart_nagios_with_export.sh       2015-04-14 22:54:45.324043039 -0400
@@ -41,7 +41,7 @@
 if [ $ret -eq 0 ]; then
 
     # Restart Nagios
-    su root -c "./manage_services.sh restart nagios"
+    sudo ./manage_services.sh restart nagios
     ret=$?
     if [ $ret -gt 0 ]; then
         # Remove LOCKFILE

Re: Apply Configuration fails with XI 2014* on RHEL 6.6

Posted: Wed Apr 15, 2015 8:16 am
by wakeaney
This was previously reported and documented in January, http://support.nagios.com/forum/viewtop ... 89#p124789

Re: Apply Configuration fails with XI 2014* on RHEL 6.6

Posted: Wed Apr 15, 2015 10:02 am
by jolson
What version of XI are you running? I am running the latest patch (2014r2.6) and the script is fixed:

Code: Select all

if [ $ret -eq 0 ]; then

    # Restart Nagios
    sudo $BASEDIR/manage_services.sh restart nagios