fix(api): protocol-aware monitor filtering for multi-protocol monitors
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
Servers with monitor filtering returned incorrect results when monitors
have same names but different protocols (v4/v6). Monitor lookup now
considers both name and IP version to match the correct protocol.
- Add GetMonitorByNameAndIPVersion SQL query with protocol matching
- Update history parameter parsing to use server IP version context
- Fix both /scores/{ip}/log and Grafana endpoints
- Remove unused GetMonitorByName query
Fixes abh/ntppool#264
Reported-by: Anssi Johansson <https://github.com/avijc>
This commit is contained in:
@@ -47,10 +47,13 @@ select * from servers
|
||||
where
|
||||
ip = sqlc.arg(ip);
|
||||
|
||||
-- name: GetMonitorByName :one
|
||||
-- name: GetMonitorByNameAndIPVersion :one
|
||||
select * from monitors
|
||||
where
|
||||
tls_name like sqlc.arg('tls_name')
|
||||
tls_name like sqlc.arg('tls_name') AND
|
||||
ip_version = sqlc.arg('ip_version') AND
|
||||
is_current = 1 AND
|
||||
status != 'deleted'
|
||||
order by id
|
||||
limit 1;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user