As a software developer or engineer, there can often be times when you want to be notified that some event took place on the systems you are working with. For example, you want to start a long running database import process and want to be told when it has been completed, or you want to know when an important service is no longer responding to requests on your production system.
Sending such notifications can of course be done via email, but it’s somewhat clunky and error prone and typically requires some setup and configuration. I’ve been using a more modern solution that I’ve been very happy with so far: push notifications sent directly to my phone.
I’ve been using Pushover and it has worked great.
Pushover has a native app for iOS (and Android), so all notifications end up on my phone. Pushover provides an API that can be called using standard HTTP requests to actually send the notifications. So, as long as you have
curl (or something similar) on the system where notifications should be sent from, there is no other configuration needed.
You do need to create a Pushover account and generate a token to pass to the API. Once that is done, you can send a notification like so:
$ curl -s --form-string "token=[your token]" --form-string "user=[your user id]" --form-string "message=Message" https://api.pushover.net/1/messages.json
Pushed notifications end up on your phone (or other device), for example, like this:
You can also set different importance levels to the notifications, if that becomes necessary. I’m using this both for routine development tasks and for monitoring production systems.
curl command and parameters is a little bit tedious, especially if you just want to send a one-off notification. I’m using TextExpander on my Mac, so I’ve mapped “;push” to generate the
curl command for me. You might want to consider something similar.
This means I can, for example, type:
$ mysql database < data.sql; ;push
and have that automatically expanded to:
$ mysql database < data.sql; curl -s --form-string "token=[my token]" --form-string "user=[my user id]" --form-string "message=Message" https://api.pushover.net/1/messages.json
with my Pushover token and user ID already included. I can then just change the notification message, hit enter, and wait for the notification to come in as I do other work.