Ask HN: How to do simple heartbeat monitoring?
41–50 of 86 posts
Re: Ask HN: How to do simple heartbeat monitoring?
#42Depending on your expected traffic patterns and volume, no responses to report for an extended period of time is its own data point.
No 2XX-499 results means the server is borked.
If you wanted to be really fancy you could send heartbeat requests when no live traffic had hit that node for n milliseconds.
I still think the latter is the right answer. Why inflate traffic when you are horizontally scaling? That’s a lot of health checks per second.
Re: Ask HN: How to do simple heartbeat monitoring?
#43I can highly recommend Better Stack. We have never been let down by their service.
Re: Ask HN: How to do simple heartbeat monitoring?
#44If you want super minimal, something like this might work? #!/bin/bash # Add this script to cron to run at whatever duration you desire. # URL to be checked URL="https://example.com/test.php" # Email for alerts EMAIL="root@example.com" # Perform the HTTP request and extract the status code with 10 second timeout. STATUS=$(curl -o /dev/null -s -w "%{http_code}\n" --max-time 10 $URL) # Check if the status code is not 2…
As a slight variation, you could send an alert to the PagerDuty API by replacing “Send email alert” with something like: # Send PagerDuty alert curl -X POST https://events.pagerduty.com/...
In fact, this is what I'd recommend (though I use Pushover), because then you don't have to be concerned with email setup, not getting caught in spam filters, firewalls, etc. You could also send a Slack/Teams alert with a similar POST.
For some reason, I thought I had read that OP wanted to send an email.
Re: Ask HN: How to do simple heartbeat monitoring?
#45For example, AWS recommends using CloudWatch Synthetics to create a canary: https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitori...
Re: Ask HN: How to do simple heartbeat monitoring?
#46I just configure it to access some endpoint on the API server. It checks it every minute and if it fails (non 200) it pings me.
You can also set it up in more complex ways but this is easy.
Re: Ask HN: How to do simple heartbeat monitoring?
#47Re: Ask HN: How to do simple heartbeat monitoring?
#48I clicked to say something about Instrumentation Amplifiers or interfacing with chest straps ;) You might want to use a different service for monitoring your stack just to make sure you have some redundancy there. Seems like you got an answer for how to do this with Signoz but if that is down then you won't know.
Re: Ask HN: How to do simple heartbeat monitoring?
#49If you want super minimal, something like this might work? #!/bin/bash # Add this script to cron to run at whatever duration you desire. # URL to be checked URL="https://example.com/test.php" # Email for alerts EMAIL="root@example.com" # Perform the HTTP request and extract the status code with 10 second timeout. STATUS=$(curl -o /dev/null -s -w "%{http_code}\n" --max-time 10 $URL) # Check if the status code is not 2…
You should include a timeout in the curl to detect if it hangs, or if it gets slower than it should be.
Re: Ask HN: How to do simple heartbeat monitoring?
#50healthchecks.io