Page 1 of 1

Using reconfigure_nagios.sh results in error

Posted: Mon Aug 24, 2015 3:31 pm
by WillemDH
CentOS 7, Nagios XI Free Edition
I'm trying to automate some stuff by placing it in the import folder.
Using

Code: Select all

/usr/local/nagiosxi/scripts/reconfigure_nagios.sh
Gives me:

Code: Select all

/usr/local/nagiosxi/scripts/reconfigure_nagios.sh: line 17: ./import_nagiosql.sh: No such file or directory
While

Code: Select all

ls -la /usr/local/nagiosxi/scripts/import_nagiosql.sh
-rwxr-xr-x 1 nagios nagios 432 Aug  8 00:32 /usr/local/nagiosxi/scripts/import_nagiosql.sh
Grtz

Willem

Re: Using reconfigure_nagios.sh results in error

Posted: Mon Aug 24, 2015 3:37 pm
by hsmith
WillemDH wrote:CentOS 7, Nagios XI Free Edition
I'm trying to automate some stuff by placing it in the import folder.
Using

Code: Select all

/usr/local/nagiosxi/scripts/reconfigure_nagios.sh
Gives me:

Code: Select all

/usr/local/nagiosxi/scripts/reconfigure_nagios.sh: line 17: ./import_nagiosql.sh: No such file or directory
While

Code: Select all

ls -la /usr/local/nagiosxi/scripts/import_nagiosql.sh
-rwxr-xr-x 1 nagios nagios 432 Aug  8 00:32 /usr/local/nagiosxi/scripts/import_nagiosql.sh
Executing an 'Apply Configuration' from the XI gui works fine though.

Grtz

Willem
Hmm.. changing it to /usr/local/nagiosxi/scripts/import_nagiosql.sh (in the reconfigure script) seems to have worked on my box.

Re: Using reconfigure_nagios.sh results in error

Posted: Mon Aug 24, 2015 3:38 pm
by jolson
The issue here is that the reconfigure_nagios script calls the import_nagiosql script using a relative path. Try running the script from the 'scripts' directory.

Code: Select all

cd /usr/local/nagiosxi/scripts
./reconfigure_nagios.sh

Re: Using reconfigure_nagios.sh results in error

Posted: Mon Aug 24, 2015 3:53 pm
by WillemDH
That works better Jesse, but it seem like my changes are not getting applied. I copied the localhost.cfg service config file to my home folder, made some edits, but the (small) configuration changes aren't applied and the localhost.cfg file in the imports folder is gone.

As you can see these are the changes:

Code: Select all

sudo diff ~/localhost.cfg /usr/local/nagios/etc/services/localhost.cfg
6c6
< # Date:             2015-08-24 22:04:43
---
> # Date:             2015-08-24 22:46:49
68a69,71
>       max_check_attempts              5
>       check_interval                  5
>       retry_interval                  1
69a73
>       notification_interval           60
Any idea what I'm doing wrong here?

Grtz

Willem

Re: Using reconfigure_nagios.sh results in error

Posted: Mon Aug 24, 2015 4:40 pm
by jolson
I'm not sure - I just tested the procedure making some small modifications, and it worked well for me. Could you post both configuration files please? Feel free to sanitize them. :)

I will attempt to reproduce and resolve this issue on my end.

Re: Using reconfigure_nagios.sh results in error

Posted: Mon Aug 24, 2015 5:18 pm
by gormank
From the diff output it looks like you removed entries in localhost.cfg. To do that you need to copy your .cfg files that have that host in them, such as services files and hostgroups.cfg, delete the host, then import it.

Re: Using reconfigure_nagios.sh results in error

Posted: Tue Aug 25, 2015 9:16 am
by ssax
WillemDH, if you go to Configure > Core Config Manager > Tools > Import and you try to import it does it give you any errors? I know it's not the way you want to do it but it may shed some light on what is occurring.

Re: Using reconfigure_nagios.sh results in error

Posted: Tue Aug 25, 2015 1:53 pm
by WillemDH
The localhost.cfg does indeed only have services in it. Is it required to add the host info too? That could be the reason the changes are not getting applied. I'm on holiday for a week and I don't have access to the complete cfg file atm. I'll update this thread hopefully next week.

Re: Using reconfigure_nagios.sh results in error

Posted: Tue Aug 25, 2015 2:03 pm
by hsmith
WillemDH wrote:The localhost.cfg does indeed only have services in it. Is it required to add the host info too? That could be the reason the changes are not getting applied. I'm on holiday for a week and I don't have access to the complete cfg file atm. I'll update this thread hopefully next week.
Sounds good, let us know when you get back! Enjoy your holiday.