Default_collector: Error generating config

Support requests, bug reports, questions etc.
Locked
r_wilcox
starter
starter
Posts: 4
Joined: Tue Oct 27, 2009 17:06

Default_collector: Error generating config

Post by r_wilcox » Tue Oct 27, 2009 17:15

you will pardon the double post if this has been discussed, i tried to search and was told ¨generating, config, nconf, template" were all too common. i digress...

i am seeing the following error when generating. i have a feeling this is specific to our use of the ´generic-service´. any help would be greatly appreciated.

Code: Select all

Website: http://www.nagios.org
Reading configuration data...
   Read main config file okay...
Processing object config file '/var/www/nconf/temp/global/contacts.cfg'...
Processing object config file '/var/www/nconf/temp/global/timeperiods.cfg'...
Processing object config file '/var/www/nconf/temp/global/misccommands.cfg'...
Processing object config file '/var/www/nconf/temp/global/contactgroups.cfg'...
Processing object config file '/var/www/nconf/temp/global/checkcommands.cfg'...
Processing object config file '/var/www/nconf/temp/Default_collector/hosts.cfg'...
Processing object config file '/var/www/nconf/temp/Default_collector/hostgroups.cfg'...
Processing object config file '/var/www/nconf/temp/Default_collector/extended_host_info.cfg'...
Processing object config file '/var/www/nconf/temp/Default_collector/services.cfg'...
Processing object config file '/var/www/nconf/temp/Default_collector/servicegroups.cfg'...
Processing object config file '/var/www/nconf/temp/Default_collector/extended_service_info.cfg'...
Error: Template 'generic-service' specified in service definition could not be not found (config file '/var/www/nconf/temp/Default_collector/services.cfg', starting on line 134)
   Error processing object config files!

User avatar
agargiulo
NConf developer
NConf developer
Posts: 725
Joined: Fri Mar 06, 2009 17:50
Location: Zurich, Switzerland
Contact:

Re: Default_collector: Error generating config

Post by agargiulo » Wed Oct 28, 2009 17:58

Hi.

Could you explain what you are trying to do exactly? Are you trying to set up service templates, i.e. have you added a "use" attribute to your service class and linked a service to your "generic-service" template?

The problem seems to be, that Nagios is trying to read a config file containing a reference to an object it does not know.
This is the case, you are referencing an item (in your case "generic-service") that is unknown to the collector server.

We are aware of this and will be implementing this feature in the near future. For now though, working with service templates is not supported...

r_wilcox
starter
starter
Posts: 4
Joined: Tue Oct 27, 2009 17:06

Re: Default_collector: Error generating config

Post by r_wilcox » Thu Oct 29, 2009 04:15

Are you trying to set up service templates, i.e. have you added a "use" attribute to your service class and linked a service to your "generic-service" template?
Yes I do believe this is where the problem may lie. We have added a *use* attribute to the service class and link it as you describe. The generic-service template has not been modified outside of the default. Just to ensure we are on the same page, here is an example of an entry in the import that is throwing the error.

Code: Select all

define service{
        use                             generic-service  
	contact_groups			abc
        hostgroup_name                  Xservers
        service_description             Optools Status
	check_command			check_http!-u /optools/queueMonitor.aspx
	notifications_enabled		1
        max_check_attempts		2
	process_perf_data		1
	action_url			/nagios/pnp/index.php?host=$HOSTNAME$&srv=$SERVICEDESC$
        }
In the mean time... do you have any ideas on how we could implement this with current functionality?

Thanks

r_wilcox
starter
starter
Posts: 4
Joined: Tue Oct 27, 2009 17:06

Re: Default_collector: Error generating config

Post by r_wilcox » Mon Nov 02, 2009 21:27

bump

User avatar
agargiulo
NConf developer
NConf developer
Posts: 725
Joined: Fri Mar 06, 2009 17:50
Location: Zurich, Switzerland
Contact:

Re: Default_collector: Error generating config

Post by agargiulo » Tue Nov 03, 2009 17:59

Sorry for the late reply. I am currently working on implementing exactly this functionality.

Can you send me your service-template definition for the "generic-service" ?
If I understand properly, what you're doing is you're assigning template "generic-service" to the service "Optools Status", which is then assigned to the hostgroup "Xservers".

I have successfully gotten templates to work by doing this:

1. in NConf add a new class named "service-template", set the "generated filename" to something like "service_templates.cfg" and the "Nagios object definition" to "service".

2. add three new attributes to that class: "name", "use" & "register". "use" is an "assign_many" attribute which allows you to inherit from other service-templates, and "register" is a "select" attribute containing the values "0::1 (default 0)"

3. add a "use" attribute to the "service" class, type is "assign_one" (or many if you prefer)

4. create a service-template, link it to a service

When you generate the config you should now have a new file in your "global" folder called "service_templates.cfg" and the "use" attribute should be set for those services you've linked.

This is how far I got. I haven't tested assigning services to a hostgroup yet. That might be the cause of your problem if you are using more than one collector...

r_wilcox
starter
starter
Posts: 4
Joined: Tue Oct 27, 2009 17:06

Re: Default_collector: Error generating config

Post by r_wilcox » Tue Nov 03, 2009 20:31

thanks... let me give that a go and see what happens.

when i get an error generating the config, most of the time i get a print line something along the lines of:

Code: Select all

Error: Could not register service (config file '/var/www/nconf/temp/Default_collector/services.cfg', starting on line 1)
   Error processing object config files!
unfortunately i can't check that services.cfg because it is a 'temp' state. is there any way to write the configs no matter what the error is so i can inspect the document that is trying to be processed?

thanks

User avatar
agargiulo
NConf developer
NConf developer
Posts: 725
Joined: Fri Mar 06, 2009 17:50
Location: Zurich, Switzerland
Contact:

Re: Default_collector: Error generating config

Post by agargiulo » Wed Nov 04, 2009 10:30

Yes, there is. You can execute the "generate_config" script from the commandline.

Go to your nconf folder and run "nconf/bin/generate_config.pl". Don't cd into the "bin" folder, or the script might have problems with the paths.
Once the script is done running, you will find the generated config under "nconf/temp/".

You can run a manual syntax check by executing your Nagios binary like this:
"/path/to/bin/nagios -v nconf/temp/test/Default_collector.cfg"

Make sure you delete the contents of "nconf/temp/*" after you're done debugging. Otherwise the NConf tool might not have the necessary permissons to overwrite the content in the "temp" folder.

Locked