Creating Telegram Bot
Search: BotFather.
Click “Start” to activate the BotFather bot.
Choose the command /newbot and Click.
Choose a name for your bot. Example: fujitestavalanche.
Choose a username for your bot. Example: fujitestavalanche_bot.
You will receive a message with a link to your bot t.me/nameyourbot.
After giving your bot username, your TOKEN will be available as noted below:
Note: Copy the alphanumeric code of your TOKEN , as we will use it later!
Note that TOKEN is the code right after “HTTP API:”.
Start communicating with our bot by entering the name of your bot in the search tab and choose it. Example: fujitestavalanche.
Click on the “Start” button and you will be subscribed to your bot.
Type “/ start
”.
Obtain the CHAT ID (chat ID of the bot):
Two parameters: TOKEN and CHAT ID — are mandatory for creating the script for the real-time alert system of your Avalanche Network node.
We must remember that we already have a TOKEN.
First install the “jq” utility, set your TOKEN variable and, using the curl command.
:bulb: Copy & Paste — each line of code and “Enter”, successively, line by line, until the last command line, in the SSH Web session of your VPS.
If CHAT_ID is not available, it's okay to type “
/ start
” three to four times, in the same way, re-enter the command linecurl -s https://api.telegram.org/bot$TOKEN/getUpdates | jq .result [0] .message.chat.id
until the CHAT_ID code appears.
The Avalanchego monitoring script, which includes the real-time alert system of your Avalanche network node, performs three fundamental checks every minute, as shown below:
Our Avalanchego monitoring script has two mandatory and two optional parameters, which are:
Avalanchego Monitoring Script Installation:
:bulb: Copy & Paste — each line of code and “Enter”, successively, line by line, until the last command line, in the SSH Web session of your VPS.
Test to verify that your script is working correctly:
In this script we are using the default parameters for a
40% CPU limit
and API call IP is127.0.0.1
.
:point_right: If the script has been installed correctly, the test message will be sent to your Telegram bot as noted below:
:point_right: If you no longer want to receive alerts via your Telegram bot, just remove a line from the script in your crontab
file. Edit it via crontab -e
and remove or comment (put # at the beginning of the line) the related line as shown below: