Generate config failed

Support requests, bug reports, questions etc.
pch
NConf rookie
NConf rookie
Posts: 18
Joined: Tue Dec 20, 2011 14:05

Generate config failed

Post by pch » Tue Jan 31, 2012 14:59

Hello,

I have finished to import all my nagios config but when I would like to generate the config files I got errors messages:

Code: Select all

Checking services...
Error: There are no services defined!
Checked 0 services.
Checking hosts...
Warning: Host 'host01' has no services associated with it!
Error: Contact group 'admins' specified in host 'host01' is not defined anywhere!
Warning: Host 'host02' has no services associated with it!
Error: Contact group 'admins' specified in host 'host02' is not defined anywhere!
Warning: Host 'host02' has no services associated with it!
Error: Contact group 'admins' specified in host 'host02' is not defined anywhere!
Warning: Host 'host03' has no services associated with it!
Error: Contact group 'admins' specified in host 'host03' is not defined anywhere!
I realy don´t understand this failure because all my hosts and services are imported. On the "service" section I can see that all services are linked to an host. I have no contactgroup named "admins" so I don´t unerstand from where this name comes. I have only one contact groupt xxx with 4 contacts. I have searched into my .cfg file with the grep -ni admins *.cfg and there are no result found.

Thank you in advance for your help.

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

Re: Generate config failed

Post by agargiulo » Tue Jan 31, 2012 16:01


pch
NConf rookie
NConf rookie
Posts: 18
Joined: Tue Dec 20, 2011 14:05

Re: Generate config failed

Post by pch » Tue Jan 31, 2012 16:48

Thanks !

now it stills this error:

Code: Select all

Error: There are no services defined!
Checked 0 services.
Checking hosts...
Warning: Host 'host1' has no services associated with it!
Warning: Host 'host2' has no services associated with it!
Warning: Host 'host3' has no services associated with it!
Warning: Host 'host4' has no services associated with it!

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

Re: Generate config failed

Post by agargiulo » Wed Feb 01, 2012 00:34

Well, define some services for your hosts then :)

pch
NConf rookie
NConf rookie
Posts: 18
Joined: Tue Dec 20, 2011 14:05

Re: Generate config failed

Post by pch » Wed Feb 01, 2012 13:27

agargiulo wrote:Well, define some services for your hosts then :)
I´m sorry I don´t understand. I have already the service well linked to the host.
See below on the both screenshot:
win.png
host preview
win.png (44.67 KiB) Viewed 5564 times
serv.png
service preview
serv.png (8.94 KiB) Viewed 5564 times

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

Re: Generate config failed

Post by agargiulo » Wed Feb 01, 2012 14:22

OK, so the monitored-by flag is set for your host(s) ?
How many Nagios collectors did you configure?
Is the service-enabled flag set to 'yes' for your service(s)?

pch
NConf rookie
NConf rookie
Posts: 18
Joined: Tue Dec 20, 2011 14:05

Re: Generate config failed

Post by pch » Wed Feb 01, 2012 14:58

agargiulo wrote:OK, so the monitored-by flag is set for your host(s) ?
yes, I can see that my Distrib Collector is linked to the host.
host.PNG
host.PNG (27.29 KiB) Viewed 5560 times
agargiulo wrote:How many Nagios collectors did you configure?
I have only one which is a "Distrib Collector"
agargiulo wrote:Is the service-enabled flag set to 'yes' for your service(s)?
yes they are.
serv.PNG
serv.PNG (7.18 KiB) Viewed 5560 times

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

Re: Generate config failed

Post by agargiulo » Wed Feb 01, 2012 15:18

Hm, that's very strange. Could you try executing the generate_config script on the command line?

Code: Select all

nconf/bin/generate_config.pl
The output should be written to the nconf/temp/ folder. Can you verify if the temp/Default_Colllector/services.cfg really is empty?
If so, try increasing the DEBUG_GENERATE loglevel in config/nconf.php and run the generate script again. Do you see any warnings?

pch
NConf rookie
NConf rookie
Posts: 18
Joined: Tue Dec 20, 2011 14:05

Re: Generate config failed

Post by pch » Wed Feb 01, 2012 16:13

agargiulo wrote:Hm, that's very strange. Could you try executing the generate_config script on the command line?

Code: Select all

nconf/bin/generate_config.pl
The output should be written to the nconf/temp/ folder. Can you verify if the temp/Default_Colllector/services.cfg really is empty?
If so, try increasing the DEBUG_GENERATE loglevel in config/nconf.php and run the generate script again. Do you see any warnings?
Well ! very strange from the command line it s works. The script return no errors and the /temp is full of .cfg !

EDIT: I have increased the DEBUG_GENERATE to 5 (Trace) and I got the error message :

[ERROR] |NConf::ExportNagios::create_test_cfg| Could not open nconf/temp/test/collector_host.cfg for writing

Maybe it s because the file exist already ?

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

Re: Generate config failed

Post by agargiulo » Fri Feb 03, 2012 19:53

Ah, it might be a permission problem then. When you generate the config from commandline the files in nconf/temp/ are created by a different user than the one apache uses to write the files when you generate through the GUI.

When in doubt, erase everything within the temp folder and try generating the config again over the GUI.

pch
NConf rookie
NConf rookie
Posts: 18
Joined: Tue Dec 20, 2011 14:05

Re: Generate config failed

Post by pch » Tue Feb 07, 2012 11:28

agargiulo wrote:Ah, it might be a permission problem then. When you generate the config from commandline the files in nconf/temp/ are created by a different user than the one apache uses to write the files when you generate through the GUI.

When in doubt, erase everything within the temp folder and try generating the config again over the GUI.
agargiulo, what do you mean ? shall I reinstall nconf from the begining again or just to remove the /temp should works?

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

Re: Generate config failed

Post by agargiulo » Tue Feb 07, 2012 14:47

Just remove the contents of the nconf/temp/ folder, not the folder itself.

Code: Select all

cd nconf/
rm -rf temp/*

pch
NConf rookie
NConf rookie
Posts: 18
Joined: Tue Dec 20, 2011 14:05

Re: Generate config failed

Post by pch » Tue Feb 07, 2012 15:52

I´m sorry but this doesn´t work.
I have removed the /temp folder then I have clicked on the link to generate the configuration and I got this error and warning messages:
error.PNG
error.PNG (34.71 KiB) Viewed 5519 times
I have executed the script from the command line:
temp.PNG
temp.PNG (27.76 KiB) Viewed 5519 times
What is wrong ?

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

Re: Generate config failed

Post by agargiulo » Thu Feb 09, 2012 01:04

Whats inside of the temp/collector_xxx/services.cfg file? Are the generated service definitions OK?

Try generating the config on the command line again and then running the syntax check on the command line:
/path/to/bin/nagios -v nconf/temp/test/collector_xxx.cfg

pch
NConf rookie
NConf rookie
Posts: 18
Joined: Tue Dec 20, 2011 14:05

Re: Generate config failed

Post by pch » Fri Feb 10, 2012 11:31

agargiulo wrote:Whats inside of the temp/collector_xxx/services.cfg file? Are the generated service definitions OK?
yes the services definitions are right generated.

Example:

Code: Select all

define service {
                service_description                   Cpfw
                check_command                         check_process!
                host_name                             nagios-xxx
                check_period                          24x7
                notification_period                   24x7
                contact_groups                        +group
                max_check_attempts                    15
                check_interval                        10
                retry_interval                        2
                notification_interval                 15
                notification_options                  c,r
                event_handler_enabled                 0
                register                              0
                use                                   basic-service
}

Try generating the config on the command line again and then running the syntax check on the command line:
/path/to/bin/nagios -v nconf/temp/test/collector_xxx.cfg
I don´t have any collector_xxx.cfg maybe this is the problem ?

Code: Select all

 ls -l /nconf/temp/collector_xxx/
total 36
-rw-r--r-- 1 root root     0 Feb  7 14:38 advanced_services.cfg
-rw-r--r-- 1 root root     0 Feb  7 14:38 host_dependencies.cfg
-rw-r--r-- 1 root root     0 Feb  7 14:38 hostgroups.cfg
-rw-r--r-- 1 root root  3010 Feb  7 14:38 hosts.cfg
-rw-r--r-- 1 root root     0 Feb  7 14:38 service_dependencies.cfg
-rw-r--r-- 1 root root     0 Feb  7 14:38 servicegroups.cfg
-rw-r--r-- 1 root root 30909 Feb  7 14:38 services.cfg
It s not normal that servicegroup and hostgroup are empty.
sgrp.PNG
sgrp.PNG (7.36 KiB) Viewed 5489 times
hgrp.PNG
hgrp.PNG (7.99 KiB) Viewed 5489 times

Locked