Remove Predefined NConf OBjects Failure

Support requests, bug reports, questions etc.

Remove Predefined NConf OBjects Failure

Postby chri.s » Tue Dec 20, 2011 18:15

Hi everybody,

i have a Problem with my Icinga/nconf Kombo (1.6.1 + 1.3). I just wanted to skip over from Nagios to the new Icinga Development branch with old nag and nconf 1.2.6 i didn't get this problem.

But here is my Problem: I just installed my Icinga+nconf on my new monitoring server but when i want to remove node or a service i get everytime the problem:
Error: Service description, host name, or check command is NULL
Error: Could not register service (config file '/var/www/nconf/temp/Default_collector/advanced_services.cfg', starting on line 70)


When i want to find this config file to get further Information i can't find it. Here is the one Problem: The another: even when i start to search via a higher debug level i can't define whats the problem i have to fix. Maybe a Database Problem because the Program doesn't delete every relation? But it seems fine here.

Maybe somebody can give me a hopefully tip to get it working.

Thanks for your help !
chri.s
 

Re: Remove Predefined NConf OBjects Failure

Postby Tontonitch » Tue Dec 20, 2011 22:16

Hi,

When i want to find this config file to get further Information i can't find it.

Activate the debug mode: edit the config/nconf.php file and change DEBUG_MODE to 1.
Then try to generate again the configuration. This time, you should see a NagiosConfig_FAILED.tgz file in the output directory.
Uncompress it in a temporary directory (tar xfz NagiosConfig_FAILED.tgz) and check the object definition in Default_collector/advanced_services.cfg at line 70.
And if possible could you copy paste that object definition in this post, so I may be able to tell you what is missing ;)

BR,
Yannick
User avatar
Tontonitch
NConf addict
NConf addict
 
Posts: 254
Joined: Fri May 07, 2010 10:14
Location: Thionville, France

Re: Remove Predefined NConf OBjects Failure

Postby chri.s » Wed Dec 21, 2011 00:56

Hi Yannick,

Ok, i put on the debug mode in the config file and deleted the predefined node "hplj2605dn". (When i hasn't changed anything there is no error)

Icinga 1.6.1
Copyright (c) 2009-2011 Icinga Development Team (http://www.icinga.org)
Copyright (c) 2009-2011 Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 12-02-2011
License: GPL

Reading configuration data...
Read main config file okay...
Processing object config file '/var/www/nconf/temp/global/timeperiods.cfg'...
Processing object config file '/var/www/nconf/temp/global/contacts.cfg'...
Processing object config file '/var/www/nconf/temp/global/misccommands.cfg'...
Processing object config file '/var/www/nconf/temp/global/checkcommands.cfg'...
Processing object config file '/var/www/nconf/temp/global/host_templates.cfg'...
Processing object config file '/var/www/nconf/temp/global/service_templates.cfg'...
Processing object config file '/var/www/nconf/temp/global/contactgroups.cfg'...
Processing object config file '/var/www/nconf/temp/Default_collector/service_dependencies.cfg'...
Processing object config file '/var/www/nconf/temp/Default_collector/host_dependencies.cfg'...
Processing object config file '/var/www/nconf/temp/Default_collector/advanced_services.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/hosts.cfg'...
Processing object config file '/var/www/nconf/temp/Default_collector/hostgroups.cfg'...
Processing object config directory '/var/www/nconf/static_cfg'...
Warning: No host_name found for service definition or used template (config file '/var/www/nconf/temp/Default_collector/advanced_services.cfg', starting on line 60)
Error: Service description, host name, or check command is NULL
Error: Could not register service (config file '/var/www/nconf/temp/Default_collector/advanced_services.cfg', starting on line 60)
Error processing object config files!


***> The name of the main configuration file looks suspicious...

Make sure you are specifying the name of the MAIN configuration file on
the command line and not the name of another configuration file. The
main configuration file is typically '/usr/local/icinga/etc/icinga.cfg'
[...]


and here is line 60-67

define service {
service_description PING
check_interval 10
retry_interval 1
check_command check_ping!3000.0,80%!5000.0,100%
use generic-service
contact_groups +admins
}


but i can't see any misconfigured and/or faulty things in?

Thank you for your help!

BR,

chri.s
chri.s
 

Re: Remove Predefined NConf OBjects Failure

Postby Tontonitch » Wed Dec 21, 2011 01:23

Ok, that's a "bug" i discovered some days ago:
when having some advanced-services configured, you must associate it to at least a host / hostgroup / servicegroup.
indeed, all the advanced-services are written to cfg file even if not associations have been done. And nagios doesn't allow a service to not be associated to a host/hostgroup/servicegroup, so the config check fail.
Solution 1: remove any unused advanced-services from the NConf interface
Solution 2: adapt the config generation process to avoid unused advanced-services to be written to the advanced-services.cfg files.
I will look at solution 2 if I have time next days.
BR,
Yannick
User avatar
Tontonitch
NConf addict
NConf addict
 
Posts: 254
Joined: Fri May 07, 2010 10:14
Location: Thionville, France

Re: Remove Predefined NConf OBjects Failure

Postby Tontonitch » Sat Dec 24, 2011 14:19

Hi guys,

Attached the patch corresponding to the solution 2: advanced-services which are not assigned to any host/hostgroup/servicegroup are not written to the generated config anymore.

A git pull request will follow.

Best regards, and wish a happy Christmas time to everybody ! Image

Yannick
User avatar
Tontonitch
NConf addict
NConf addict
 
Posts: 254
Joined: Fri May 07, 2010 10:14
Location: Thionville, France

Re: Remove Predefined NConf OBjects Failure

Postby chri.s » Sat Jan 07, 2012 17:26

Hi Yannick,

thanks for your wishes, i wish you a good new Year. Hope you had a good time for relaxation.

I tried today to put in your solution to fix the problem after i spend the last days for configuring and fixing the notificationsystem.

But i still have the Problem with deleting a host-service combination (in detail: wanted to delete the normal connection of the nrpe explorer check together with windows servers which arent logged in (Server2008) and the explorer service also isn't running.)

There i get an error back. After i put your code in the corresponding file "ExportNagios.pm" i get the same error
thrown back?

How do i have to implement your fix into this file? Just place it at the end or do i have to delete something?

Maybe you can help me once more.

Thank you and best regards!

Chri.s
chri.s
 

Re: Remove Predefined NConf OBjects Failure

Postby x4FF3 » Tue Jan 17, 2012 16:16

Hi Chris,

after adding the patch i don't get any errors.

To apply the patch just copy the patch-file from above into the root-directory of nconf, like /var/www/nconf/ and execute this command:

patch -p0 < patchfile.

Greetings
David
x4FF3
starter
starter
 
Posts: 4
Joined: Tue Jan 17, 2012 16:13

Re: Remove Predefined NConf OBjects Failure

Postby Alexis Huxley » Thu Jan 19, 2012 17:34

I've applied the patch and it also makes no difference. The output remains:

Code: Select all
Icinga 1.0.2
Copyright (c) 2009-2010 Icinga Development Team (http://www.icinga.org)
Copyright (c) 2009 Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 06-30-2010
License: GPL

Reading configuration data...
Read main config file okay...
Processing object config file '/usr/local/opt/nconf/temp/global/timeperiods.cfg'...
Processing object config file '/usr/local/opt/nconf/temp/global/contacts.cfg'...
Processing object config file '/usr/local/opt/nconf/temp/global/misccommands.cfg'...
Processing object config file '/usr/local/opt/nconf/temp/global/checkcommands.cfg'...
Processing object config file '/usr/local/opt/nconf/temp/global/host_templates.cfg'...
Processing object config file '/usr/local/opt/nconf/temp/global/service_templates.cfg'...
Processing object config file '/usr/local/opt/nconf/temp/global/contactgroups.cfg'...
Processing object config file '/usr/local/opt/nconf/temp/Default_collector/service_dependencies.cfg'...
Processing object config file '/usr/local/opt/nconf/temp/Default_collector/host_dependencies.cfg'...
Processing object config file '/usr/local/opt/nconf/temp/Default_collector/advanced_services.cfg'...
Processing object config file '/usr/local/opt/nconf/temp/Default_collector/services.cfg'...
Processing object config file '/usr/local/opt/nconf/temp/Default_collector/servicegroups.cfg'...
Processing object config file '/usr/local/opt/nconf/temp/Default_collector/hosts.cfg'...
Processing object config file '/usr/local/opt/nconf/temp/Default_collector/hostgroups.cfg'...
Processing object config directory '/usr/local/opt/nconf/static_cfg'...
Error: No host_name found for service definition or used template (config file '/usr/local/opt/nconf/temp/Default_collector/advanced_services.cfg', starting on line 34)
Error processing object config files!

This is on a Debian 6.0.3 system. Anything else I can do? I can provide more info if required? Thanks and regards,

Alexis
Alexis Huxley
 

Re: Remove Predefined NConf OBjects Failure

Postby Tontonitch » Thu Jan 19, 2012 21:50

Hi,

Hereunder a safer way to apply a patch:

Check that the patch can be applied:
Code: Select all
$ cd <nconf dir>
$ patch -p0 --verbose --dry-run < patchfile


Then, if everything seems okay, you can apply the patch:
Code: Select all
$ patch -p0 --verbose < patchfile


For your problem, please attach your bin/lib/NConf/ExportNagios.pm file, I will check if it has been well applied.

BR,
Yannick
User avatar
Tontonitch
NConf addict
NConf addict
 
Posts: 254
Joined: Fri May 07, 2010 10:14
Location: Thionville, France

Re: Remove Predefined NConf OBjects Failure

Postby Guest » Thu Jan 19, 2012 22:16

I checked the patch had been applied correctly, but repeated applying it as per your instructions:

Code: Select all
spirali# patch -p0 --verbose --dry-run < ~/nconf-1.3.0-0_not_used_advanced_services_wont_be_written.patch
Hmm...  Looks like a unified diff to me...
The text leading up to this was:
--------------------------
|--- bin/lib/NConf/ExportNagios.pm.orig   2011-12-24 13:57:38.620626845 +0100
|+++ bin/lib/NConf/ExportNagios.pm   2011-12-24 14:02:16.870751718 +0100
--------------------------
Patching file bin/lib/NConf/ExportNagios.pm using Plan A...
Hunk #1 succeeded at 1014.
Hunk #2 succeeded at 1078.
Hunk #3 succeeded at 1111.
done
spirali# patch -p0 --verbose  < ~/nconf-1.3.0-0_not_used_advanced_services_wont_be_written.patch
Hmm...  Looks like a unified diff to me...
The text leading up to this was:
--------------------------
|--- bin/lib/NConf/ExportNagios.pm.orig   2011-12-24 13:57:38.620626845 +0100
|+++ bin/lib/NConf/ExportNagios.pm   2011-12-24 14:02:16.870751718 +0100
--------------------------
Patching file bin/lib/NConf/ExportNagios.pm using Plan A...
Hunk #1 succeeded at 1014.
Hunk #2 succeeded at 1078.
Hunk #3 succeeded at 1111.
done
spirali#


Then I clicked 'Generate Nagios config'' again but got:

Code: Select all
...
Processing object config file '/usr/local/opt/nconf/temp/Default_collector/hostgroups.cfg'...
Processing object config directory '/usr/local/opt/nconf/static_cfg'...
Error: No host_name found for service definition or used template (config file '/usr/local/opt/nconf/temp/Default_collector/advanced_services.cfg', starting on line 34)
Error processing object config files!


As bin/lib/NConf/ExportNagios.pm is ca. 1700 lines long I've put it at http://dione.no-ip.org/~alexis/ExportNagios.pm .

Many thanks for your assistance!

Alexis
Guest
 

Re: Remove Predefined NConf OBjects Failure

Postby agargiulo » Fri Jan 20, 2012 01:30

After having applied the patch, check if you have any unused advaced-services that are linked to a servicegroup. Try removing the servicegroup. That should solve the problem.

Yannick: There is a bug in your patch. Advanced-services that are not linked to any host or hostgroup must be removed, regardless of any servicegroup assignment.
I have adapted your patch and commited the new code here:

https://github.com/nconf/development/co ... e48a63a08e
User avatar
agargiulo
NConf developer
NConf developer
 
Posts: 725
Joined: Fri Mar 06, 2009 17:50
Location: Zurich, Switzerland

Re: Remove Predefined NConf OBjects Failure

Postby Tontonitch » Fri Jan 20, 2012 08:06

Good point. I don't remember why i also checked the servicegroup assigned... Thank for your correction ;)
Br,
Yannick
User avatar
Tontonitch
NConf addict
NConf addict
 
Posts: 254
Joined: Fri May 07, 2010 10:14
Location: Thionville, France

Re: Remove Predefined NConf OBjects Failure

Postby Guest » Fri Jan 20, 2012 11:18

agargiulo wrote:After having applied the patch, check if you have any unused advaced-services that are linked to a servicegroup. Try removing the servicegroup. That should solve the problem.


Indeed, that did fix the problem.

agargiulo wrote:I have adapted your patch and commited the new code here:

https://github.com/nconf/development/co ... e48a63a08e


I took this version of ExportNagios.pm and that also worked (after I'd restored my database and checked the problem had returned, of course). Thanks very much!

One unrelated point: what is an "advanced service"? I poked around in the Nagios documentation but didn't see any references to
the term and I don't find an explanation of it in the NConf docs. Probably I've just overlooked it, but an explanation or link to docs
would be appreciated.

Alexis
Guest
 

Re: Remove Predefined NConf OBjects Failure

Postby agargiulo » Fri Jan 20, 2012 12:00

what is an "advanced service"?

It's an NConf specific term. Prior to NConf 1.3, services where implemented poorly. They could only be assigned to 1 host at a time.
In order to allow for service-to-hostgroup assignments, we introduced a more advanced variant of services. It's a newer implementation of the same thing. Whenever possible, I suggest you use advanced-services as opposed to services. The "old" services might be removed in a later release of NConf.
User avatar
agargiulo
NConf developer
NConf developer
 
Posts: 725
Joined: Fri Mar 06, 2009 17:50
Location: Zurich, Switzerland

Re: Remove Predefined NConf OBjects Failure

Postby Alexis Huxley » Sun Jan 22, 2012 15:58

That clarifies things, thanks very much! Alexis
Alexis Huxley
 

Next

Return to Support (NConf 1.3.0)

Who is online

Users browsing this forum: No registered users and 1 guest

cron