Hacker News new | ask | show | jobs
by loganmarchione 650 days ago
Asking because I genuinely don't know, but why not use Python's `urllib.request` instead of `ping`?
1 comments

TL;DR: apples and oranges. Plus, monitoring is hard.

"urllib.request" sends an HTTP request. It implies that the thing you want to monitor is an HTTP endpoint. Even if that's true, you still have to decide whether you're okay with just getting a 200 status code back, or whether you want to scrape the page for a certain result as your signal of healthy or broken.

"ping" is an ICMP echo/reply. Ignoring that ICMP messages can be blocked by routers, an ICMP reply can tell you that the host's network interface is alive and that's about all. It doesn't mean any service on that host is online. I have seen hosts that send ICMP replies but were otherwise fully hung by some storage or kernel issue.