Apply config on Core config manger keep failing

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
bongbi
Posts: 27
Joined: Wed Oct 07, 2015 2:05 pm

Apply config on Core config manger keep failing

Post 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!
You do not have the required permissions to view the files attached to this post.
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: Apply config on Core config manger keep failing

Post 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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
bongbi
Posts: 27
Joined: Wed Oct 07, 2015 2:05 pm

Re: Apply config on Core config manger keep failing

Post 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
swolf

Re: Apply config on Core config manger keep failing

Post 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/
bongbi
Posts: 27
Joined: Wed Oct 07, 2015 2:05 pm

Re: Apply config on Core config manger keep failing

Post 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.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Apply config on Core config manger keep failing

Post 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 *
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
bongbi
Posts: 27
Joined: Wed Oct 07, 2015 2:05 pm

Re: Apply config on Core config manger keep failing

Post by bongbi »

That fixed issue. Somebody rsynced sudoer file by mistake.

Thanks for great support! :D
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Apply config on Core config manger keep failing

Post by scottwilkerson »

bongbi wrote:That fixed issue. Somebody rsynced sudoer file by mistake.

Thanks for great support! :D
Great!

Locking thread
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked