error message template - beginner
error message template - beginner
Dear Forum,
First thanks for all the volunteer helpers.
This ist my first try with nagios and :qI am just learning and following a book . I am trying to understand creating your own templates .
I created this one template (one file)
define host{
name host-template-generic
register 0
check_command check-host-alive
max_check_attempts 3
check_period 24x7
check_interval 5
retry_interval 2
notification_options d,u,r
}
define host{
name host-template-windows
register 0
use host-template-generic
contact_groups admins
}
define host{
name host-template-linux
register 0
use host-template-generic
contact_groups admins
}
I am getting this error message from nagios:
Error: Template 'host-template-generic' specified in host definition could not be not found (config file '/etc/nagios/example/templates/hosts.cfg', starting on line 34)
Error processing object config files!
How is it possible that nagios can not see the host-template-generic ? The name is correct. What do I not understand or overlook?
Many thanks for helping me in advance.
kristine
First thanks for all the volunteer helpers.
This ist my first try with nagios and :qI am just learning and following a book . I am trying to understand creating your own templates .
I created this one template (one file)
define host{
name host-template-generic
register 0
check_command check-host-alive
max_check_attempts 3
check_period 24x7
check_interval 5
retry_interval 2
notification_options d,u,r
}
define host{
name host-template-windows
register 0
use host-template-generic
contact_groups admins
}
define host{
name host-template-linux
register 0
use host-template-generic
contact_groups admins
}
I am getting this error message from nagios:
Error: Template 'host-template-generic' specified in host definition could not be not found (config file '/etc/nagios/example/templates/hosts.cfg', starting on line 34)
Error processing object config files!
How is it possible that nagios can not see the host-template-generic ? The name is correct. What do I not understand or overlook?
Many thanks for helping me in advance.
kristine
-
- Skynet Drone
- Posts: 2620
- Joined: Wed Feb 11, 2015 1:56 pm
Re: error message template - beginner
You are showing 3 host templates here, and they look good and verify well. The problem is likely that this file is not being processed, and you have a host elsewhere referencing these templates.
Make sure that you have a line in your nagios.cfg that reads something like:
It needs to point to the file where you're defining these templates.
Make sure that you have a line in your nagios.cfg that reads something like:
Code: Select all
cfg_file=/etc/nagios/myfile.cfg
Re: error message template - beginner
Thank you for your fast response.
I have the whole directory pointing to cfg_dir=/etc/nagios/example
I thought this would be enough?
I created now 3 different templates and got the same error message.
My host files look like that
define host{
use host-template-linux
host_name firewall.localdomain
alias Firewall (internes Bein)
address 192.168.178.11
}
The name of the host files and template files ARE THE SAME but in a differnet directory.Could this be a problem ?
many thanks. kristine
I have the whole directory pointing to cfg_dir=/etc/nagios/example
I thought this would be enough?
I created now 3 different templates and got the same error message.
My host files look like that
define host{
use host-template-linux
host_name firewall.localdomain
alias Firewall (internes Bein)
address 192.168.178.11
}
The name of the host files and template files ARE THE SAME but in a differnet directory.Could this be a problem ?
many thanks. kristine
-
- Skynet Drone
- Posts: 2620
- Joined: Wed Feb 11, 2015 1:56 pm
Re: error message template - beginner
That should work fine, and it actually even does on my test machine.
Can you post the output of the following:
Note your paths MAY not be the same as mine and you may have to adjust your command to accommodate that.
Can you post the output of the following:
Code: Select all
/sbin/nagios -v /etc/nagios/nagios.cfg
Re: error message template - beginner
Thank you again..this is my output:
(Information : Suse 13.1 System, Nagios installed through rpm)
Nagios Core 3.5.1
Copyright (c) 2009-2011 Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 08-30-2013
License: GPL
Website: http://www.nagios.org
Reading configuration data...
Read main config file okay...
Processing object config directory '/etc/nagios/example'...
Processing object config directory '/etc/nagios/example/hostgroups'...
Processing object config directory '/etc/nagios/example/contacts'...
Processing object config directory '/etc/nagios/example/commands'...
Processing object config file '/etc/nagios/example/commands/host.cfg'...
Processing object config file '/etc/nagios/example/commands/notifications.cfg'...
Processing object config directory '/etc/nagios/example/contactgroups'...
Processing object config directory '/etc/nagios/example/hosts'...
Processing object config file '/etc/nagios/example/hosts/linux.cfg'...
Processing object config file '/etc/nagios/example/hosts/printer.cfg'...
Processing object config file '/etc/nagios/example/hosts/windows.cfg'...
Processing object config file '/etc/nagios/example/timeperiods.cfg'...
Processing object config directory '/etc/nagios/example/templates'...
Processing object config file '/etc/nagios/example/templates/linux.cfg'...
Processing object config file '/etc/nagios/example/templates/hosts.cfg'...
Processing object config file '/etc/nagios/example/templates/printer.cfg'...
Processing object config file '/etc/nagios/example/templates/windows.cfg'...
Processing object config file '/etc/nagios/example/templates/contacts.cfg'...
Processing object config directory '/etc/nagios/example/services'...
Processing object config file '/etc/nagios/example/contacts.cfg'...
Error: Template 'host-template-generic' specified in host definition could not be not found (config file '/etc/nagios/example/templates/windows.cfg', starting on line 1)
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.
(Information : Suse 13.1 System, Nagios installed through rpm)
Nagios Core 3.5.1
Copyright (c) 2009-2011 Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 08-30-2013
License: GPL
Website: http://www.nagios.org
Reading configuration data...
Read main config file okay...
Processing object config directory '/etc/nagios/example'...
Processing object config directory '/etc/nagios/example/hostgroups'...
Processing object config directory '/etc/nagios/example/contacts'...
Processing object config directory '/etc/nagios/example/commands'...
Processing object config file '/etc/nagios/example/commands/host.cfg'...
Processing object config file '/etc/nagios/example/commands/notifications.cfg'...
Processing object config directory '/etc/nagios/example/contactgroups'...
Processing object config directory '/etc/nagios/example/hosts'...
Processing object config file '/etc/nagios/example/hosts/linux.cfg'...
Processing object config file '/etc/nagios/example/hosts/printer.cfg'...
Processing object config file '/etc/nagios/example/hosts/windows.cfg'...
Processing object config file '/etc/nagios/example/timeperiods.cfg'...
Processing object config directory '/etc/nagios/example/templates'...
Processing object config file '/etc/nagios/example/templates/linux.cfg'...
Processing object config file '/etc/nagios/example/templates/hosts.cfg'...
Processing object config file '/etc/nagios/example/templates/printer.cfg'...
Processing object config file '/etc/nagios/example/templates/windows.cfg'...
Processing object config file '/etc/nagios/example/templates/contacts.cfg'...
Processing object config directory '/etc/nagios/example/services'...
Processing object config file '/etc/nagios/example/contacts.cfg'...
Error: Template 'host-template-generic' specified in host definition could not be not found (config file '/etc/nagios/example/templates/windows.cfg', starting on line 1)
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.
Re: error message template - beginner
Hello,
this is how my templates folder looks like . hosts= my generic template for hosts.
Thanks again for any help.
Kristine
this is how my templates folder looks like . hosts= my generic template for hosts.
Thanks again for any help.
Kristine
- Attachments
-
- Screenshot.png (10.62 KiB) Viewed 3055 times
- Box293
- Too Basu
- Posts: 5126
- Joined: Sun Feb 07, 2010 10:55 pm
- Location: Deniliquin, Australia
- Contact:
Re: error message template - beginner
Can you provide us with the template file? Not a copy of the contents of the file but the actual file?
I'm going to throw a dart at the dartboard guess that perhaps the files are in a DOS format?
http://www.cyberciti.biz/faq/howto-unix ... xt-format/
I'm going to throw a dart at the dartboard guess that perhaps the files are in a DOS format?
http://www.cyberciti.biz/faq/howto-unix ... xt-format/
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Re: error message template - beginner
Thank you.
Here is my template file created with vi and the ending cfg.
Regards Kristine
Here is my template file created with vi and the ending cfg.
Regards Kristine
- Attachments
-
- hosts.cfg
- My template file
- (417 Bytes) Downloaded 298 times
-
- Skynet Drone
- Posts: 2620
- Joined: Wed Feb 11, 2015 1:56 pm
Re: error message template - beginner
The problem is your comments.
From http://nagios.sourceforge.net/docs/3_0/ ... tions.html
When creating and/or editing configuration files, keep the following in mind:
Lines that start with a '#' character are taken to be comments and are not processed
Directive names are case-sensitive
Characters that appear after a semicolon (;) in configuration lines are treated as comments and are not processed
From http://nagios.sourceforge.net/docs/3_0/ ... tions.html
When creating and/or editing configuration files, keep the following in mind:
Lines that start with a '#' character are taken to be comments and are not processed
Directive names are case-sensitive
Characters that appear after a semicolon (;) in configuration lines are treated as comments and are not processed
Re: error message template - beginner
Jipeeh!! Yes !!!!!!!!!!
Thanks to you and the forum !
Regards Kristine
Ps.:Thread closed