Icinga/icingaweb2

Web UI crashes for certain html plugin output

Opened this issue · 5 comments

Describe the bug

Some html plugin output causes the Web UI (see attached screenshot) to "crash"

To Reproduce

Provide a link to a live example, or an unambiguous set of steps to reproduce this issue. Include configuration, logs, etc. to reproduce, if relevant.

1.Create a plugin (example below) that outputs a html table as check result
2.UI "crashes" with an "Uncaught Requires a element" error in icinga.min.js:564

import sys

############
### MAIN ###
############
def main():

  result_string = """
<body>
<p>Test output table</p>
<table border='1' style="width:100%">
  <tr>
    <th style="text-align:right;font-size:15px;width:60px">MON</th>
    <th>TUE</th>
    <th>WED</th>
    <th>THU</th>
    <th>FRI</th>
    <th>SAT</th>
    <th>SUN</th>
  </tr>
  <tr>
    <td style="text-align:right;font-size:15px;width:60px;background-color:#33E3FF">0</td>
    <td style="text-align:right;font-size:15px;width:60px;background-color:#33E3FF">1</td>
    <td style="text-align:right;font-size:15px;width:60px;background-color:#33E3FF">2</td>
    <td style="text-align:right;font-size:15px;width:60px;background-color:#33E3FF">3</td>
    <td style="text-align:right;font-size:15px;width:60px;background-color:#33E3FF">4</td>
    <td style="text-align:right;font-size:15px;width:60px;background-color:#33E3FF">5</td>
    <td style="text-align:right;font-size:15px;width:60px;background-color:#33E3FF">6</td>
  </tr>
  <tr>
    <td style="text-align:right;font-size:15px;width:60px;background-color:#33E3FF">0</td>
    <td style="text-align:right;font-size:15px;width:60px;background-color:#33E3FF">1</td>
    <td style="text-align:right;font-size:15px;width:60px;background-color:#33E3FF">2</td>
    <td style="text-align:right;font-size:15px;width:60px;background-color:#33E3FF">3</td>
    <td style="text-align:right;font-size:15px;width:60px;background-color:#33E3FF">4</td>
    <td style="text-align:right;font-size:15px;width:60px;background-color:#33E3FF">5</td>
    <td style="text-align:right;font-size:15px;width:60px;background-color:#33E3FF">6</td>
  </tr>
</table>
</body>
  """

  print(f"<html>{result_string}</html>")
  sys.exit(0)

if __name__ == '__main__':
  main()

Expected behavior

The output should be rendered correctly or an error should be shown.

Screenshots

See attachements

Your Environment

system-about

Include as many relevant details about the environment you experienced the problem in

  • Module version: icinga/icinga-php-thirdparty=>0.12.1, icinga/icinga-php-library=>0.13.2
  • Dependent module versions: icingadb=>1.1.2, setup=>2.12.1
  • Icinga Web 2 version and modules 2.12.1:
  • Web browser and version: Edge 123.0.2420.81 and Firefox 124.0.2 (both 64 bit)
  • Icinga 2 version used: r2.14.2-1
  • PHP version used: 8.1.2-1ubuntu2.15
  • Server operating system and version: 6.5.0-1018-azure #19~22.04.2-Ubuntu SMP Thu Mar 21 16:45:46 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

Additional context

Please note that if the plugin outputs only the 1st row (delete row 30-38), everything works fine (see second screenshot)

--- CRASH ---

screenshot-crash

--- OK ---

screenshot-ok

The error can be reproduced also with PHP 8.3

image

We can reproduce it using the Al2Klimov/check_systemd_needrestart plugin.

This problem also hides other outstanding problems on the UI if it it the first element.

  • Problems sorted by severity DESCENDING:
    https://<baseurl>/icingaweb2/icingadb/services?service.state.is_problem=y&sort=service.state.severity desc
    grafik
  • Problems sorted by severity ASCENDING:
    https://<baseurl>/icingaweb2/icingadb/services?service.state.is_problem=y&sort=service.state.severity asc
    grafik

Descending is also the default when clicking on Problems > Service Problems in the sidebar. That was very irritating for us the last days until we found out the culprit.

It's also not (directly*) possible to acknowledge such service/host problems, as the action buttons just don't load/display.

  • 🚫 Not working:
    grafik

  • ✅ OK:
    grafik

*: You can build the URL yourself, e.g. https://<baseurl>/icingaweb2/icingadb/service/acknowledge?name=systemd_needrestart&host.name=<hostname>

@koelle25 : the answer provided by moreamazingnick in this post explains in detail the root cause of the problem.

We have decided to patch the limits until a fix is available (the limits were introduced in icingdab version 1.1.2, if you use version 1.1.1 the problem does not appear)

Having the issue too, we missed a lot of information of checks because of it and have been searching like nuts for a solution :)

Think this should probably be fixed asap !