AI Trailblazer Award

Insights

PRTG + Twilio Integration: Complete SMS Alert Setup Guide

Last updated: July 9, 20269 mins read
PRTG + Twilio Integration: Complete SMS Alert Setup Guide

It’s 3 AM. A critical server just went down. Your email alert is sitting unread in your inbox because your office internet connection is unavailable. The next morning, your boss isn’t happy, and you’re left feeling the sting of those dreaded words: “Why didn’t you respond to this sooner?”

If this scenario sounds painfully familiar, you’re not alone. Many sysadmins face the frustration of missed alerts, especially during critical infrastructure failures when your primary notification channels are compromised.

The problem? As one frustrated admin put it: “I only receive one alert, and if it doesn’t wake me, I’m SOL.” This single-channel dependency creates a dangerous weak point in your incident response system.

The solution? Implementing a robust, out-of-band SMS alerting system that works even when your primary infrastructure doesn’t.

In this guide, I’ll show you how to integrate PRTG Network Monitor with Twilio to create a reliable SMS alerting system that persists even through network outages, power failures, and other critical events.

Why SMS Alerts Are a Sysadmin’s Best Friend

Email alerts and push notifications are great—until they’re not. Both typically rely on internet connectivity, which becomes their Achilles’ heel during network outages.

SMS alerts shine in scenarios like:

  • Network backbone failures: When your primary connection is down, but cellular networks remain operational
  • ISP outages: When your entire office loses connectivity
  • Power outages: When, as one admin noted, “we only have enough charge to keep our servers, FW, and switches up for 2 hours”

SMS messages travel over cellular networks—a completely separate infrastructure from your primary internet connection. This separation creates the redundancy needed for truly reliable alerting.

Prerequisites: What You’ll Need

Before we begin, make sure you have:

  • An active PRTG Network Monitor installation (the free 100-sensor version works perfectly for this integration)
  • Administrative access to your PRTG server
  • A Twilio account (a trial account is sufficient to start)
  • 15-20 minutes to configure and test the integration

As one PRTG user noted, “PRTG 100-sensor is a free download and worth the time” for this setup. If you’re already using PRTG for monitoring, you’ve got a head start.

Part 1: Setting Up Your Twilio Account for SMS

PRTG doesn’t natively support SMS notifications, but as users have pointed out, “scripts could be created to integrate with Twilio.” Let’s start by getting your Twilio account ready:

  1. Sign up for Twilio
    • Visit Twilio’s website and create an account
    • Verify your email address and phone number
  2. Get a Twilio phone number
    • From your Twilio dashboard, navigate to “Phone Numbers” → “Manage” → “Buy a Number”
    • Ensure the number has SMS capabilities (most do by default)
    • Complete the purchase (trial accounts include credit for testing)
  3. Locate your credentials
    • On your Twilio dashboard, find your Account SID and Auth Token
    • These credentials will authenticate your requests to Twilio’s API
    • Keep them secure—they function as your username and password

Part 2: Integrating Twilio with PRTG

There are two primary methods for integrating PRTG with Twilio. I’ll walk you through both so you can choose the one that best fits your environment.

Method A: The Custom URL Method (Simple & Fast)

This method uses PRTG’s built-in HTTP Request capability to call Twilio’s API directly.

Step 1: Navigate to Notification Delivery in PRTG

  • In the PRTG web interface, go to Setup | System Administration | Notification Delivery
  • Scroll down to the SMS Delivery section

Step 2: Configure SMS Delivery

  • Select the option “Enter a custom URL for delivering SMS”
  • This will reveal a field where you’ll enter your Twilio API URL

Step 3: Construct the Twilio API URL

  • Enter your custom URL in the following format: https://api.twilio.com/2010-04-01/Accounts/YOUR_ACCOUNT_SID/Messages.json?To=%SMSNUMBER&From=YOUR_TWILIO_NUMBER&Body=%SMSTEXT
  • Replace YOUR_ACCOUNT_SID with your actual Twilio Account SID
  • Replace YOUR_TWILIO_NUMBER with your Twilio phone number (in E.164 format, e.g., +15551234567)
  • The %SMSNUMBER and %SMSTEXT are PRTG placeholders that will be replaced with the recipient’s number and alert message

Step 4: Set Authorization

  • For the HTTP method, select POST
  • Under Authentication, select Basic
  • Enter your Twilio Account SID as the username
  • Enter your Twilio Auth Token as the password
  • Click Save to apply your changes

Security Note: This method is simpler but less secure than Method B since it requires storing your Twilio credentials in PRTG. For production environments, the script method below is recommended.

Method B: The “Execute Program” Script Method (Powerful & Customizable)

This method uses a dedicated script for more advanced control and formatting.

Step 1: Prerequisites

  • Ensure .NET Framework 4.5 or higher is installed on your PRTG Core Server
  • Make sure your server can make outbound HTTPS connections to Twilio’s API

Step 2: Download the Script

  • Download the PRTG-TwilioPager package from GitHub
  • This open-source solution was developed specifically for PRTG-Twilio integration

Step 3: Install the Script

  • Unzip the contents into the \Notifications\EXE\ subdirectory of your PRTG installation
  • The default path is typically C:\Program Files (x86)\PRTG Network Monitor\Notifications\EXE\

Step 4: Configure the Script

  • Open the Prtg.Pager.Twilio.exe.config file in a text editor like Notepad
  • Update the following settings in the appSettings section: <appSettings> <add key="accountSid" value="ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" /> <add key="authToken" value="your_auth_token" /> <add key="sourcePhoneNumber" value="+15551234567" /> </appSettings>
  • Replace the placeholder values with your actual Twilio credentials
  • Save the file

Pro Tip: For enhanced security, consider using environment variables or a secure credential store instead of hardcoding credentials in the config file.

Part 3: Creating and Testing Your SMS Notification

Now that the integration is set up, it’s time to create a notification template in PRTG and test it.

Step 1: Create a New Notification Template

  • Navigate to Setup | Account Settings | Notification Templates
  • Click Add new notification template
  • Give it a descriptive name like “Twilio SMS Alert”

Step 2: Configure the Template

For Method A (Custom URL):

  • Under Send SMS/Pager Message, check the box to enable it
  • Enter the recipient’s phone number in E.164 format (e.g., +15551234567)
  • Customize the message text using PRTG’s placeholders: %device %name is %status! (%message)
  • This will produce messages like “Web Server PING is DOWN! (Timeout)”

For Method B (Execute Program):

  • Select Execute Program as the delivery method
  • For the Program File, select Prtg.Pager.Twilio.exe from the dropdown
  • For Parameters, enter: "5551234567 %device %name: %status %down (%message)"
  • The first parameter is the recipient’s phone number (without the + prefix)
  • The rest forms your message text with PRTG’s placeholders

Step 3: Apply the Notification to a Sensor

  • Navigate to the device or sensor you want to monitor
  • Go to its Notifications tab
  • Click Add State Trigger
  • Configure when the notification should trigger (e.g., “When sensor state is Down for at least 60 seconds”)
  • Select your newly created notification template from the dropdown
  • Click Save

Step 4: Test the Notification

  • On the sensor’s Notifications tab, click the Test icon (looks like a running person)
  • This will send a test notification immediately
  • Check your phone to confirm you receive the SMS alert

Best Practices and Troubleshooting

Message Formatting

  • Keep messages concise but informative
  • Include the critical information first (device name, status)
  • Use PRTG’s placeholders to customize messages:
    • %device: The name of the device
    • %name: The sensor name
    • %status: The current status (e.g., Down, Warning)
    • %message: The detailed status message
    • %down: Time since the status changed

Common Issues and Solutions

Problem: SMS not being received

  • Verify your Twilio account has sufficient credit
  • Check that phone numbers are in E.164 format (+1XXXXXXXXXX)
  • Ensure outbound HTTPS connections to Twilio’s API are allowed through your firewall

Problem: Error messages in PRTG logs

  • Check your Twilio credentials for accuracy
  • Verify the script path and parameters are correct
  • Ensure the .NET Framework is properly installed

Problem: SMS messages are delayed

  • This is typically a carrier issue rather than a Twilio or PRTG problem
  • Consider using multiple notification methods for critical alerts

Conclusion

By integrating PRTG with Twilio, you’ve added a crucial layer of resilience to your monitoring system. As one sysadmin put it after setting up a similar system: “I haven’t missed an important alert since.”

This integration solves the pain point many admins face: “I did not wake up to address this. My Boss reamed me out today.” With SMS alerts that work even when your primary infrastructure doesn’t, you’ll be the first to know when critical systems fail.

For those seeking even more advanced notification options, consider using this Twilio integration as a foundation and exploring additional tools like OpsGenie or PagerDuty for features like escalation paths. As one user noted about Zabbix (and which applies equally to an enhanced PRTG setup): “It can harass increasingly large sets of people as time goes on” – a feature that ensures critical issues never fall through the cracks.

Ready to take your alerting to the next level? Implement this guide today, and sleep better knowing you have a truly redundant notification system watching your infrastructure around the clock.

Frequently Asked Questions

Why are SMS alerts essential for system monitoring?

SMS alerts are essential because they provide a reliable, out-of-band notification channel that works even when your primary internet connection fails. While email and push notifications rely on internet connectivity, SMS messages use the cellular network—a completely separate infrastructure. This ensures you receive critical alerts during network outages, power failures, or ISP issues when other channels are down.

Can I set up PRTG and Twilio SMS alerts for free?

Yes, you can set up and test this integration for free. PRTG offers a free version that monitors up to 100 sensors, which is often enough for critical infrastructure. Twilio provides a trial account with free credits, allowing you to send a number of test alerts without any cost. For larger production environments, you would need to consider a paid PRTG license and Twilio’s pay-as-you-go SMS pricing.

What is the difference between the Custom URL and Execute Program methods?

The Custom URL method is simpler and quicker to set up directly within the PRTG interface, making it ideal for testing. The Execute Program (script) method offers greater security and customization, making it the recommended choice for production environments. The script method allows you to manage credentials more securely (e.g., outside of the PRTG web interface) and can be modified for more complex logic or message formatting.

How can I customize the content of my SMS alerts?

You can customize SMS alert content in PRTG by using built-in variables called placeholders. Placeholders like %device, %name, %status, and %message are automatically replaced with real-time sensor data when an alert is triggered. This allows you to create dynamic and informative messages, such as “Web Server PING is Down! (Timeout),” giving you critical context directly in the alert.

What should I do if my SMS alerts are not being delivered?

If your SMS alerts are not being delivered, first check your Twilio account for API errors and ensure you have sufficient credit. Next, verify that all phone numbers are entered in the correct E.164 format (e.g., +15551234567). Finally, check the PRTG logs for errors and confirm that your server’s firewall allows outbound HTTPS connections to api.twilio.com.

Resources:

Related Articles