Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

generic service template without host_name/service_description definition #2024

Open
edefaria opened this issue Nov 17, 2022 · 1 comment
Open

Comments

@edefaria
Copy link

edefaria commented Nov 17, 2022

Link to this patch d680640

I upgraded to shinken 2.4.4 and has issue loading arbiter:

[1668706565] CRITICAL: [Shinken] Back trace of the error: Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/Shinken-2.4.4-py2.7.egg/shinken/daemons/arbiterdaemon.py", line 633, in main
    self.load_config_file()
  File "/usr/local/lib/python2.7/dist-packages/Shinken-2.4.4-py2.7.egg/shinken/daemons/arbiterdaemon.py", line 361, in load_config_file
    self.conf.create_objects(raw_objects)
  File "/usr/local/lib/python2.7/dist-packages/Shinken-2.4.4-py2.7.egg/shinken/objects/config.py", line 1117, in create_objects
    self.create_objects_for_type(raw_objects, t)
  File "/usr/local/lib/python2.7/dist-packages/Shinken-2.4.4-py2.7.egg/shinken/objects/config.py", line 1141, in create_objects_for_type
    setattr(self, prop, clss(lst, initial_index, self.conflict_policy))
  File "/usr/local/lib/python2.7/dist-packages/Shinken-2.4.4-py2.7.egg/shinken/objects/item.py", line 741, in __init__
    self.add_items(items, index_items)
  File "/usr/local/lib/python2.7/dist-packages/Shinken-2.4.4-py2.7.egg/shinken/objects/item.py", line 763, in add_items
    self.add_template(i)
  File "/usr/local/lib/python2.7/dist-packages/Shinken-2.4.4-py2.7.egg/shinken/objects/service.py", line 1359, in add_template
    tpl = self.index_template(tpl)
  File "/usr/local/lib/python2.7/dist-packages/Shinken-2.4.4-py2.7.egg/shinken/objects/item.py", line 853, in index_template
    tpl = self.manage_conflict(tpl, name)
  File "/usr/local/lib/python2.7/dist-packages/Shinken-2.4.4-py2.7.egg/shinken/objects/item.py", line 808, in manage_conflict
    objname = "%s/%s" % (item.host_name, item.service_description)
AttributeError: host_name

If service template definition has no host_name definition or service_description, the start of arbiter is crashing.

I use try/except print the item and it was a generic template service without setting host_name/service_description like :

define service {
        name                    my_service
        alias                   my-service
        use                     generic-service
        resultmodulations       unknown_is_critical
        contact_groups          admins
        check_interval          8
        retry_interval          5
        max_check_attempts      3
        register                0
}

For me, it is useful, the arbiter should register this service object in this case of inheritance definition like it was in 2.4.3.

@geektophe
Copy link
Collaborator

manage_conflict() should be able make the distinction between a template, and a terminal object, you're right. We'll fix that.

But this error is probably triggered because you're defining more than one service template with the same name attribute value. In 2.4.3, the old object was silently replaced by the new one. The manage_conflict() method has been added to overcome this issue in a more controllable way.

Could you check your configuration for an immediate fix, the time for us to patch ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants