Monit SMS notifications with TextBelt for free

TextBelt is a free service whereby you can receive SMS messages for free. It’s as simple as this:

curl -X POST \
-d number=5551234567 \
-d "message=I sent this message for free with"

So wouldn’t this be cool if we could integrate this with Monit? Well I did just that. With a few lines of code you can receive SMS messages when one of your monit programs goes offline.

Let’s get it straight first, I use Monit on all of my servers, and now with the combination of TextBelt I can get notified by SMS too. I already have multiple notifications but one extra doesn’t hurt!

TextBelt: Let’s get started

Create a new file named in your /root directory (or wherever you prefer – i use root because I manage many different type of OS) and paste the following code:

/usr/bin/curl \
-d number=1111111111 \

Change 1111111111  to your cell/mobile phone number. Give it 777 permissions.

chmod 777 /root/

Run it once if you like, you should at that point receive a SMS message to your phone.

Integration with Monit

I believe it’s best to use it when your Monit configuration does a timeout and Monit no longer monitors the process. All you need to do next is attach the following code to any/all processes.

if 5 restarts within 5 cycles then exec "/root/"

 A full Monit example of monitoring a process…

check process NGINX with pidfile /var/run/
group nginx
start program = "/sbin/service nginx restart"
stop program  = "/sbin/service nginx stop"
if failed host port 443 type TCPSSL for 3 cycles then restart
if 5 restarts within 5 cycles then exec "/root/"


And that’s it!