[Elasticsearch] Frontend PHP errors when History Provider is unreachable

XMLWordPrintable

      If Elasticsearch is configured as a history provider but the service is down (unreachable), the Zabbix frontend throws PHP runtime errors instead of displaying a graceful warning or empty data.

      Steps to reproduce:

      • Configure Zabbix frontend to use Elasticsearch for history (/ui/conf/zabbix.conf.php), example:
      $HISTORY['url'] = [
       'uint' => 'http://localhost:9200'
      ];
      // Value types stored in Elasticsearch.
      $HISTORY['types'] = ['uint'];
      • Stop the Elasticsearch service or provide a wrong/unreachable URL.
      • Navigate to
        • Monitoring -> Hosts -> Graphs.
        • Dashboards widgets (e.g., Top Hosts).
        • Latest data.

      Result: PHP runtime errors appear.

      file_get_contents(http://localhost:9200log*/_search): Failed to open stream: operation failed [zabbix.php:17 -> require_once() -> ZBase->run() -> ZBase->processRequest() -> CController->run() -> CControllerLatestView->doAction() -> CControllerLatest->extendData() -> CHistoryManager->getLastValues() -> CHistoryManager->getLastValuesFromElasticsearch() -> CElasticsearchHelper::query() -> CElasticsearchHelper::request() -> file_get_contents() -> CConfigFile->{closure}() in include/classes/helpers/CElasticsearchHelper.php:53]
      file_get_contents(http://localhost:9200log*/_search): Failed to open stream: operation failed [zabbix.php:17 -> require_once() -> ZBase->run() -> ZBase->processRequest() -> CController->run() -> CControllerLatestViewRefresh->doAction() -> CControllerLatest->extendData() -> CHistoryManager->getLastValues() -> CHistoryManager->getLastValuesFromElasticsearch() -> CElasticsearchHelper::query() -> CElasticsearchHelper::request() -> file_get_contents() -> CConfigFile->{closure}() in include/classes/helpers/CElasticsearchHelper.php:53] 

      Expected: The frontend should handle the connection failure gracefully. It should catch the exception and display a user-friendly error message within the widget or a notification at the top of the page, without breaking the PHP runtime.

      Note: Elasticsearch's current error display breaks the host graphs page layout.

       

       

        1. ZBX-27401 - note.png
          135 kB
          Deniss Ponomarenko
        2. ZBX-27401 - actual.png
          23 kB
          Deniss Ponomarenko

            Assignee:
            Zabbix Development Team
            Reporter:
            Deniss Ponomarenko
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - Not Specified
                Not Specified
                Logged:
                Time Spent - 0.5h
                0.5h