Using reconfigure_nagios.sh results in error

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
User avatar
WillemDH
Posts: 2320
Joined: Wed Mar 20, 2013 5:49 am
Location: Ghent
Contact:

Using reconfigure_nagios.sh results in error

Post 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
Last edited by WillemDH on Mon Aug 24, 2015 3:41 pm, edited 1 time in total.
Nagios XI 5.8.1
https://outsideit.net
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: Using reconfigure_nagios.sh results in error

Post 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.
Former Nagios Employee.
me.
jolson
Attack Rabbit
Posts: 2560
Joined: Thu Feb 12, 2015 12:40 pm

Re: Using reconfigure_nagios.sh results in error

Post 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
Twits Blog
Show me a man who lives alone and has a perpetually clean kitchen, and 8 times out of 9 I'll show you a man with detestable spiritual qualities.
User avatar
WillemDH
Posts: 2320
Joined: Wed Mar 20, 2013 5:49 am
Location: Ghent
Contact:

Re: Using reconfigure_nagios.sh results in error

Post 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
Nagios XI 5.8.1
https://outsideit.net
jolson
Attack Rabbit
Posts: 2560
Joined: Thu Feb 12, 2015 12:40 pm

Re: Using reconfigure_nagios.sh results in error

Post 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.
Twits Blog
Show me a man who lives alone and has a perpetually clean kitchen, and 8 times out of 9 I'll show you a man with detestable spiritual qualities.
gormank
Posts: 1114
Joined: Tue Dec 02, 2014 12:00 pm

Re: Using reconfigure_nagios.sh results in error

Post 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.
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Using reconfigure_nagios.sh results in error

Post 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.
User avatar
WillemDH
Posts: 2320
Joined: Wed Mar 20, 2013 5:49 am
Location: Ghent
Contact:

Re: Using reconfigure_nagios.sh results in error

Post 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.
Nagios XI 5.8.1
https://outsideit.net
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: Using reconfigure_nagios.sh results in error

Post 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.
Former Nagios Employee.
me.
Locked