Skip to content

Commit 8cf38a7

Browse files
committed
18997 FIX "Host name or alias (regex)" filter
The `Host name or alias (regex)` filter was using the incorrect Livestatus column name `alias` instead of `host_alias` when matching against the host alias. This caused errors on dashboards that used this filter. The column name has been corrected so the filter now works as expected. SUP-25992 Change-Id: I7f0c2c26792a20a52ab77b698a97f2c69e32549f
1 parent 388dc9a commit 8cf38a7

3 files changed

Lines changed: 19 additions & 3 deletions

File tree

.werks/18997.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[//]: # (werk v2)
2+
# Fix "Host name or alias (regex)" filter
3+
4+
key | value
5+
---------- | ---
6+
date | 2026-04-14T10:48:28+00:00
7+
version | 2.3.0p47
8+
class | fix
9+
edition | cre
10+
component | multisite
11+
level | 1
12+
compatible | yes
13+
14+
The `Host name or alias (regex)` filter was using the incorrect Livestatus column name `alias` instead of `host_alias` when matching against the host alias. This caused errors on dashboards that used this filter. The column name has been corrected so the filter now works as expected.

cmk/gui/query_filters.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,9 @@ def __init__(self) -> None:
544544
def _filter(self, value: FilterHTTPVariables) -> FilterHeader:
545545
host = livestatus.lqencode(value[self.request_vars[0]])
546546

547-
return lq_logic("Filter:", [f"host_name {self.op} {host}", f"alias {self.op} {host}"], "Or")
547+
return lq_logic(
548+
"Filter:", [f"host_name {self.op} {host}", f"host_alias {self.op} {host}"], "Or"
549+
)
548550

549551

550552
class OptEventEffectiveContactgroupQuery(TextQuery):

tests/unit/cmk/gui/plugins/visuals/test_filters.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ class FilterTest(NamedTuple):
434434
request_vars=[
435435
("hostnameoralias", "abc"),
436436
],
437-
expected_filters=("Filter: host_name ~~ abc\n" "Filter: alias ~~ abc\n" "Or: 2\n"),
437+
expected_filters=("Filter: host_name ~~ abc\n" "Filter: host_alias ~~ abc\n" "Or: 2\n"),
438438
),
439439
FilterTest(
440440
ident="hosts_having_service_problems",
@@ -587,7 +587,7 @@ class FilterTest(NamedTuple):
587587
FilterTest(
588588
ident="hostnameoralias",
589589
request_vars=[("hostnameoralias", "horst")],
590-
expected_filters="Filter: host_name ~~ horst\nFilter: alias ~~ horst\nOr: 2\n",
590+
expected_filters="Filter: host_name ~~ horst\nFilter: host_alias ~~ horst\nOr: 2\n",
591591
),
592592
# Testing FilterCommaSeparatedStringList
593593
FilterTest(

0 commit comments

Comments
 (0)