Bug #2298

hostgroups.cfg is missing members line

Added by Marc-Christian Petersen about 3 years ago. Updated almost 3 years ago.

Status:ClosedStart date:04/20/2011
Priority:HighDue date:
Assignee:Sylvestre Ho% Done:

100%

Category:Centreon - Configuration
Target version:Centreon-2.2
Resolution:fixed

Description

Hi,

I'm using, well, I want to use Centreon v2.2-RC2 and found a bug
after importing my existing Nagios configuration.

I have lot's of hostgroups, all the hostgroups have services.
The GUI lists them correctly, the relations are there and correct,
i.e.:

Host: firewall.local
Member of: Hostgroup apache2, which has a service named 'Process apache2'

It's listed correctly in the GUI for the host, and it's correctly listed for
the hostgroup, but the generated hostgroups.cfg file has no line named members
where all the related hosts should be listed.

Looking in genHostGroups.php I don't see anything that gets the stuff out from
the database, so I think it's missing ;)

so I can build the new nagios config but nagios complains about every host that
the host has no service definition, because of missing "members" line in hostgroups.cfg

There are also other bugs when importing (i.e. missing Contacts/Contact Groups for the
Services and Hosts), but I will open a new issue for that.

thanks.

History

#1 Updated by Marc-Christian Petersen about 3 years ago

hmm, found this: http://nagios.sourceforge.net/docs/3_0/objectdefinitions.html#host

hostgroups: This directive is used to identify the short name(s) of the hostgroup(s) that the host belongs to.
Multiple hostgroups should be separated by commas. This directive may be used as an alternative to (or in addition to)
using the members directive in hostgroup definitions.

It seems that it is not working in Nagios as expected/documented?!

#2 Updated by Marc-Christian Petersen about 3 years ago

please close this bug.

all the problems are from importing existing nagios configs.

I'll open up a new bug report for problems when importing configs.

#3 Updated by Marc-Christian Petersen about 3 years ago

grmpf. okay, please do not close this bug.

I've started from scratch as it seems the database was fucked up.
Now import kind of works, but the main issue remains.

anyone has an idea what's going on? Bug in Nagios that hostgroups in host
definition is not working?

#4 Updated by Marc-Christian Petersen about 3 years ago

sorry for all the unqualified comments, not my day today :(

I have 669 services in the database:

root@nagios-centreon:/opt/nagios/etc/centreon/ # mysql nagios_centreon -e 'select * from service\G;' | grep -c row
669
root@nagios-centreon:/opt/nagios/etc/centreon/ #

and a config write creates this:

root@nagios-centreon:/opt/nagios/etc/centreon/ # grep -c 'define service' * | grep -v ':0'
services.cfg:27
root@nagios-centreon:/opt/nagios/etc/centreon/ #

so only 27 services available to nagios. Where are all the other services?

#5 Updated by Marc-Christian Petersen about 3 years ago

aHAAAAAAAAAA!

the import of my existing configs did not import most of the linked contacts/contact groups.
The existing 27 services HAVE a contact group defined, the rest has NOT.

Thats due to another whatever bug during import of an existing config.

looking at the logs I see ton's of lines like:

18:52|0|0|DB Error: constraint violation QUERY : INSERT INTO contactgroup_host_relation (host_host_id, contactgroup_cg_id) VALUES ('27', '')
18:52|0|0|DB Error: constraint violation QUERY : INSERT INTO host_hostparent_relation (host_parent_hp_id, host_host_id) VALUES ('', '55')
18:52|0|0|DB Error: constraint violation QUERY : INSERT INTO contactgroup_service_relation (contactgroup_cg_id, service_service_id) VALUES ('', '38')
18:52|0|0|DB Error: constraint violation QUERY : INSERT INTO contactgroup_service_relation (contactgroup_cg_id, service_service_id) VALUES ('', '39')
18:52|0|0|DB Error: constraint violation QUERY : INSERT INTO contactgroup_service_relation (contactgroup_cg_id, service_service_id) VALUES ('', '40')
18:52|0|0|DB Error: constraint violation QUERY : INSERT INTO contactgroup_service_relation (contactgroup_cg_id, service_service_id) VALUES ('', '41')
18:52|0|0|DB Error: constraint violation QUERY : INSERT INTO contactgroup_service_relation (contactgroup_cg_id, service_service_id) VALUES ('', '46')
18:52|0|0|DB Error: constraint violation QUERY : INSERT INTO contactgroup_service_relation (contactgroup_cg_id, service_service_id) VALUES ('', '47')
18:52|0|0|DB Error: constraint violation QUERY : INSERT INTO contactgroup_service_relation (contactgroup_cg_id, service_service_id) VALUES ('', '49')
and lots more.

so and therefor next question: why do we need contact groups linked?

that is NOT necessary. If a service has no contacts/contact groups the contact/contact group
of the HOST is used instead.

#6 Updated by Julien Mathis about 3 years ago

  • Status changed from New to Assigned
  • Assignee set to Sylvestre Ho

#7 Updated by Sylvestre Ho about 3 years ago

Would you mind providing us with your configuration files so that we can run our tests?
For your convenience, you may send it directly to me :

Thanks!

#8 Updated by Marc-Christian Petersen about 3 years ago

Hi Sylvestre,

yep, I'll send it to you.

#10 Updated by Sylvestre Ho about 3 years ago

Thanks, I did receive it.

I'll keep you updated :-)

#11 Updated by Sylvestre Ho about 3 years ago

Can you please checkout revision r12143

Thanks :)

#12 Updated by Marc-Christian Petersen about 3 years ago

sure ;)

sorry for my ignorance but what does it fix exactly?

#13 Updated by Sylvestre Ho about 3 years ago

Mainly your mysql query errors.

#14 Updated by Marc-Christian Petersen about 3 years ago

ok. mysql errors gone. thank you.

#15 Updated by Julien Mathis almost 3 years ago

  • Status changed from Assigned to Closed
  • % Done changed from 0 to 100
  • Resolution set to fixed

Also available in: Atom PDF