ITRS-Group / monitor-ninja

Ninja is Now Just Awesome - a modern web GUI for Naemon
Other
32 stars 16 forks source link

Selecting actions on hostgroup gives error #4

Open techadrian opened 7 years ago

techadrian commented 7 years ago

Hello Guys,

When selecting the Actions Icon on a Hostgroups View (Menu Locatgion : Monitor/Hostgroups/All Hostgroups) I receive the following error : Fatal error: Call to undefined method HostGroup_Model::get_icon_image() in /var/www/html/ninja/modules/monitoring/controllers/extinfo.php on line 324

I managed to track down the problem here : /var/www/html/ninja/modules/monitoring/models/base/basehostgroup.php Therese ones seem to be missing : private $icon_image = ""; private $icon_image_alt = "";

in comparison with /var/www/html/ninja/modules/monitoring/models/base/basehost.php .

Same goes for Servicegroups, same error same apparently incomplete class.
Making the changes manually to basehostgroup.php and baseservicegroup.php fixed the issue. I suspect something happening at build, maybe you can have a look. I attached both files, modified and original to take a look.

Cheers, Adrian

basehostgroup.php.zip

chelmertz commented 7 years ago

Thanks for the reports, keep 'em coming, Adrian! ;)

I think you are almost correct here, but I would look in a slightly different direction. Host- and servicegroups do not have icons. The best reference I can give you to this is this page, the overview of Naemon objects and their properties: http://www.naemon.org/documentation/usersguide/objectdefinitions.html

So, instead of adding a property to the Ninja ORM models, which would resolve to something that does not reside in Naemon; I think we need to check if the object is a host or service prior to calling $object->get_icon_image() in extinfo.php.

I will make this change in our internal CI system and get back to you here. Thanks for reporting!