Bug with nagstamon after upgrade to 2.2.0

Hey
I use CheckMk Enterprise 2.1.0p29 with Nagstamon 3.12.0 software without any problem.

Nagstamon needs access to URL http://192.168.15.90/prod/check_mk/view.py?view_name=nagstamon_svc&output_format=python&lang=&limit=hard&is_host_acknowledged=-1&is_service_acknowledged=-1&is_host_notifications_enabled=-1&is_service_notifications_enabled=-1 &is_host_active_checks_enabled=-1&is_service_active_checks_enabled= -1&host_scheduled_downtime_depth=-1&is_in_downtime=-1&hst0=On&hst1=On

This URL works on 2.1.0p29 and outputs the following result:
[
[‘host’, ‘service_description’, ‘service_icons’, ‘service_state’, ‘svc_check_age’, ‘svc_state_age’, ‘svc_attempt’, ‘svc_plugin_output’, ‘svc_flapping’, ‘svc_notifications_enabled’, ‘svc_is_active’, ‘svc_in_downtime’, ’ svc_acknowledged’, ‘sitename_plain’, ‘host_address’, ‘svc_check_command’],

]

Since the update to 2.2.0p3, the url responds:
ERROR: Internal error: sequence item 0: expected str instance, dict found

An internal error occurred while processing your request. You can report this issue to the Checkmk team to help fixing this issue. Please open the crash report page and use the form for reporting the problem.

In /opt/omd/sites/prod/var/log/web.log

2023-06-18 21:41:35,829 [40] [cmk.web 65262] Unhandled exception (Crash-ID: 22a06628-0e10-11ee-9653-005056861cbc)
Traceback (most recent call last):
   File "/omd/sites/prod/lib/python3/cmk/gui/wsgi/applications/checkmk.py", line 192, in _process_request
     resp = page_handler()
            ^^^^^^^^^^^^^^
   File "/omd/sites/prod/lib/python3/cmk/gui/wsgi/applications/utils.py", line 107, in _call_auth
     func()
   File "/omd/sites/prod/lib/python3/cmk/gui/pages.py", line 187, in wrapper
     return hc().handle_page()
            ^^^^^^^^^^^^^^^^^^
   File "/omd/sites/prod/lib/python3/cmk/gui/pages.py", line 51, in handle_page
     self.page()
   File "/omd/sites/prod/lib/python3/cmk/gui/pages.py", line 146, in <lambda>
     "page": lambda self: self._wrapped_callable[0](),
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
   File "/omd/sites/prod/lib/python3/cmk/gui/views/page_show_view.py", line 91, in page_show_view
     process_view(GUIViewRenderer(view, show_buttons=True))
   File "/omd/sites/prod/lib/python3/cmk/gui/views/page_show_view.py", line 165, in process_view
     _process_regular_view(view_renderer)
   File "/omd/sites/prod/lib/python3/cmk/gui/views/page_show_view.py", line 178, in _process_regular_view
     _export_view(view_renderer.view, rows)
   File "/omd/sites/prod/lib/python3/cmk/gui/views/page_show_view.py", line 404, in _export_view
     export. handler(view, rows)
   File "/omd/sites/prod/lib/python3/cmk/gui/exporter.py", line 56, in _export_python
     content = cell.render_for_python_export(join_row(row, cell))
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   File "/omd/sites/prod/lib/python3/cmk/gui/views/painter/v0/base.py", line 587, in render_for_python_export
     content = self.painter().export_for_python(row, self)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   File "/omd/sites/prod/lib/python3/cmk/gui/views/painter/v0/base.py", line 231, in export_for_python
     return self._compute_data(row, cell)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   File "/omd/sites/prod/lib/python3/cmk/gui/views/painter/v0/base.py", line 206, in _compute_data
     return self.render(row, cell)[1]
            ^^^^^^^^^^^^^^^^^^^^^^
   File "/omd/sites/prod/lib/python3/cmk/gui/views/icon/painter.py", line 74, in render
     return _paint_icons("service", row)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   File "/omd/sites/prod/lib/python3/cmk/gui/views/icon/painter.py", line 119, in _paint_icons
     return "icons", " ".join(i.icon_name for i in toplevel_icons if isinstance(i, IconEntry))
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^
TypeError: sequence item 0: expected str instance, dict found

I find a workaround by deleting all downtime hosts, but I don’t understand the link…

I created a new site and the problem does not arise.
I really don’t understand where the problem can from?

Hi,

same here. Did the same Upgrade Path (2.1p29 to 2.2p3) and the downtimes (old ones from before the upgrade and even new ones with the new version) leading to a crash of nagstamon.
Did you get any further findings?

Hello
No
I have send bug to feedback@chechmk …

Hello,
same here too, upgrade path from 2.1p25 over 2.1p29 to 2.2.0p4, same behaviour.

when i shortened the URL
check_mk/view.py?view_name=nagstamon_svc&output_format=python&lang=&limit=hard&is_host_acknowledged=-1&is_service_acknowledged=-1&is_host_notifications_enabled=-1&is_service_notifications_enabled=-1&is_host_active_checks_enabled=-1&is_service_active_checks_enabled=-1&host_scheduled_downtime_depth=-1&is_in_downtime=-1&hst0=On&hst1=On CGI Data: None

to

/check_mk/view.py?view_name=nagstamon_svc&output_format=python&lang=&limit=hard&is_host_acknowledged=-1&is_service_acknowledged=-1&is_host_notifications_enabled=-1&is_service_notifications_enabled=-1&is_host_active_checks_enabled=-1&is_service_active_checks_enabled=-1&host_scheduled_downtime_depth=-1&is_in_downtime=-1&hst0=On&hst1=On

so i removed the

CGI Data: None

at the end and entered it into browser i got outputs similar to
[
[‘host’, ‘service_description’, ‘service_icons’, ‘service_state’, ‘svc_check_age’, ‘svc_state_age’, ‘svc_attempt’, ‘svc_plugin_output’, ‘svc_flapping’, ‘svc_notifications_enabled’, ‘svc_is_active’, ‘svc_in_downtime’, ’ svc_acknowledged’, ‘sitename_plain’, ‘host_address’, ‘svc_check_command’],
]
Is there anything more we can do?

It would seem that if we remove “&hst1=On”
I manage to have a beginning of result.

/prod/check_mk/view.py?view_name=nagstamon_svc&output_format=python&lang=&limit=hard&is_host_acknowledged=-1&is_service_acknowledged=-1&is_host_notifications_enabled=-1&is_service_notifications_enabled=-1%20&is_host_active_checks_enabled=-1&is_service_active_checks_enabled=%20-1&host_scheduled_downtime_depth=-1&is_in_downtime=-1&hst0=On

Quick workaround that Nagstamon works again.

“Builtin icon visibility”
image
Result

And Nagstamon is working again.

Problem is the combined Icon for the downtime. It is really two SVG combined to one.

It seems to work for me.
I will push the tests further.
THANKS !

Hi there,
I get the same error as described above, but even if hst0 and hst1 are not part of the request. Do you have any hint how I could debug this further?

The problem is the combined icon for a downtime. I think there is nothing you can do on the side of Nagstamon, this is only a bug inside CMK. This bug happens only if the output format Python or JSON is selected for a view.
One question - is the icon column used by Nagstamon? If not the easiest solution would be to remove this column from the two views used by Nagstamon.

nagstamon_hosts
nagstamon_svc

I hope this can be forwarded by @mschlenker to the right persons :slight_smile:

@andreas-doehler You are challenging me!

If @HenriWahl says that this columns are not used by Nagstamon it should be an easy problem to solve.

A fix for the export problem is on the way. It should be available with the next patch release.

The icon column format will change, so that it can represent the new icon format (incl. the emblem). The CSV export won’t include the icons anymore. It felt like this is acceptable ;-).

Additionally, in case Nagstamon does not need the icon columns, we could also remove it from the views to reduce complexity.

2 Likes

The change has been published: Fix Nagstamon API in case a host downtime is set for exported services

Thanks LaMi for fix and thanks to HenriWahl for the help :wink:

@andreas-doehler - No, the icons are not needed for Nagstamon.
@LaMi thanks, this was fast! :+1: