The point is to get server information be sent to telegram group , so u can be up2time with your server physical updates !
1-Firstly you have to create a telegram bot
2-Create a Telegram group and add your bot to it
3-Get the bot id
4-Get your group chat id
5-Replace values in the code (YourBotid and YourChatid)
6-Copy and Paste The Below code to a new script
7-schedule it as u like
Here is the code
Note : Copy it as it is >> Just Replace bot id and chat id <<
Code: Select all
# NOTIFICATION SYSTEM JOB START
# COUNT HOTSPOT USER
{
:local hsac [:len [/ip hotspot active find radius]];
/tool fetch "https://api.telegram.org/YourBotid/sendmessage?chat_id=-YourChatid&text=Current Hotspot Users is $hsac" keep-result=no;
};
# WAIT FOR COUTING
:delay 2;
# COUNT BROADBAND USER
{
:local ppac [:len [/ppp active find service=pppoe]];
/tool fetch "https://api.telegram.org/YourBotid/sendmessage?chat_id=-YourChatid&text=Current Broadband Users is $ppac" keep-result=no;
};
# WAIT FOR COUTING
:delay 2;
# SEND CURRENT SERVER TEMPERATURE
:local systemTemp [:tonum [/system health get temperature]];
/tool fetch "https://api.telegram.org/YourBotid/sendmessage?chat_id=-YourChatid&text=Current Server Temperature is $systemTemp" keep-result=no;
# WAIT FOR SENDING
:delay 2;
# CALCULATE AND SEND CURRENT SERVER VOLTAGE
:global voltage [:tonum [/system health get voltage]];
:local emessage ("Current Server Voltage is " . [:pick $voltage 0 2] . "." . [:pick $voltage 2 3])
/tool fetch "https://api.telegram.org/YourBotid/sendmessage?chat_id=-YourChatid&text=$emessage" keep-result=no;
# NOTIFICATION SYSTEM JOB END / Ahmed Mouselly
# E-Mail mr.ahmd07@gmail.com
# +90-531-855-34-59