Icinga / icingaweb2-module-director

The Director aims to be your new favourite Icinga config deployment tool. Director is designed for those who want to automate their configuration deployment and those who want to grant their “point & click” users easy access to the configuration.
https://icinga.com/docs/director/latest
GNU General Public License v2.0
413 stars 203 forks source link

Adding service to host template results in display group error #1249

Open phantium opened 7 years ago

phantium commented 7 years ago

Adding service to host template results in display group error

Expected Behavior

Current Behavior

No valid elements specified for display group

#0 /usr/share/icingaweb2/modules/director/application/forms/IcingaAddServiceForm.php(66): Zend_Form->addDisplayGroup(Array, 'object_definiti...', Array)
#1 /usr/share/icingaweb2/modules/director/application/forms/IcingaAddServiceForm.php(35): Icinga\Module\Director\Forms\IcingaAddServiceForm->groupMainProperties()
#2 /usr/share/icingaweb2/modules/director/library/Director/Web/Form/QuickForm.php(356): Icinga\Module\Director\Forms\IcingaAddServiceForm->setup()
#3 /usr/share/icingaweb2/modules/director/library/Director/Web/Form/QuickForm.php(517): Icinga\Module\Director\Web\Form\QuickForm->prepareElements()
#4 /usr/share/icingaweb2/modules/director/library/Director/Web/Form/QuickForm.php(530): Icinga\Module\Director\Web\Form\QuickForm->setRequest(Object(Icinga\Web\Request))
#5 /usr/share/icingaweb2/modules/director/library/Director/Web/Form/QuickForm.php(367): Icinga\Module\Director\Web\Form\QuickForm->getRequest()
#6 /usr/share/icingaweb2/modules/director/application/controllers/HostController.php(52): Icinga\Module\Director\Web\Form\QuickForm->handleRequest()
#7 /usr/share/icingaweb2/library/vendor/Zend/Controller/Action.php(507): Icinga\Module\Director\Controllers\HostController->serviceAction()
#8 /usr/share/php/Icinga/Web/Controller/Dispatcher.php(76): Zend_Controller_Action->dispatch('serviceAction')
#9 /usr/share/icingaweb2/library/vendor/Zend/Controller/Front.php(937): Icinga\Web\Controller\Dispatcher->dispatch(Object(Icinga\Web\Request), Object(Icinga\Web\Response))
#10 /usr/share/php/Icinga/Application/Web.php(389): Zend_Controller_Front->dispatch(Object(Icinga\Web\Request), Object(Icinga\Web\Response))
#11 /usr/share/php/Icinga/Application/webrouter.php(109): Icinga\Application\Web->dispatch()
#12 /usr/share/icingaweb2/public/index.php(4): require_once('/usr/share/php/...')
#13 {main}

Possible Solution

Steps to Reproduce (for bugs)

  1. Hosts -> Host Templates -> Create a template
  2. Edit created template -> Select Services tab
  3. Add service Result: No valid elements specified for display group

Context

Your Environment

6d6178 commented 7 years ago

I think you need to add a Service-Template first. Go to Icinga-Director -> Services -> Service Templates and add at least one Service. Maybe ping4 or something that you know you will need. A fresh install does not include any configured services but you need to have at least one before creating a Host-Template. This is (probably) because you can define the same service, or rather check, with different Options like "Check-Interval" and so on. I hope this could help you.

phantium commented 7 years ago

I have recently done that, but had not checked if adding a service would now work. But indeed this resolves the issue, thank you.

Perhaps it would be better to show an explanation if no service template is available yet, rather than "crashing".

6d6178 commented 7 years ago

I totally agree. This was my first time installing Icinga2 and I don't think this is explained/documented anywhere in the official documentation. I might be wrong though because I tend to just scroll through tutorials. If I am right, it might be worth considering adding this to the documentation or, as you said, a explanation/unique error messsage.

ProjectPatatoe commented 6 years ago

Same problem here, definitely need some sort of message. Interestingly, I don't have a service template or a service sets, yet when i do to add service set i don't get an error.

Al2Klimov commented 5 years ago

By the way, adding a service to an actual host (not a template) produces the same error.

Thomas-Gelf commented 5 years ago

I'm unable to reproduce this with a random Director instance. Does this only happen with a fresh new Director installation with no Service Templates defined at all?

Al2Klimov commented 5 years ago

Confirmed.

Thomas-Gelf commented 5 years ago

Thanks @Al2Klimov!

VGerris commented 8 months ago

Interesting this but is still open, still happens on recent version of Icinga. The least improvement that can be done is to show a readible error, like : 'A service template needs to be defined to add a service here' or something more specific.

Someone that is familiar with this part of the code probably knows if that can be a one on one change or that the error can mean other things. Would be nice to see it fixed, thank you!