Page 1 of 1

Apply config on Core config manger keep failing

Posted: Mon Jan 07, 2019 4:23 pm
by bongbi
Hi.

When I have configuration need to be applied from Core Config Manager, I have error message like screen shot. But if I run it from console (reconfigure_nagios.sh) it completes without error. Any idea what is happening here?

Thanks!

Re: Apply config on Core config manger keep failing

Posted: Mon Jan 07, 2019 4:50 pm
by npolovenko
Hello, @bongbi. Please open a console session to the Nagios server, sign in as Nagios user and run the reconfigure command:
su - nagios
cd /usr/local/nagiosxi/scripts/
./reconfigure_nagios.sh
And show me the output.

Next, in XI web interface please go to Configure -> Core Configurations Manager, then click on Tools -> Config File Management in the left column. Then perform the following actions in order:
1)Write
2)Delete
3)Write
4)Verify

After you click on the verify you will see some errors in the GUI. Copy and paste them in the thread as well.

Re: Apply config on Core config manger keep failing

Posted: Tue Jan 08, 2019 9:35 am
by bongbi
Hi.

When I tried to run command I have error message as below. Should reset-config_perms.sh need to be owned by nagios?

Code: Select all

[root@nagiosxi scripts]# su - nagios
[nagios@nagiosxi ~]$ pwd
/home/nagios
[nagios@nagiosxi ~]$ cd /usr/local/nagiosxi/scripts/
[nagios@nagiosxi scripts]$ ./reconfigure_nagios.sh >> /tmp/result2.txt
[sudo] password for nagios:
Sorry, user nagios is not allowed to execute '/usr/local/nagiosxi/scripts/reset_config_perms.sh' as root on nagiosxi.

Code: Select all

-rwxr-x---  1 nagios nagios    971 Nov 26 16:16 reconfigure_nagios.sh
-rwxr-x---  1 nagios nagios   4224 Nov 26 16:16 remove_historical_data.sh
-rwxr-x---  1 root   nagios   1688 Nov 26 16:16 repair_databases.sh
-rwxr-x---  1 nagios nagios   3948 Nov 26 16:16 repairmysql.sh
-rwxr-x---  1 root   nagios   3604 Nov 26 16:16 reset_config_perms.sh
-rwxr-x---  1 nagios nagios   1859 Nov 26 16:16 reset_nagiosadmin_password.php

Re: Apply config on Core config manger keep failing

Posted: Tue Jan 08, 2019 3:05 pm
by swolf
Hi, @bongbi,

That shouldn't be necessarily. Nagios XI should make modifications to the sudoers file to allow it root access to some scripts. Can you show us the output of the following command?

Code: Select all

grep -R "nagios" /etc/sudoers /etc/sudoers.d/

Re: Apply config on Core config manger keep failing

Posted: Wed Jan 09, 2019 8:31 am
by bongbi
Hi.

Here it is.

Code: Select all

[root@nagiosxi scripts]# grep -R "nagios" /etc/sudoers /etc/sudoers.d/
/etc/sudoers:nagios          ALL=(root) NOPASSWD: /usr/local/nagiosxi/scripts/manage_services.sh *
Thanks.

Re: Apply config on Core config manger keep failing

Posted: Wed Jan 09, 2019 12:28 pm
by scottwilkerson
You are missing many required entries in the sudoers file

Edit with visudo

This should be at the bottom of the file:

Code: Select all

# NEEDED TO ALLOW NAGIOS TO CHECK SERVICE STATUS
Defaults:nagios !requiretty
nagios ALL=NOPASSWD: /usr/local/nagios/libexec/check_init_service

# ASTERISK-SPECIFIC CHECKS
# NOTE: You can uncomment the following line if you are monitoring Asterisk locally
#nagios ALL=NOPASSWD: /usr/local/nagios/libexec/check_asterisk_sip_peers.sh, /usr/local/nagios/libexec/nagisk.pl, /usr/sbin/asterisk

User_Alias      NAGIOSXI=nagios
User_Alias      NAGIOSXIWEB=apache
NAGIOSXI ALL = NOPASSWD:/etc/init.d/nagios start
NAGIOSXI ALL = NOPASSWD:/etc/init.d/nagios stop
NAGIOSXI ALL = NOPASSWD:/etc/init.d/nagios restart
NAGIOSXI ALL = NOPASSWD:/etc/init.d/nagios reload
NAGIOSXI ALL = NOPASSWD:/etc/init.d/nagios status
NAGIOSXI ALL = NOPASSWD:/etc/init.d/nagios checkconfig
NAGIOSXI ALL = NOPASSWD:/etc/init.d/ndo2db start
NAGIOSXI ALL = NOPASSWD:/etc/init.d/ndo2db stop
NAGIOSXI ALL = NOPASSWD:/etc/init.d/ndo2db restart
NAGIOSXI ALL = NOPASSWD:/etc/init.d/ndo2db reload
NAGIOSXI ALL = NOPASSWD:/etc/init.d/ndo2db status
NAGIOSXI ALL = NOPASSWD:/etc/init.d/npcd start
NAGIOSXI ALL = NOPASSWD:/etc/init.d/npcd stop
NAGIOSXI ALL = NOPASSWD:/etc/init.d/npcd restart
NAGIOSXI ALL = NOPASSWD:/etc/init.d/npcd reload
NAGIOSXI ALL = NOPASSWD:/etc/init.d/npcd status
NAGIOSXI ALL = NOPASSWD:/usr/bin/php /usr/local/nagiosxi/html/includes/components/autodiscovery/scripts/autodiscover_new.php *
NAGIOSXI ALL = NOPASSWD:/usr/local/nagiosxi/html/includes/components/profile/getprofile.sh
NAGIOSXI ALL = NOPASSWD:/usr/local/nagiosxi/scripts/upgrade_to_latest.sh
NAGIOSXI ALL = NOPASSWD:/usr/local/nagiosxi/scripts/change_timezone.sh
NAGIOSXI ALL = NOPASSWD:/usr/local/nagiosxi/scripts/manage_services.sh *
NAGIOSXI ALL = NOPASSWD:/usr/local/nagiosxi/scripts/reset_config_perms.sh
NAGIOSXI ALL = NOPASSWD:/usr/local/nagiosxi/scripts/manage_ssl_config.sh *
NAGIOSXI ALL = NOPASSWD:/usr/local/nagiosxi/scripts/backup_xi.sh *
NAGIOSXIWEB ALL = NOPASSWD:/usr/bin/tail -100 /var/log/messages
NAGIOSXIWEB ALL = NOPASSWD:/usr/bin/tail -100 /var/log/httpd/error_log
NAGIOSXIWEB ALL = NOPASSWD:/usr/bin/tail -100 /var/log/mysqld.log
NAGIOSXIWEB ALL = NOPASSWD:/usr/bin/php /usr/local/nagiosxi/html/includes/components/autodiscovery/scripts/autodiscover_new.php *
NAGIOSXIWEB ALL = NOPASSWD:/usr/local/nagiosxi/html/includes/components/profile/getprofile.sh
NAGIOSXIWEB ALL = NOPASSWD:/etc/init.d/snmptt restart
NAGIOSXIWEB ALL = NOPASSWD:/usr/local/nagiosxi/scripts/repair_databases.sh
NAGIOSXIWEB ALL = NOPASSWD:/usr/local/nagiosxi/scripts/manage_services.sh *

Re: Apply config on Core config manger keep failing

Posted: Wed Jan 09, 2019 3:20 pm
by bongbi
That fixed issue. Somebody rsynced sudoer file by mistake.

Thanks for great support! :D

Re: Apply config on Core config manger keep failing

Posted: Wed Jan 09, 2019 3:58 pm
by scottwilkerson
bongbi wrote:That fixed issue. Somebody rsynced sudoer file by mistake.

Thanks for great support! :D
Great!

Locking thread