Errors importing cfg files into Nagios XI

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
rickwilson7425
Posts: 125
Joined: Tue Mar 18, 2014 3:20 pm

Re: Errors importing cfg files into Nagios XI

Post by rickwilson7425 »

I am making progress but am getting a persistent error when verifying the config files. I have edited the file to take out the definition at that line number and it still bombs at the same line number. Here is the message:

Error: Unexpected start of object definition in file '/usr/local/nagios/etc/commands.cfg' on line 369. Make sure you close preceding objects before starting a new one.

Nagios Core 3.5.0
Copyright (c) 2009-2011 Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 03-15-2013
License: GPL

Website: http://www.nagios.org
Reading configuration data...
Read main config file okay...
Processing object config directory '/usr/local/nagios/etc/static'...
Processing object config file '/usr/local/nagios/etc/static/xitest.cfg'...
Processing object config file '/usr/local/nagios/etc/static/xitemplates.cfg'...
Processing object config file '/usr/local/nagios/etc/static/xiobjects.cfg'...
Processing object config file '/usr/local/nagios/etc/contacttemplates.cfg'...
Processing object config file '/usr/local/nagios/etc/contactgroups.cfg'...
Processing object config file '/usr/local/nagios/etc/contacts.cfg'...
Processing object config file '/usr/local/nagios/etc/timeperiods.cfg'...
Processing object config file '/usr/local/nagios/etc/commands.cfg'...
Error: Unexpected start of object definition in file '/usr/local/nagios/etc/commands.cfg' on line 369. Make sure you close preceding objects before starting a new one.
Error processing object config files!


***> One or more problems was encountered while processing the config files...

Check your configuration file(s) to ensure that they contain valid
directives and data defintions. If you are upgrading from a previous
version of Nagios, you should be aware that some variables/definitions
may have been removed or modified in this version. Make sure to read
the HTML documentation regarding the config files, as well as the
'Whats New' section to find out what has changed.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Errors importing cfg files into Nagios XI

Post by abrist »

rickwilson7425 wrote:Error: Unexpected start of object definition in file '/usr/local/nagios/etc/commands.cfg' on line 369. Make sure you close preceding objects before starting a new one.
This sounds like you have an object that was not closed with a " } ". What is the output of:

Code: Select all

head -379 /usr/local/nagios/etc/commands.cfg | tail -20
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
rickwilson7425
Posts: 125
Joined: Tue Mar 18, 2014 3:20 pm

Re: Errors importing cfg files into Nagios XI

Post by rickwilson7425 »

It is:

[root@pcp045088pcs etc]# head -379 /usr/local/nagios/etc/commands.cfg | tail -20
define command {
command_name check_windows_remoting
command_line $USER1$/check_x224 -H $HOSTADDRESS$
}
define command {
command_name check_windows_memory_physical
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c CheckMEM -a MaxWarn=$ARG1$% MaxCrit=$ARG2$% ShowAll type=physical
}
define command {
command_name check_windows_cluster
command_line $USER1$/check_cluster --service -l $ARG1$ -w $ARG2$ -c $ARG3$ -d $ARG4$
}
define command {
command_name check_nrpe_disk_generic
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c check_nrpe_filesystem_generic -a "$ARG1$"
}
define command {
command_name check_windows_file
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c CheckFiles -a path="$ARG1$" pattern=$ARG2$ filter="$ARG3$ $ARG4$ $ARG5$" MaxCrit=1
}
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Errors importing cfg files into Nagios XI

Post by tmcdonald »

Could you PM that contacts.cfg file to me so I can see the whole thing?

EDIT: Sorry for the confusion, I meant the commands.cfg file
Former Nagios employee
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Errors importing cfg files into Nagios XI

Post by tmcdonald »

The file that you sent me, commands.cfg, is that the /usr/local/nagios/etc/commands.cfg file? It doesn't have the typical format (comments at the top) that XI typically uses. There are only 268 lines in that file.
Former Nagios employee
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Errors importing cfg files into Nagios XI

Post by tmcdonald »

Worked with rickwilson via PM. Could not find any commands.cfg file with 369 lines anywhere in his /usr/local/nagios/etc directory.
Former Nagios employee
rickwilson7425
Posts: 125
Joined: Tue Mar 18, 2014 3:20 pm

Re: Errors importing cfg files into Nagios XI

Post by rickwilson7425 »

I tried installing a fresh copy of NagiosXI from source code onto a RedHat 6.5 virtual system.

Everything went fine until I started importing the processed original cfg files.

I imported the commands.cfg, wrote the config file and verified it. It worked fine.

I then imported the timeperiods.cfg and again everything went fine.

Then I imported the notification_commands.cfg. I wrote the config out to disk without errors. When I tried to verify the config file I got an error message that there was a missing close bracket for a definition at line 736. This is the same thing that has happened previously with 3 separate installations and attempts to convert the core 3.5 files into XI. Close examination of the file shows that there are no missing brackets.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Errors importing cfg files into Nagios XI

Post by lmiltchev »

Let's clarify - you imported the "commands.cfg", wrote the config and verified it. Then you imported the "timeperiods.cfg", wrote it, and verified it. Up to this point you didn't get any config errors. Only after importing the "notification_commands.cfg", you got the config errors, correct?
Can you PM this file to any of us on the Nagios Tech Support team?
Be sure to check out our Knowledgebase for helpful articles and solutions!
rickwilson7425
Posts: 125
Joined: Tue Mar 18, 2014 3:20 pm

Re: Errors importing cfg files into Nagios XI

Post by rickwilson7425 »

That is correct.

I already PM'ed Tim McDonald and sent him the file a week ago.
rickwilson7425
Posts: 125
Joined: Tue Mar 18, 2014 3:20 pm

Re: Errors importing cfg files into Nagios XI

Post by rickwilson7425 »

lmiltchev - I sent you a PM with the error and the files attached.
Locked