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.
Error: Template
-
avandemore
- Posts: 1597
- Joined: Tue Sep 27, 2016 4:57 pm
Re: Error: Template
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
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
Re: Error: Template
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.
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.
Re: Error: Template
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.
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
Re: Error: Template
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
#
###############################################################################
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
#
###############################################################################
Re: Error: Template
This is strange... For some reason, you have only two host templates in the config file. Try the following.
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.
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/
Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: Error: Template
Thank you so much.... those steps solved the problem.