Alignak-monitoring-contrib / alignak-webui

Web User Interface for Alignak monitoring framework
GNU Affero General Public License v3.0
8 stars 4 forks source link

Global event handler #84

Closed mohierf closed 8 years ago

mohierf commented 8 years ago

As reported by @spea1

WebUI host properties not working if only Global Service & Host Event Handler is enabled (Webbrowser say Error: 500 Internal Server Error)

But host and service properties is working if Global Service & Host Event Handler is enabled!

2016-09-04 19:14:03,602 - alignak_webui.plugins.hosts.hosts - WARNING - History types: webui.comment,check.result,check.request,check.requested,ack.add,ack.processed,ack.delete,downtime.add,downtime.processed,downtime.delete
2016-09-04 19:14:03,602 - alignak_webui.objects.datamanager - INFO - update_object, request to update: <Authenticated user, id: 57cc55b2bbdac60257b1fffa, name: admin, role: administrator>
2016-09-04 19:14:03,657 - alignak_webui.plugins.hosts.hosts - WARNING - History selected types: []
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/bottle.py", line 862, in _handle
    return route.call(**args)
  File "/usr/local/lib/python2.7/dist-packages/bottle.py", line 1732, in wrapper
    rv = callback(*a, **ka)
  File "/usr/local/lib/python2.7/dist-packages/bottle.py", line 3633, in wrapper
    return template(tpl_name, **tplvars)
  File "/usr/local/lib/python2.7/dist-packages/bottle.py", line 3609, in template
    return TEMPLATES[tplid].render(kwargs)
  File "/usr/local/lib/python2.7/dist-packages/bottle.py", line 3399, in render
    self.execute(stdout, env)
  File "/usr/local/lib/python2.7/dist-packages/bottle.py", line 3386, in execute
    eval(self.co, env)
  File "/usr/local/lib/python2.7/dist-packages/alignak_webui-0.5.0.a-py2.7.egg/alignak_webui/plugins/hosts/views/host.tpl", line 373, in <module>
    %include("_widget.tpl", widget_name=widget['template'], options=widget['options'], embedded=True, title=None)
  File "/usr/local/lib/python2.7/dist-packages/bottle.py", line 3376, in _include
    return self.cache[_name].execute(env['_stdout'], env)
  File "/usr/local/lib/python2.7/dist-packages/bottle.py", line 3386, in execute
    eval(self.co, env)
  File "/usr/local/lib/python2.7/dist-packages/alignak_webui-0.5.0.a-py2.7.egg/alignak_webui/views/_widget.tpl", line 47, in <module>
    %include(widget_name, **locals())
  File "/usr/local/lib/python2.7/dist-packages/bottle.py", line 3376, in _include
    return self.cache[_name].execute(env['_stdout'], env)
  File "/usr/local/lib/python2.7/dist-packages/bottle.py", line 3386, in execute
    eval(self.co, env)
  File "/usr/local/lib/python2.7/dist-packages/alignak_webui-0.5.0.a-py2.7.egg/alignak_webui/plugins/hosts/views/host_information_widget.tpl", line 344, in <module>
    <a href="/commands#{{host.event_handler.name}}">{{ host.event_handler.name }}</a>
AttributeError: 'str' object has no attribute 'name'
[pid: 1027|app: 0|req: 10/31] 172.21.96.239 () {36 vars in 690 bytes} [Sun Sep  4 19:14:03 2016] GET /host/ceph01 => generated 756 bytes in 549 msecs (HTTP/1.1 500) 2 headers in 99 bytes (1 switches on core 0)
mohierf commented 8 years ago

What is happening is due to the fact that event handler is enabled for an host, but no event handler command is defined for this host. I suppose that Alignak is using the globally defined event handler command to run an event handler for the hosts that do not have their own ...

But, when the WebUI is displaying the host properties page, no verification is done to check if an event handler is really available for this host.

mohierf commented 8 years ago

Note that it should be the same behaviour for some other host/service parameters ...