Config Verification fails

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
ajwusv
Posts: 28
Joined: Tue Jul 05, 2011 10:13 am

Config Verification fails

Post by ajwusv »

I started receiving an error after making a change to the contact for Alerting. Config verification fails. Was working fine until I tried adding emails into the additional address fields. I have tried resetting permissions, restarting services, restarting server. None of those worked. Obviously cant manually edit the contacts.cfg file. Here is the error output from the check configuration option in Admin tools.

Error: Template '' specified in contact definition could not be not found (config file '/usr/local/nagios/etc/contacts.cfg', starting on line 14)
Error processing object config files!
Error: Template '' specified in contact definition could not be not found (config file '/usr/local/nagios/etc/contacts.cfg', starting on line 14)
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.



I am on 2011R2.2 on the Nagios VM

Thanks
Nagios XI
32 bit VM Image - 2011 R2.2
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Config Verification fails

Post by scottwilkerson »

One of your contacts must have a template specified that doesn't exist.

Go to Configure -> Core Config Manager -> Contacts -> Modify Contact (select one at a time) -> Misc Settings

We want to look at what is specified under "Additional templates"

Either we have a template name that no longer exists or blank or something.

If you cannot find it that way, or if you have a ton of contacts you can download the bad configuration from
Configure -> Core Config Manager -> Configuration Snapshots
and download the latest snapshot tarball that has the Config Error
From here you can open the contacts.cfg and look at line 14 to see which contact is having the problem.
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
ajwusv
Posts: 28
Joined: Tue Jul 05, 2011 10:13 am

Re: Config Verification fails

Post by ajwusv »

I had tried adding email addresses into the Addon Address 1,2, and 3, applied the config and then decided to do the notifications a different way. After I removed the email addresses from the Addon address fields and went to apply the config, it failed. Now whenever I try to apply the config, it bombs out.

The misc settings -> additional templates have nothing in them but if I look in the fields in the contacts.cfg file, there is nothing there, and in the old version from the last successful apply, there was nothing in them either.

Here is the current contacts.cfg file output

define contact {
contact_name IT Support
alias XX XXXXXX IT Support
host_notifications_enabled 1
service_notifications_enabled 1
host_notification_period workhours
service_notification_period workhours
host_notification_options d
service_notification_options c
host_notification_commands notify-host-by-email
service_notification_commands notify-service-by-email
retain_status_information 1
email xxxxx@xxxx.com
address1 xxxxxx@xxxx.com.com
address2 rxxxxxxx@xxxx.com
address3 szxxxxxx@xxxx.com
}

define contact {
contact_name nagiosadmin
alias Nagios Administrator
host_notifications_enabled 1
service_notifications_enabled 1
host_notification_period nagiosadmin_notification_times
service_notification_period nagiosadmin_notification_times
host_notification_options d,u,r,f,s
host_notification_commands xi_host_notification_handler
service_notification_commands xi_service_notification_handler
email nagios@localhost
use generic-contact,xi_contact_generic
}


And Here is the old working contacts.cfg file setup(the setup that I want to return to). I obviously removed the email addresses just for cleanliness.



define contact {
contact_name IT Support
alias US Vision IT Support
host_notifications_enabled 1
service_notifications_enabled 1
host_notification_period workhours
service_notification_period workhours
host_notification_options d
service_notification_options c
host_notification_commands notify-host-by-email
service_notification_commands notify-service-by-email
can_submit_commands 1
email XXXXXXXXXX@xsxxx.com
}

define contact {
contact_name nagiosadmin
alias Nagios Administrator
host_notifications_enabled 1
service_notifications_enabled 1
host_notification_period nagiosadmin_notification_times
service_notification_period nagiosadmin_notification_times
host_notification_options d,u,r,f,s
host_notification_commands xi_host_notification_handler
service_notification_commands xi_service_notification_handler
email nagios@localhost
use generic-contact,xi_contact_generic
}


Thanks again
Nagios XI
32 bit VM Image - 2011 R2.2
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Config Verification fails

Post by scottwilkerson »

If you go to
Configure -> Core Config Manager -> Templates -> Contacts Templates

Do you have both generic-contact and xi_contact_generic ?

AND

Are both of them marked Active = Yes ?
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
ajwusv
Posts: 28
Joined: Tue Jul 05, 2011 10:13 am

Re: Config Verification fails

Post by ajwusv »

Yes they are both there and active.
Nagios XI
32 bit VM Image - 2011 R2.2
User avatar
lmiltchev
Former Nagios Staff
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Config Verification fails

Post by lmiltchev »

Go to the Core Config Manager->Alerting->Contacts->IT Support->Modify->Misc Settings tab->Additional templates and add "xi_contact_generic" template. Save. Apply Configuration.

Also, run the Write Config Tool and show us the output:

Core Config Manager->Tools->Write Config Files
Be sure to check out our Knowledgebase for helpful articles and solutions!
ajwusv
Posts: 28
Joined: Tue Jul 05, 2011 10:13 am

Re: Config Verification fails

Post by ajwusv »

Tried the first step and it failed.

Here is the output from "write additional data"

Write timeperiods.cfg ...
Configuration file successfully written!
Write commands.cfg ...
Configuration file successfully written!
Write contacts.cfg ...
Configuration file successfully written!
Write contactgroups.cfg ...
Configuration file successfully written!
Write contacttemplates.cfg ...
Configuration file successfully written!
Write servicedependencies.cfg ...
Configuration file successfully written!
Write hostdependencies.cfg ...
Configuration file successfully written!
Write serviceescalations.cfg ...
Configuration file successfully written!
Write hostescalations.cfg ...
Configuration file successfully written!
Write serviceextinfo.cfg ...
Configuration file successfully written!
Write hostextinfo.cfg ...
Configuration file successfully written!


Output from "Check configuration Files"

Error: Template '' specified in contact definition could not be not found (config file '/usr/local/nagios/etc/contacts.cfg', starting on line 14)
Error processing object config files!

Error: Template '' specified in contact definition could not be not found (config file '/usr/local/nagios/etc/contacts.cfg', starting on line 14)
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.


I've omitted the rest of the output because I don't think you want to see a giant wall of text for every host and cfg file that we have(over 500 at this point)

Thanks
Nagios XI
32 bit VM Image - 2011 R2.2
User avatar
lmiltchev
Former Nagios Staff
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Config Verification fails

Post by lmiltchev »

Open the contacts.cfg in a text editor and see what you have on (or around) line 14 that's causing the problem.

Code: Select all

vi /usr/local/nagios/etc/contacts.cfg
:set number
Be sure to check out our Knowledgebase for helpful articles and solutions!
ajwusv
Posts: 28
Joined: Tue Jul 05, 2011 10:13 am

Re: Config Verification fails

Post by ajwusv »

line 14 is

define contact {


the notifications work but they send them to the wrong address. and its not all of the hosts that are sending them to the wrong address.

is there a way to just manually update the MySql database so that it gets the proper information and then it will just push it into the contacts.cfg ?
Nagios XI
32 bit VM Image - 2011 R2.2
User avatar
lmiltchev
Former Nagios Staff
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Config Verification fails

Post by lmiltchev »

Did you try this?

Go to the Core Config Manager->Alerting->Contacts->IT Support->Modify->Misc Settings tab->Additional templates and add "xi_contact_generic" template. Save. Apply Configuration.

Also, go to the Core Config Manager->Alerting->Contacts, click on the "Download" button, save the file and post it, so we can take a look at it.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked