View Full Version : Problem loading nagios config into Centreon
mrcoffee
08-06-2008, 02:27 AM
Nagios 3.0.3
Centreon 2.0.b6
I got the following issues:
J'ai les prochen problems:
output:
Nagios 3.0.3
Copyright (c) 1999-2008 Ethan Galstad (http://www.nagios.org)
Last Modified: 06-25-2008
License: GPL
Reading configuration data...
Error Invalid max_check_attempts value for host 'apc-env-merc'
Error Could not register host (config file '/usr/local/centreon/filesGeneration/nagiosCFG/1/hosts.cfg', starting on line 30)
***> 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/nagios/etc/nagios.cfg'
***> 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.
Centreon : All configuration files copied with success.
Running configuration check...done
Stopping nagios: done.
Starting nagios: done.
Anyone got an idea??
Merci a tout les monde!
mrcoffee
08-06-2008, 03:34 AM
Ok, I found out the generated files are not good:
Every host in the /usr/local/centreon/filesGeneration/nagiosCFG/1/hosts.cfg file misses the 'use templatename' directive, and it misses more.
When I manually add the 'use' directive for every host I get the next error message after trying to debug the files using just the option "Run Nagios debug (-v)" (so I don't generate new ones from the database):
Nagios 3.0.3
Copyright (c) 1999-2008 Ethan Galstad (http://www.nagios.org)
Last Modified: 06-25-2008
License: GPL
Reading configuration data...
Error Service description, host name, or check command is NULL
Error Could not register service (config file '/usr/local/centreon/filesGeneration/nagiosCFG/1/services.cfg', starting on line 18)
When I check the other files, lots of data is missing. So it's obvious the import and then the output is going wrong.
I used this HOWTO: http://en.doc.centreon.com/Configure:LoadYourPreviousNagiosCfg
Dear people, you got any idea's for me?
Sylvester
08-06-2008, 10:45 AM
I suggest you load your files following this order :
1. checkcommands.cfg
2. hosts.cfg
3. services.cfg
mrcoffee
08-06-2008, 06:11 PM
:( it doesn't work, same issue.
I created files containing the different types of configurations I wanted to import:
checkcommands
notificationcommands
services
all_hosts
timeperiods
contactgroups
host_templates
servicegroups
services_templates.
I loaded them one by one in this order and I got the same issue. Next step:
What I then did is manually add a template to all of the 284 hosts (thank you very much for the 'massive change' option!).
Then I got the error message no services are associated with all of the hosts. So I got to can fix this one to manually, but this takes time and it's not hte way it's supposed to be done.
I can see the services upload did not go right too, but i made a little mistake here so I'll try to fix this. But I also have the idea the upload of templates servicegroups also failed, at least the link between the servicegroup and the services.
- Have you got another tip for me on this one?
- Another question: how can I clean the database and start all over again importing files?
- Last question for now: how can I make sure that graphs are being generated? Do you have some docs about this, can I use nagiosgrapher templates I created before?
(this product looks great by the way... really impressed and I'm sure I'm going to do get it working here in the hospital where I work to make our lives as a system engineer easier and the patients more happy)
Well, not sure if you have a clean way to clean the database to just remove nagios related hosts, services configuration, but I tend to just drop the whole database, then reinstall centreon, which after I modified my installation script to contain all the default options, it takes a few minutes.
On the other hand, I have the same problem that no matter what order I import nagios configs, none of the relationship between my hosts and my services are imported. In my nagios configuration, the relationship is defined between hosts and servicegroups.
mrcoffee
08-06-2008, 08:56 PM
I solved a lot of problems by really making sure to import the data in the right order.
01 checkcommandfile
02 notificationcommands
03 timeperiods
04 servicegroups
05 contacts
06 contact_groups
07 services_templates <-- this one fails, why oh why?!
08 host_templates
09 hostgroups
10 hosts
11 services <--- fails because there are no service templates but I also think it fails because of other reasons that I am not aware of yet
So as you see I'm almost there and this just has to work. It just the problem with the upload of my services_templates. Does anyone have any idea why? Here are two examples of services_templates. The dependency "contactgroups" are already in the database so this can't be the issue I think.
define service{
name generic-service
active_checks_enabled 1
passive_checks_enabled 1
parallelize_check 1
obsess_over_service 1
check_freshness 0
notifications_enabled 1
event_handler_enabled 1
flap_detection_enabled 1
failure_prediction_enabled 1
process_perf_data 1
retain_status_information 1
retain_nonstatus_information 1
is_volatile 0
check_period 7x24
max_check_attempts 3
normal_check_interval 14
retry_check_interval 2
contact_groups 24u-medewerkers,kantoortijd-medewerkers
notification_options w,u,c,r
notification_interval 60
notification_period 7x24
register 0
}
########
# 7x24 #
########
define service{
name 7x24-service
use generic-service
max_check_attempts 4
normal_check_interval 14
retry_check_interval 1
register 0
notification_interval 60
contact_groups 24u-medewerkers,kantoortijd-medewerkers
notification_options c,r
notification_period 7x24
}
mrcoffee
08-06-2008, 09:16 PM
To be able to import the service templates I must add to each template the service _description parameter:
service_description generic-service
service_description 7x24-service
By the way, I found out how to start with a clean database. Just start importing the data as described above tstarting with step one (checkcommands) and select the "YES" radiobutton for the option "Delete all configuration for the chosen type of files". For next steps select the "No" option.
The upload of the services still fails. Zut. I get a few services in the database, but not all. Seems to be the last data-import problem. And then I'll probably run into some other ones.. :)
Hi, your tips on adding service_description to be able to import service template is definitely right and important.
Have you being able to import your host to service relationship? I don't see it listed anywhere in your posts above.
mrcoffee
08-07-2008, 01:11 AM
I think I did it. I did not have to do anyting with the services. They were loaded and I can see them being attached directly to a host or to a hostgroup. It took me a while to understand the pages. The relationships were made by hosts who were member of a group that had services attached to it. Or some services were related directly to a certain host, not using hostgroups.
I have the idea though that sometimes the "services by host" or "services by host group" pages do not show up correctly. I get blank pages when i.e. I select a pagenumber to see more services.
Then I had to manually configure the users that were imported in the database. A lot of fields needed to be filled that for some reason were not filled:
- Host and Service notification options
- Host and Service notification period
- Host and Service commands
I guess this has got something to do with the fact that I think that usertemplates are not used by Centreon. And these templates contained this info in my Nagios config.
It took me a lot of hours the last couple of days but now I think I did it. And I just found out Centreon 2.0 RC1 is released so I can do some more work. But this has to wait for next week cause I'm going France for a few days. And since I practiced my French on these forums a bit I feel confident about my ability to speak French ;)
Hope this thread helps others who were stuck like me.
>>>>> I just finished writing this text and now I get blank pages when I try to see the "services by host" or "services groups" in the configuration part of Centreon. C'est pas bien! Mais maintenant je vais dormir, je suis fatigue et je veux me repose où quelque chose comme ça.
mrcoffee
08-07-2008, 01:57 PM
I don't get it:
- I import the data succesfully.
- I can see in the CONFIGURATION tab all the hosts, services, users, commands, etcetera.
- I do a Nagios configurations file export
- Nagios imports everything as it's supposed to do and runs
But Centreon has not changed. On the HOME tab I don't see any hosts, services et. And on the CONFIGURATION tab all the hosts and services are deleted, while I can still see the users, the commands, timeschedules, notifications, etc.
The NDO event broker seems to work.
Idea's?
-> It was a problem with the Nagios userrights. The user I logged in with did not have the rights in the cgi.conf to see the info on the webpages. Voila!