statusengine / interface

AngularJS based Web Interface for Statusengine
https://statusengine.org/ui/#overview
GNU General Public License v3.0
18 stars 7 forks source link

Class 'Elasticsearch\\ClientBuilder' not found #21

Closed duylong closed 5 years ago

duylong commented 5 years ago

Hi,

I wanted to update the web interface (git pull and composer update) but unfortunately I have a class error not found, is this normal?

{
  "message": "Slim Application Error",
  "error": [
    {
      "type": "Error",
      "code": 0,
      "message": "Class 'Elasticsearch\\ClientBuilder' not found",
      "file": "/monit/src/Loader/Elasticsearch/ServicePerfdataLoader.php",
      "line": 62,
      "trace": [
        "#0 /monit/src/Controller/ServicePerfdata.php(47): Statusengine\\Loader\\Elasticsearch\\ServicePerfdataLoader->getServicePerfdata(Object(Statusengine\\ValueObjects\\ServicePerfdataQueryOptions))",
        "#1 /monit/public/api/index.php(337): Statusengine\\Controller\\ServicePerfdata->index(Object(Statusengine\\ValueObjects\\ServicePerfdataQueryOptions))",
        "#2 [internal function]: Closure->{closure}(Object(Slim\\Http\\Request), Object(Slim\\Http\\Response), Array)",
        "#3 /monit/vendor/slim/slim/Slim/Handlers/Strategies/RequestResponse.php(41): call_user_func(Object(Closure), Object(Slim\\Http\\Request), Object(Slim\\Http\\Response), Array)",
        "#4 /monit/vendor/slim/slim/Slim/Route.php(356): Slim\\Handlers\\Strategies\\RequestResponse->__invoke(Object(Closure), Object(Slim\\Http\\Request), Object(Slim\\Http\\Response), Array)",
        "#5 /monit/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(117): Slim\\Route->__invoke(Object(Slim\\Http\\Request), Object(Slim\\Http\\Response))",
        "#6 /monit/vendor/slim/slim/Slim/Route.php(334): Slim\\Route->callMiddlewareStack(Object(Slim\\Http\\Request), Object(Slim\\Http\\Response))",
        "#7 /monit/vendor/slim/slim/Slim/App.php(515): Slim\\Route->run(Object(Slim\\Http\\Request), Object(Slim\\Http\\Response))",
        "#8 /monit/src/StatusengineAuth.php(108): Slim\\App->__invoke(Object(Slim\\Http\\Request), Object(Slim\\Http\\Response))",
        "#9 [internal function]: Statusengine\\StatusengineAuth->__invoke(Object(Slim\\Http\\Request), Object(Slim\\Http\\Response), Object(Slim\\App))",
        "#10 /monit/vendor/slim/slim/Slim/DeferredCallable.php(43): call_user_func_array(Object(Statusengine\\StatusengineAuth), Array)",
        "#11 [internal function]: Slim\\DeferredCallable->__invoke(Object(Slim\\Http\\Request), Object(Slim\\Http\\Response), Object(Slim\\App))",
        "#12 /monit/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(70): call_user_func(Object(Slim\\DeferredCallable), Object(Slim\\Http\\Request), Object(Slim\\Http\\Response), Object(Slim\\App))",
        "#13 /monit/vendor/slim/csrf/src/Guard.php(171): Slim\\App->Slim\\{closure}(Object(Slim\\Http\\Request), Object(Slim\\Http\\Response))",
        "#14 [internal function]: Slim\\Csrf\\Guard->__invoke(Object(Slim\\Http\\Request), Object(Slim\\Http\\Response), Object(Closure))",
        "#15 /monit/vendor/slim/slim/Slim/DeferredCallable.php(43): call_user_func_array(Object(Slim\\Csrf\\Guard), Array)",
        "#16 [internal function]: Slim\\DeferredCallable->__invoke(Object(Slim\\Http\\Request), Object(Slim\\Http\\Response), Object(Closure))",
        "#17 /monit/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(70): call_user_func(Object(Slim\\DeferredCallable), Object(Slim\\Http\\Request), Object(Slim\\Http\\Response), Object(Closure))",
        "#18 /monit/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(117): Slim\\App->Slim\\{closure}(Object(Slim\\Http\\Request), Object(Slim\\Http\\Response))",
        "#19 /monit/vendor/slim/slim/Slim/App.php(406): Slim\\App->callMiddlewareStack(Object(Slim\\Http\\Request), Object(Slim\\Http\\Response))",
        "#20 /monit/vendor/slim/slim/Slim/App.php(314): Slim\\App->process(Object(Slim\\Http\\Request), Object(Slim\\Http\\Response))",
        "#21 /monit/public/api/index.php(748): Slim\\App->run()",
        "#22 {main}"
      ]
    }
  ]
}
nook24 commented 5 years ago

By default Statusengine UI does not depends on Elasticsearch, because the Elastic-Client required PHP => 5.6.6 or >= 7.x and I don't want to lock out users, that don't plan to use Elasticsearch at all.

If you are on PHP 5.6 and ES 5.x, this should solve the issue:

apt-get install php-curl php-json php-mbstring
cd /opt/statusengine/worker
composer require elasticsearch/elasticsearch:~5.0

Docs: https://statusengine.org/tutorials/Elasticsearch-Perfdata-Backend/

For PHP 7.x and ES 6.x:

apt-get install php-curl php-json php-mbstring
cd /opt/statusengine/worker
composer require elasticsearch/elasticsearch:~6.0

Docs: https://statusengine.org/tutorials/Elasticsearch6-Perfdata-Backend/

Hope this solves your issue

duylong commented 5 years ago

I thought the dependencies were also depending on the configuration. Thanks !