Error: Template

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
rkurnik
Posts: 14
Joined: Fri Jul 22, 2016 10:20 am

Error: Template

Post by rkurnik »

Error: Template '' specified in host definition could not be not found (config file '/usr/local/nagios/etc/hosttemplates.cfg', starting on line 309)

After the upgrade to the latest version I'm running into a problem when I try to reload NagiosXI. I get the above error.

This systems has ran for the last 6 months without issue....

Compounding the issue there are only 55 lines in the mentioned file so I don't know what the reference to line 309 means.
avandemore
Posts: 1597
Joined: Tue Sep 27, 2016 4:57 pm

Re: Error: Template

Post by avandemore »

If you go to XI > Admin > Config Snapshots You'll see one in an error state. This is the one that the line 309 will be in.

A quick thing to try is this:
XI > Configure > Core Config Manager > Config File Management > Delete Files > Write Configs > Verify Files > Restart Nagios Core
Older Nagios Versions:
XI > Configure > Core Config Manager > Write Config Files > Delete > Write > Verify > Restart
Previous Nagios employee
rkurnik
Posts: 14
Joined: Fri Jul 22, 2016 10:20 am

Re: Error: Template

Post by rkurnik »

I had done what you had suggested yesterday to try and resolve and it did not resolve it... But I did it again today. And still the issue persists.

When I go and do this:
If you go to XI > Admin > Config Snapshots You'll see one in an error state. This is the one that the line 309 will be in.

I see a list with some mixed configs that have worked in the past and that are in error. If I do the command output for one of the ones in error it says this:

Reading configuration data...
Read main config file okay...
Error: Template '' specified in host definition could not be not found (config file '/usr/local/nagios/etc/hosttemplates.cfg', starting on line 309)
Error processing object config files!

I can not find where the problem is!

Also if I try to import one of the old configs that are marked as good they all error out with the same error when I try to apply the config....

If I can narrow down exactly what file or where the error is occurring then I think I can fix.
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Error: Template

Post by rkennedy »

Can you post the entire /usr/local/nagios/etc/hosttemplates.cfg file for us to review?

The other option if it's just a corrupt file some how, is running to Configure -> Core Config Manager -> Config File Management -> run a 'delete', 'write', and verify'. This will clear out the local files, and re-write them out from the database.
Former Nagios Employee
rkurnik
Posts: 14
Joined: Fri Jul 22, 2016 10:20 am

Re: Error: Template

Post by rkurnik »

I already deleted, rewrote and verified the files... Same result...

Here is the file:

hosttemplates.cfg
###############################################################################
#
# Host template configuration file
#
# Created by: Nagios Core Config Manager 2.5.2
# Date: 2016-12-17 08:57:54
# Version: Nagios 3.x config file
#
# --- DO NOT EDIT THIS FILE BY HAND ---
# Nagios CCM will overwrite all manual settings during the next update if you
# would like to edit files manually, place them in the 'static' directory or
# import your configs into the CCM by placing them in the 'import' directory.
#
###############################################################################

define host {
name linux-server
check_command check-host-alive!!!!!!!!
max_check_attempts 10
check_interval 5
retry_interval 1
check_period xi_timeperiod_24x7
contacts *********
contact_groups admins
notification_interval 1
notification_period 24x7
notification_options d,u,r,
notifications_enabled 1
register 0

}

define host {
name windows-server
hostgroups CORP-WINDOWS
check_command check-host-alive
max_check_attempts 10
check_interval 5
retry_interval 1
check_period 24x7
contact_groups admins
notification_interval 30
notification_period 24x7
notification_options d,r
register 0

}

###############################################################################
#
# Check command configuration file
#
# END OF FILE
#
###############################################################################
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Error: Template

Post by lmiltchev »

This is strange... For some reason, you have only two host templates in the config file. Try the following.

Code: Select all

mkdir -p /usr/local/nagios/etc/cfgprep
cd /tmp
wget https://assets.nagios.com/downloads/nagiosxi/5/xi-5.4.1.tar.gz
tar zxvf xi-5.4.1.tar.gz
cd nagiosxi/subcomponents/nagioscore/mods/cfg/import/
cp xiwzardtemplates.cfg /usr/local/nagios/etc/cfgprep/
Next, log in the CCM, go to "Import Config Files", and import the "xiwzardtemplates.cfg" file with "Overwrite Database" check-box selected. Don't apply configuration yet. Go to "Config File Management", click on "Write Configs", and "Verify Files". If you don't see any errors, apply configuration. If you do see errors, post them on the forum.
Be sure to check out our Knowledgebase for helpful articles and solutions!
rkurnik
Posts: 14
Joined: Fri Jul 22, 2016 10:20 am

Re: Error: Template

Post by rkurnik »

Thank you so much.... those steps solved the problem.
Locked