Icinga / icingaweb2-module-elasticsearch

This module will not be updated by Icinga anymore. Please don't attempt to use it.
GNU General Public License v2.0
29 stars 9 forks source link

Parsing error: InstanceController.php & EventtypesController.php #24

Closed Npeto closed 6 years ago

Npeto commented 6 years ago

Hello everyone,

I'm trying to connect our icingaweb2 instance with Elasticsearch. I'm encountering problems when loading module configuration pages on icingaweb2

Expected Behavior

Being able to load the ES Instance configuration and/or Event Types configuration page(s)

Current Behavior

Error message when loading pages

  1. Instance configuration Parse error: syntax error, unexpected '[' in /usr/share/icingaweb2/modules/elasticsearch/application/controllers/InstancesController.php on line 23

      $  vi +23 InstancesController.php 
        $this->getTabs()->add(uniqid(), [
            'label'     => $this->translate('Event Types'),
            'url'       => Url::fromPath('elasticsearch/eventtypes')
        ]);
  2. Event Types configuration Parse error: syntax error, unexpected '[' in /usr/share/icingaweb2/modules/elasticsearch/application/controllers/EventtypesController.php on line 22

        $ vi +22 EventtypesController.php
        $this->getTabs()->add(uniqid(), [
            'label'     => $this->translate('Instances'),
            'url'       => Url::fromPath('elasticsearch/instances')
        ]);

Steps to Reproduce (for bugs)

  1. Copy module files from master branch into /usr/share/icingaweb2/modules/elastisearch
  2. Enable module
  3. Go into Icingaweb2 web interface
  4. Try to configure ES Instances and/or Event Types
  5. Get parse error

Context

What are you trying to accomplish?

Basic configuration

Your Environment

Hope those informations will be sufficients,

Kind regards,

Niels

dnsmichi commented 6 years ago

Can you share the generated config.ini and instances.ini configuration files from /etc/icingaweb2/modules/elasticsearch?

Also, please test again with Icinga Web 2 v2.5.1

Npeto commented 6 years ago

@dnsmichi I don't have the elasticsearch directory into /etc/icingaweb2/modules

For Icinga Web 2 v2.5.1, can't test it quickly since I have no hands on the local repository

dnsmichi commented 6 years ago

Nevermind, I am bit tired today. Clearly this is a PHP exception, and I also know why - your PHP version is EOL, you need at least PHP 5.6 for this module.

Thomas-Gelf commented 6 years ago

Hint: the problem is the [] array notation, this has been introduced with PHP 5.4.