Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Windows collector DNS lookup error for "localhost" #714

Open
Arcturuss opened this issue Nov 13, 2024 · 7 comments
Open

[BUG] Windows collector DNS lookup error for "localhost" #714

Arcturuss opened this issue Nov 13, 2024 · 7 comments
Labels
bug Something isn't working

Comments

@Arcturuss
Copy link

Describe the bug
Running collector on Windows machine where DNS server config points to 8.8.8.8 results in DNS lookup error for "localhost".
127.0.0.1 works fine, as expected.

Expected behavior
"localhost" address should work regardless of DNS settings

Log Files

c:\hwtools>scrutiny-collector-metrics-windows-amd64.exe run --api-endpoint http://localhost:9310
2024/11/13 23:02:03 No configuration file found at c:\opt\scrutiny\config\collector.yaml. Using Defaults.

 ___   ___  ____  __  __  ____  ____  _  _  _  _
/ __) / __)(  _ \(  )(  )(_  _)(_  _)( \( )( \/ )
\__ \( (__  )   / )(__)(   )(   _)(_  )  (  \  /
(___/ \___)(_)\_)(______) (__) (____)(_)\_) (__)
AnalogJ/scrutiny/metrics                      windows.amd64-0.8.1

time="2024-11-13T23:02:03+04:00" level=info msg="Verifying required tools" type=metrics
time="2024-11-13T23:02:03+04:00" level=info msg="Executing command: smartctl --scan --json" type=metrics
time="2024-11-13T23:02:03+04:00" level=info msg="Executing command: smartctl --info --json /dev/sda" type=metrics
time="2024-11-13T23:02:03+04:00" level=info msg="Using WWN Fallback" type=metrics
time="2024-11-13T23:02:03+04:00" level=info msg="Executing command: smartctl --info --json /dev/sdb" type=metrics
time="2024-11-13T23:02:03+04:00" level=info msg="Using WWN Fallback" type=metrics
time="2024-11-13T23:02:03+04:00" level=info msg="Executing command: smartctl --info --json --device nvme /dev/sdc" type=metrics
time="2024-11-13T23:02:03+04:00" level=info msg="Using WWN Fallback" type=metrics
time="2024-11-13T23:02:03+04:00" level=info msg="Sending detected devices to API, for filtering & validation" type=metrics
2024/11/13 23:02:03 ERROR: Post "http://localhost:9310/api/devices/register": dial tcp: lookup localhost on 8.8.8.8:53: no such host

@Arcturuss Arcturuss added the bug Something isn't working label Nov 13, 2024
@AnalogJ
Copy link
Owner

AnalogJ commented Jan 4, 2025

my understanding is that localhost is never queried against a DNS service, it always points to the current host.
Do you have an unusual host file?

@Arcturuss
Copy link
Author

This was my understanding too, but here we are.

Just reproduced this on new windows installation, with empty (default) hosts file. The only thing you need to reproduce is to set your DNS server to 8.8.8.8

@AnalogJ
Copy link
Owner

AnalogJ commented Jan 8, 2025

woah, weird. You're not using docker at all right? this is all native?

@AnalogJ
Copy link
Owner

AnalogJ commented Jan 8, 2025

@Arcturuss
Copy link
Author

No docker for client, it's native on Windows. Server is in docker within WSL2, but that's irrelevant, I suppose.

I tried adding localhost to hosts file, doesn't work. In fact, hosts file seems to be completely ignored.

Here I tried to use domain from the hosts file. ping can resolve it just fine, but scrutiny-collector is using DNS server for some reason:

изображение

@Arcturuss
Copy link
Author

My guess this is because of DNS requests handling in Go, when DNS server is prioritised over the hosts file:

golang/go#33019
golang/go#35305

Maybe this behavior could be configured somehow.

@AnalogJ
Copy link
Owner

AnalogJ commented Jan 8, 2025

jfc 🤦

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants