Skip to content

Install Solar_Discord_Monitor

 


How to Monitor Your SOLAR Node via DISCORD

1. Clone the repository into your SOLAR NODE

git clone https://github.com/mtaylan/SOLAR_NODE_Monitor_Discord.git

2. Edit CUSTOM VARIABLES in Solar_mon_discord.sh

cd SOLAR_NODE_Monitor_Discord/
nano Solar_mon_discord.conf
# Custom variables
#

#SOLAR NODE SETTINGS
SOLAR_NODE_IP=XXX.XXX.XXX.XXX (Your NODE Public IP)
HOSTNAME="MY SOLAR-NODE" (Your Node Name)
#DISCORD Settings
discord=/your/path/to/discord.sh (Path to discord.sh script - look at Step.3 )

#ALARM SETTINGS
SEND_ALERT_FLAG=true
SEND_ALERT_FLAG_SW=true
SEND_ALERT_FLAG_CPU=true
SEND_ALERT_FLAG_HDD=true
SEND_ALERT_FLAG_BLOCKS=true

#ALARM TRESHOLD VALUES ( You can modify these values according to your needs. )
CPU_LOAD_CRITICAL=40.00
LATENCY_CRITICAL=500
ALIVE=`date +%M`
HDD_USE_CRITICAL=95
MAX_BLOCKS_BEHIND=5

#TMP FILES
FILE=/tmp/check_SOLAR_NODE_discord
FILE_CPU=/tmp/check_SOLAR_NODE_CPU_discord
FILE_SW=/tmp/check_SOLAR_NODE_SW_discord
FILE_HDD=/tmp/check_SOLAR_HDD_discord
FILE_BLOCKS=/tmp/check_SOLAR_BLOCKS_discord

# End of Custom variables

SAVE and EXIT (CTRL-O / Enter / CTRL-X)
chmod +x Solar_mon_discord.sh

3. Solar_mon_discord.sh script uses discord.sh script from https://github.com/ChaoticWeg/discord.sh repository.

cd SOLAR_NODE_Monitor_Discord/
wget https://raw.githubusercontent.com/ChaoticWeg/discord.sh/master/discord.sh
chmod +x discord.sh

4. Login to Discord.com (or Register for a new user)
Create Your Own Server
Open your Server Settings and head into the Integrations tab:
Click the “Create Webhook” button to create a new webhook!

You’ll have a few options here. You can:
•  Edit the avatar: By clicking the avatar next to the Name in the top left
• Choose what channel the Webhook posts to: By selecting the desired text channel in the  dropdown menu.

You now have your own handy URL / pneumatic tube schoomp-er that you can link to more websites to receive messages from.

Get the webhook URL for the server/channel you want to receive messages:

In my server, I’ve created a text channel labeled #node-alerts and I want my Solar_mon_discord.sh to post messages here!
Therefore, I’ll grab the webhook URL for this channel by pressing the Copy Webhook URL button:

(For more information: https://support.discord.com/hc/en-us/articles/228383668-Intro-to-Webhooks )

5. Go back to your NODE

cd SOLAR_NODE_Monitor_Discord/
nano .webhook

PASTE the Webhook URL copied from Step.4

Save and Exit from file (CTRL-O / Enter / CTRL-X)
Note1: discord.sh and .webhook files should be in the same directory
Note2: .webhook file has point (.) in front of its name.

6. Test your webhook

./discord.sh --text "Test Message"

You should receive “Test Message” at your discord server.

7. Install the required sar and jq commands for Solar_mon_discord.sh.

sudo apt install sysstat
sudo apt-get install jq -y

8. For testing Solar_mon_discord.sh integration with discord.sh use the following command

./Solar_mon_discord.sh test

You should receive a test message at your Discord Server.

9. Enter the following lines into your crontab file for monitoring your node every 5 minutes ( use * * * * * for checking every minute. For more visit https://crontab.guru/ )

crontab -e
*/5 * * * * /path/to/home/SOLAR_NODE_Monitor/solar-mon-discord.sh > /path/to/home/SOLAR_NODE_Monitor/solar-mon-discord.log 2>&1

Let me know if you have problems or need help for installation. I am available on Discord and Telegram.