Page 1 of 2

unable to apply configuration or restart from gui

Posted: Fri Aug 21, 2020 9:26 am
by swackle
Hi,

Having a problem that I can not figure out why happens.
I am unable to apply configurations, restart monitoring engine and so on from the gui because it states that Nagios not allowed to run sudo:
CMDLINE=sudo /usr/local/nagiosxi/scripts/manage_services.sh restart nagios
nagios is not allowed to run sudo on pfanpnag01. This incident will be reported.


Have been through this one and still stuck with same problem: https://support.nagios.com/kb/article/n ... es-34.html

So nagios user is in sudoers and I am able to run the scripts as nagios user on the server?
It have been working like a charm but all of the suddent this issues have occurs, any ideas where to go next?

regards
Claus

Re: unable to apply configuration or restart from gui

Posted: Fri Aug 21, 2020 3:48 pm
by jbrunkow
Hello @swackle!

Welcome to the forum. :D

It looks like you have located the right KB for the issue. Which steps from that article have you tried? Did any of the commands return more error messages?

Can you please log in to your XI system as root, then run the following commands? Then let us know what that yields.

Code: Select all

su - nagios
sudo /usr/local/nagiosxi/scripts/manage_services.sh restart nagios
*hint= it is important to include the dash in the first command

It never hurts to send ( PM ) us a profile either! We can find lots of information about your system in there. You can download the profile by navigating to System Profile under System Config on the left pane > and clicking the Download Profile button on that page.

Re: unable to apply configuration or restart from gui

Posted: Mon Aug 24, 2020 7:06 am
by swackle
What .ini file is it I can locate the password --- prompting for a password and have been away from this installation for almost two years :?

Re: unable to apply configuration or restart from gui

Posted: Mon Aug 24, 2020 5:26 pm
by benjaminsmith
Hi,

Since you are getting a sudo error, can you upload the /etc/sudoers file to the thread for us to review?

Also, if you're able to download a system profile, that would be really helpful to troubleshoot this error. Thanks, Benjamin

To send us your system profile.
Login to the Nagios XI GUI using a web browser.
Click the "Admin" > "System Profile" Menu
Click the "Download Profile" button
Save the profile.zip file and share in a private message or upload it to the post/ticket, and then reply to this post to bring it up in the queue.

Re: unable to apply configuration or restart from gui

Posted: Tue Aug 25, 2020 2:54 am
by swackle
Im unable to download the system profile due to the same issue, telling me nagios user not allowed to do sudo.
Uploaded the system info that is unfortunately the best I can do.

I can not upload the sudoers file since it is a general files for all linux and unix servers that the company that hosts our linux servers use.
They inform me that everything looks ok regarding sudoers file and nagios user.

Re: unable to apply configuration or restart from gui

Posted: Tue Aug 25, 2020 3:47 pm
by benjaminsmith
Hi @swackle,

Please follow the instructions in the kb article below to restore the sudoers file to the default, and then PM the profile if you're able to.

Nagios XI - Profile Build Failed

If that doesn't work, you can run the following the generate a profile from the command line. The profile (profile.zip) will be in the /usr/local/nagiosxi/var/components/ directory. Thanks, Benjamin

Code: Select all

### GET SYSTEM PROFILE BY COMMMAND LINE
rm -rf /usr/local/nagiosxi/var/components/profile*​​
/usr/local/nagiosxi/scripts/components/getprofile.sh SUPPORT

Re: unable to apply configuration or restart from gui

Posted: Wed Aug 26, 2020 1:56 am
by swackle
Hi,

Worked as it should and have attached the system profile.

As mentioned earlier I tried to restart nagios as nagios user and that worked fine: /usr/local/nagiosxi/scripts/manage_services.sh restart nagios



Moderator's Note: The profile has been shared with the support team but has been removed from the public forum.

Re: unable to apply configuration or restart from gui

Posted: Wed Aug 26, 2020 3:15 pm
by benjaminsmith
Hi @swackle,

What version of Nagios XI are you using and what operating system? For some reason, the profile was missing logs data along with the profile.txt doc.

Please run through the following re-start to make sure all the services are running correctly. If you're not able to send a command via the gui, it's possible that cron is not running. The following commands are for Cent 6, and may need to be adjusted for your distribution.

Code: Select all

service crond stop
service npcd stop
service nagios stop
service ndo2db stop
pkill -9 -u nagios
for i in $(ipcs -q | grep nagios |awk '{print $2}'); do ipcrm -q $i; done
rm -rf /usr/local/nagiosxi/var/dbmaint.lock
rm -rf /usr/local/nagiosxi/var/event_handler.lock
rm -rf /usr/local/nagiosxi/scripts/reconfigure_nagios.lock
service mysqld restart
service ndo2db start
service nagios start
service npcd start
service crond start
Next run the following tail command and then try to Apply Configuration in the GUI, and post the full output to the thread.

Code: Select all

tail -Fn0 /var/log/httpd/error_log /var/log/httpd/ssl_error_log /usr/local/nagiosxi/var/cmdsubsys.log /usr/local/nagiosxi/var/eventman.log
Lastly, can you post the database log as well. Thanks, Benjamin

Code: Select all

tail -n 100 /var/log/mysqld.log

Re: unable to apply configuration or restart from gui

Posted: Fri Aug 28, 2020 4:00 am
by swackle
Hi again,

OS is = Red Hat Enterprise Linux Server release 6.10 (Santiago)
Nagios XI = Nagios XI 5.4.13

Tried what mentioned in the last post, apply config still fails but have attached the logs and mysql log.

/Claus

Re: unable to apply configuration or restart from gui

Posted: Fri Aug 28, 2020 9:04 am
by scottwilkerson
The log shows the following

Code: Select all

nagios is not allowed to run sudo on pfanpnag01.  This incident will be reported.
sodo for certain commands is required, did someone change/remove the sudoers entries?

What is the output of the following?

Code: Select all

grep nag /etc/sudoers