Using NodePing To Send Downtime Notifications To Slack

So I’m a huge fan of the service NodePing. NodePing is a service used to monitor websites and service availability, and can ping hosts, monitor HTTP/HTTPS, other services like POP3/IMAP, DNS, and more! It can also perform “advanced HTTP” monitoring and check the HTTP response code or the content from the response! I pretty much use NodePing to monitor all of my hobbyist projects, as well as those belonging to friends.

One thing that gets tricky, however, is how to do alerting. NodePing lets you do email and text notifications, but neither feels “right” to me, especially if you want to alert multiple people at once. So I came up with a better way: sending webhooks into Slack! In this post, I am going to walk you through the process of making this happen.

Requirements

First, you’ll need to purchase a plan on NodePing. Plans on NodePing start at $8/month, but I personally recommend the $15/month plan as you can monitor up to 200(!) different services with it. You’ll also need to create your own Slack instance, and Slack has a free tier, which I recommend.

After creating a Slack instance, I recommend downloading and configuring both the Desktop and mobile clients to connect to your Slack instance.

Setting Up A Webhook In Slack and NodePing

Now that you’re signed up with both services, you’ll need to create a webhook in Slack. To do that, go to the “Applications” page on Slack’s website and choose the “Incoming Webhooks” app. Add a new integration and copy the URL of the webhook into your clipboard:

Note that whichever Slack channel you send alerts to is completely up to you. My personal recommendation is to create a separate channel just for alerts from NodePing.

Now, log into NodePing, click “Contacts”, then “Add New Contact”, and paste in the URL to create a new contact in NodePing:


Once the alert is added, it can be used by any check which you create in NodePing.

Add A New Check in NodePing

Now, add a new check in NodePing and make sure that the contact notified is the Slack webhook:

At this point, you should check the target Slack channel for a message from Slack regarding the integration and a message from NodePing that the alert has been added:

Setting Notification Preferences

Before triggering any test alerts, be sure that you set up all messages in that channel to send a notification, both on the desktop and mobile clients:

Testing The Alert

Now try taking down the target webserver to trigger the alert. You did set the check to check a test webserver, right? 🙂 In my example, test.dmuth.org points to the same IP address as my main server, but I used the HTTPS-portal Docker container to point that hostname to another underlying webserver with the default Nginx page on it. That way, I can turn off that server without affecting my production webserver.

All that said, try turning off the server for a couple of minutes and then turning it back on. You should see a couple of messages in the Slack channel:

You should also get two alerts on your mobile client:

And there you have it–how to use NodePing with Slack to send monitoring alerts straight to your phone.

Keep in mind that you don’t just need to monitor your websites, you can monitor websites of friends, enemies, competitors, etc. to see what their uptime and reliability is like. You can even monitor API endpoints if you want to see how a particular web service fares over time. The possibilities are endless here.

Happy Monitoring!