Commit ae0ecdcb authored by Vitaly Lipatov's avatar Vitaly Lipatov

router: derive health monitor tag from gateway PTR for all groups

Replace monitor file requirement with group_monitor_tag() that derives InfluxDB tag from gateway's PTR record via find_gw_monitor. Co-Authored-By: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
parent 99f76df1
......@@ -84,6 +84,18 @@ gw_monitor_tag()
echo "$tag"
}
# Get monitor tag for a group directory
# Usage: group_monitor_tag GWDIR ROUTES_DIR
group_monitor_tag()
{
local gwdir="$1" routes_dir="$2"
local ipcmd=$(ipcmd_for "$routes_dir")
[ -f "$gwdir/gateway" ] || return
parse_gw_line "$(read_value "$gwdir/gateway")" "$ipcmd"
[ -n "$gw_ip" ] || return
find_gw_monitor "$routes_dir" "$gw_ip" "$ipcmd"
}
# Find monitor tag for a gateway IP: first check group monitor files,
# then derive from PTR record
# Usage: find_gw_monitor ROUTES_DIR GW_IP IPCMD
......@@ -145,8 +157,7 @@ for routes_dir in "$ROUTES_DIR" "$ROUTES6_DIR" ; do
[ -d "$gwdir" ] || continue
name=$(basename "$gwdir")
[ -f "$gwdir/monitor" ] || continue
tag=$(read_value "$gwdir/monitor")
tag=$(group_monitor_tag "$gwdir" "$routes_dir")
[ -n "$tag" ] || continue
status=$(get_health "$tag")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment