Create a system alert bot

It’s important to know when something is going wrong (or close to going wrong) on your system. For developers, monitoring things like memory usage is an important part of responsible software management.

To make monitoring your system easier, you can create a system alert bot right in Typetalk, and we’re happy to show you how. Follow along with these simple steps, and you can get automatic system alerts right in Typetalk!

How to create a system alert bot for Typetalk

  1. Create a Typetalk bot in the topic you want to receive alert messages
    This bot will post messages, so check “” for the API Scope.

  2. Write your code telling the bot to check your system, and post the results to Typetalk.

    Here’s an example of some code we created:


    while read LINE
     TOTAL=`echo $LINE | perl -lne 'print $1 if /^Mem:\s*?([0-9]+)\s*?([0-9]+)/'`
     USED=`echo $LINE | perl -lne 'print $2 if /^Mem:\s*?([0-9]+)\s*?([0-9]+)/'`
     DIV=`echo "scale=3; $USED / $TOTAL * 100" | bc`
     if [ $INT -gt 80 ]; then
       curl -d "message=Memory usage is $DIV percent now!" '$TOPIC_ID?typetalkToken=$TYPETALK_TOKEN'
    done < <(free -tm | grep "Mem:")
  1. Exec the script regularly! You can use scheduling tools like Cron

    That’s it! If you followed our example, you will now receive system alerts for high memory usage in your designated Typetalk topic.

    And you can create different types of alerts by following these same steps.

0 people think that it is helpful. Was this helpful for you?

Have a question we didn't answer?

Contact support