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

Alerting #5

Open
brawer opened this issue Apr 14, 2022 · 3 comments
Open

Alerting #5

brawer opened this issue Apr 14, 2022 · 3 comments

Comments

@brawer
Copy link

brawer commented Apr 14, 2022

Can heartbeat.sh send out email alerts when no heartbeat has been received for a while? The current documentation doesn’t mention alerts.

@bartoruiz
Copy link

bartoruiz commented Apr 17, 2022

This is what I did. I ran a cron every 1min in my linux server and get emails alerts:

#!/bin/sh
emailto="yourmail@gmail.com"
subject="HEARTBEAT"

json=$(
  curl -X GET 'https://yourdomain.heartbeat.sh/heartbeats' \
  --compressed \
  -s
)

errors=`echo -n $json | grep -o '"Status":"ERROR"' | wc -l | awk '{print $1}'`;
echo ERRORS: $errors

if [ $errors != 0 ]; then
        msgsubj="$subject ERRORS: $errors"
        echo $json | mail -s "${msgsubj}" ${emailto}
fi

@rudolfbyker
Copy link

@arieroos if you implement alerts, I think alerting only on the "falling edge" of the signal (i.e. transition from green to orange/red) is much more useful than alerting repeatedly alerting like the above example. In my experience, if I can't address an issue immediately, the flood of e-mails makes me counter-productive.

A client-side-only way of doing this would be to make the web interface into a PWA, which makes it installable, and provides a service worker. Then the service worker kan show notifications. https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerRegistration/showNotification Depending on the device, the notifications might not work when the app is put to sleep (e.g. most Androids) but it still has some use, and does not require you to push anything from a server, keeping the implementation simple.

@arieroos
Copy link
Contributor

There is currently no alerting, but it is definitely something to consider.

Before we build alerting, we will need to build a way to authorize heartbeats, and only authorized heartbeats will generate alerts. Otherwise we will be opening doors to spam.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants