Error: Unexpected EOF in file

I am receiving this error after making changes to this configh file.  How do I correct this?

Error: Unexpected EOF in file '/usr/local/nagios/etc/objects/hosts.cfg' on line 299 - check for a missing closing bracket.
   Error processing object config files!
280 #define host{
    281 #       use             generic-switch
    282 #       host_name       5094_Switch
    283 #       parents         1059_Switch
    284 #       hostgroups      cisco-switches
    285 #       alias           cs0003
    286 #       address         192.x.x.2
    287 #       hostgroups      cisco-switches
    288 #       }
    290 #define host{
    291 #       use             generic-switch
    292 #       host_name       5102_Switch
    293 #       parents         1059_Switch
    294 #       hostgroups      cisco-switches
    295 #       alias           cs0002
    296 #       address         192.x.x.3
    297 #       hostgroups      cisco-switches
    298 #       }
Who is Participating?
Sanga CollinsConnect With a Mentor Systems AdminCommented:
you may have an extra { or } somewhere in the file. Can you post the entire config file?
Daniel HelgenbergerCommented:
Since all the definitions are commented out - it may be really missing in a line way prior the one you posted or get the error on.
TintinConnect With a Mentor Commented:
The problem will be that you are missing a closing brace further up in the file.   The reason it says line 299 is that it has searched to the end of the file and hasn't found one.
Build your data science skills into a career

Are you ready to take your data science career to the next step, or break into data science? With Springboard’s Data Science Career Track, you’ll master data science topics, have personalized career guidance, weekly calls with a data science expert, and a job guarantee.

Gerwin Jansen, EE MVEConnect With a Mentor Topic Advisor Commented:
Open your config file in an editor that has syntax highlighting (for example notepad++), hover over the brackets and you should be able to find the missing bracket.
gumball60Author Commented:
The error probably was else where in file. I recreated the file and it worked.  Thanks for your help.
gumball60Author Commented:
I've requested that this question be closed as follows:

Accepted answer: 0 points for gumball60's comment #a39504558

for the following reason:

I created a new file to replace it.
gumball60, you were given answers as to where the problem was and how to fix it, so not sure why you don't want to accept any of the answers as a solution.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.