Hey there!<p>My team is hosting an API that sends open telemetry data to Signoz & manages on-call via PagerDuty. We've configured Signoz to hit Pagerduty when there's a series of 500 errors.<p>However, our server went down last night and NO opentel data was sent to Signoz. We weren't notified that the server went down as there weren't 500 responses to report. What's the easiest way to have a cron-like query hit our API and integrate with our existing stack? Is this feasible with our existing vendors? Should I have a serverless function running on a timer that uses Pagerduty's API? Should I be migrating to another monitoring service?<p>Any advice would be appreciated!
If you want super minimal, something like this might work?<p><pre><code> #!/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 200
if [ "$STATUS" -ne 200 ]; then
# Send email alert
echo "The URL $URL did not return a 200 status code. Status was $STATUS." | mail -s "URL Check Alert" $EMAIL
# Instead of email, you could send a Slack/Teams/PagerDuty/Pushover/etc, etc alert, with something like:
curl -X POST https://events.pagerduty.com/...
fi
</code></pre>
Edit: updated with suggested changes.
A lot of vendors offer this and call it "synthetic monitoring". They will repeatedly send requests that you configure and record the success rate.<p>They usually all have pager duty integration as well.<p>Some examples:<p>Datadog: <a href="https://docs.datadoghq.com/synthetics/" rel="nofollow">https://docs.datadoghq.com/synthetics/</a>
Grafana cloud: <a href="https://grafana.com/grafana/plugins/grafana-synthetic-monitoring-app/" rel="nofollow">https://grafana.com/grafana/plugins/grafana-synthetic-monito...</a>
<a href="https://heartbeat.sh/" rel="nofollow">https://heartbeat.sh/</a><p>Free and easy. Not affiliated, just a happy user.<p>I combine it with a service like uptimerobot to get messages if the heartbeat stopped.
You're looking for a dead man's switch. <a href="https://deadmanssnitch.com" rel="nofollow">https://deadmanssnitch.com</a> is a good hosted service or Uptime Kuma (<a href="https://github.com/louislam/uptime-kuma">https://github.com/louislam/uptime-kuma</a>) can be configured to do the same thing.
You need to implement a deadman switch. For example if using Prometheus you can configure it to access an HTTP endpoint of a deadman switch service every X seconds. When that service detects you have not accessed it in some time it will alert you.<p>For example: <a href="https://blog.ediri.io/how-to-set-up-a-dead-mans-switch-in-prometheus" rel="nofollow">https://blog.ediri.io/how-to-set-up-a-dead-mans-switch-in-pr...</a>
Update:<p>Thanks for your recommendations everyone! We decided to go the route of measuring successful hits on the endpoint associated with our docs (inside our monitoring service). That's the default health check associated with our load balancer, so it gets hit periodically (built-in cron job). We just added a signoz alert that is triggered if the sum of those successful calls over the past X seconds falls below a threshold.
Maybe can try use opensource project apache hertzbeat to monitoring heartbeat. <a href="https://github.com/apache/hertzbeat">https://github.com/apache/hertzbeat</a>
<a href="https://checklyhq.com" rel="nofollow">https://checklyhq.com</a><p>You cannot only do classic heartbeat checks but also high level API (single request and multi request) and Browser checks to make sure your service is behaving as expected.
I've been using UptimeRobot since 2019 for FastComments, relatively happy. They have a PagerDuty integration, although I just use the built in text/email alerts ATM.
This basic monitoring primitive is the first thing we started with at Cronitor[1]. I was a software engineer at my day job and needed a way to be alerted when something <i>doesn't</i> happen.<p>We have a decent free plan that would probably work for you.<p>[1] <a href="https://news.ycombinator.com/item?id=7917587">https://news.ycombinator.com/item?id=7917587</a>
we use updown.io for this and are happy with it.<p>there's probably functionality built in to your other monitoring tools, or you could write a little serverless function to to it, but for me i really like to have it isolated. i wanted a tool that's not part of the rest of our monitoring stack, not part of our own codebase, and not something we manage.
This is normal website monitoring. There are a billion services that do this. The cloud providers have them. I use Oh Dear.<p>Something that can happen is that your alerting system stops working. I wrote alertmanager-status to bridge Alertmanager to these website uptime checkers: <a href="https://github.com/jrockway/alertmanager-status">https://github.com/jrockway/alertmanager-status</a> Basically, Alertmanager gives it a fake alert every so often. If that arrives, then alertmanager-status reports healthy to your website upness checker. If it doesn't arrive in a given time window, then that reports unhealthy, and you'll get an alert that alerts don't work. I use this for my personal stuff and at work and ... Alertmanager has never broken, so it was a waste of time to write ;)
This is one of those things that _seems_ really simple but the details make it pretty complicated.<p>Not sure about Signoz and PagerDuty, but there are plenty freemium services like UpTimeRobot that work fine for basics.<p>And then something like AWS CloudWatch has a lot more advanced options about how to treat missing data.<p><a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/AlarmThatSendsEmail.html" rel="nofollow">https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitori...</a><p>With a lot of knobs to tune around what intervals you need and what counts as 'down', which you'll want to think about pretty carefully given what you need.
> <i>Should I have a serverless function running on a timer that uses Pagerduty's API?</i><p>If you're on AWS, there's already heartbeat monitoring and that can integrate with CloudWatch to notify PagerDuty.
If this is a cloud deployment, there might be a recommended method native to your cloud if you search for <i><your cloud provider> synthetic monitoring</i> or <i><your cloud provider> canary</i>.<p>For example, AWS recommends using CloudWatch Synthetics to create a canary: <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Synthetics_Canaries.html" rel="nofollow">https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitori...</a>
I had a similar concern about a custom monitoring script that was regularly writing out a metrics file in Prometheus format to be picked up by the Prometheus node monitor. What if the script breaks?<p>So I set the script to also write out a metric that was just the time stamp the metrics were last updated. Then it was simple to set up an alert in Prometheus - I can't access the config now so you'll have to look it up yourself, but it was basically "alert if metric less than now minus a time gap"
Writing a heartbeat process using UDP for a Fluentd logger is as one of the first things I learned in Elixir! In my case, basically when then there was no heartbeat, the TCP forwarder /w a connection pool would be taken offline. When the heartbeat came back, the forwarder was free to send messages again.<p>The heartbeat process itself basically just sent pings every second on a UDP port and waited for a reply. If we didn’t get a reply in one second, it’d assume the connection was bad until a ping came again.
For my applications, monitored by prometheus + grafana, we have alerts when no data is reported for certain metrics in the past 5 minutes, indicating a malfunction in the subsystem.<p>With a metric, you can use a monotonic counter to serve as a heartbeat. A timestamp would work. In your monitoring system, when the heartbeat value has not increased in X minutes, you alert.
<a href="https://www.wormly.com" rel="nofollow">https://www.wormly.com</a><p>I run multiple e-commerce websites where up time is critical and the types of errors could be anything. I use a service called Wormly that hits specific end points from multiple locations around the world. I'm not affiliated, just a happy customer.
We have been using Cloudflare health check at work for this and we have been pretty happy with this. We have this integrated with slack and opsgenie as well.<p><a href="https://developers.cloudflare.com/health-checks/" rel="nofollow">https://developers.cloudflare.com/health-checks/</a>
I use Uptime Robot for this: <a href="https://uptimerobot.com/" rel="nofollow">https://uptimerobot.com/</a><p>I 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.<p>You can also set it up in more complex ways but this is easy.
Back in the day I had a script that would telnet once every so often to a configured time frame and listen on each one. Then another script monitoring the number of each and if the average over 10 mins was less than 90% each node send a message in your manner of choice (email or something)
> <i>What's the easiest way to have a cron-like query hit our API and integrate with our existing stack?</i><p>Write a cron job that greps the logs and pulls on your api with curl?<p>With another 20 minutes of work you can remember the log size on each run and grep only what's new on the next run.
Not familiar with Signoz, but a simple solution should be to check if the total number of requests in the past X duration is <= Y, where X depends on how much traffic you see and Y is some threshold such as 1, 1000, or min(yesterday, last_week).
We do this at Heii On-Call: <a href="https://heiioncall.com/" rel="nofollow">https://heiioncall.com/</a><p>Outbound Probes to hit your exposed HTTP services, or Inbound Liveness for your own cron jobs etc to check in.
OnlineOrNot has a cron job/scheduled task monitoring system that integrates with PagerDuty fwiw<p>edit: on second read, it sounds like regular uptime monitoring for your API would do the trick
I use grafana. Setup an endpoint on the backend that uses things like the database to check if it can still connect. Every 10 sec. If it fails I get a text.
To me, this is the biggest problem with OpenTelemetry.<p>There isn’t a good way to solve this using a PUSH model that isn’t somewhat of a hack or using another external tool
In general the "are-you-alive" messages are redundant, as the data exchange messages serves the same purpose.<p>While my legal encumbrances prohibit helping you with actual code, I would recommend looking at watchdog processes.<p>For example, even a simple systemd periodic trigger that runs a script every minute that does general house keeping can work. i.e. a small script has the advantage of minimal library dependencies, fast/finite run state, and flexible behavior (checking cpu/network loads for nuisance traffic, and playing possum when a set threshold exceeded.)<p>Distributed systems is hard, but polling generally does not scale well (i.e. the cost of a self-check is locally fixed, but balloons on a cluster if going beyond a few fixed peer-checks).<p>And yeah, some clowns that think they are James Bond have been DDoS small boxes on Sun (they seem to be blindly hitting dns and ntp ports hard). We had to reset the tripwire on a 6 year old hobby host too.<p>tip, rate limiting firewall rules that expose whitelisted peers/admins to bandwidth guarantees is wise. Otherwise any cluster/heartbeats can be choked into a degraded state.<p>Don't take it personally, and enjoy a muffin with your tea. =3
I clicked to say something about Instrumentation Amplifiers or interfacing with chest straps ;)<p>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.
Believe you can do this in Signoz: <a href="https://signoz.io/docs/monitor-http-endpoints/">https://signoz.io/docs/monitor-http-endpoints/</a>