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

Unable to initialize the class #30

Closed
wackou72 opened this issue Aug 10, 2020 · 3 comments
Closed

Unable to initialize the class #30

wackou72 opened this issue Aug 10, 2020 · 3 comments
Labels
bug Something isn't working

Comments

@wackou72
Copy link

Hello,
I tried to update from nagmap 1.6 to the 2.0 version.
I followed the installation process and migrate my config file using your parser, but first launching the website, I got the following error :

`Impossible d'initialiser la classe!

Détails: TypeError: Cannot read property 'forEach' of undefined

Stack: TypeError: Cannot read property 'forEach' of undefined at Host.createMarker (https://centreon.serac.fr/centreon/nagmap2/resources/js/classes/Host.js?v=2.0.0:45:19) at new Host (https://centreon.serac.fr/centreon/nagmap2/resources/js/classes/Host.js?v=2.0.0:13:22) at NagmapReborn.getHosts (https://centreon.serac.fr/centreon/nagmap2/resources/js/classes/NagmapReborn.js?v=2.0.0:216:28) at new NagmapReborn (https://centreon.serac.fr/centreon/nagmap2/resources/js/classes/NagmapReborn.js?v=2.0.0:37:31) at https://centreon.serac.fr/centreon/nagmap2/resources/js/app.js?v=2.0.0:211:35`

I have the necessary PHP extension :

  • php-common-5.4.16-48.el7.x86_64, include php-json
  • php-mbstring

I changed all of my host to the new format.

When enabling the debug console, it create one host and then crash with the following error :
10/08/2020 à 10:54:43 - TypeError: Cannot read property 'forEach' of undefined

Let me know if you need more information.

jocafamaka added a commit that referenced this issue Aug 13, 2020
@jocafamaka
Copy link
Owner

jocafamaka commented Aug 13, 2020

Hey,

In fact, this seems to be a problem that was never foreseen and really never happened before.

The problem is that one or more of your hosts does not have a hostgroup in their settings and this leads to an error in the hostgroup listing function, as it is not expected that there are no hostgroups.

To avoid this problem I made some changes to the code.

I ask you to download and test the code available on that branch.

I await your return.

Best regards.

@jocafamaka jocafamaka added the bug Something isn't working label Aug 13, 2020
@wackou72
Copy link
Author

Hello,
I can confirm that it is working now !
Thanks 👍

@jocafamaka
Copy link
Owner

Great!!

Thank you for your feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants