View difference between Paste ID: jnRBkwCx and v6RCJqBh
SHOW: | | - or go back to the newest paste.
1
######## MIKROTIK - DIAY GRAPHING CAPTURE REPORT - TELEGRAM #########
2
#                                                                   #
3-
# build 0.2.20231105 public review                                  #
3+
# build 0.3.20230616 public review                                  #
4
# BY: PHUKAO PONGSUWAN                                              #
5
#                                                                   #
6-
# LINE Script: https://pastebin.com/Jk9kjH2A                        #
6+
# * * * * FOR ROS v7.10++ please use  * * * * *                     #
7-
# TELEGRAM Script: https://pastebin.com/v6RCJqBh                    #
7+
8
# TELEGRAM Script: https://pastebin.com/jnRBkwCx                    #
9-
# * * * * IF USE ROS > v7.10 please use  * * * * *                  #
9+
10
# Capture with https://github.com/elestio/ws-screenshot             #
11
#                                                                   #
12
# fix 20231105 - add uniq value in url to avoid caching             #
13
# fix 20230616 - update uniq for ROS 7.10++ to more Uniq with date  #
14
#                                                                   #
15
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
16
 
17
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
18
#                                                                   #
19
#   !!! NEED THIS SCRIPT "func_LINEdateTime" as INCLUDE FIELS !!!!  #
20
#                                                                   #
21
#   https://pastebin.com/tznx0BSu                                   #
22
#                                                                   #
23
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
24
25
#
26
# Multiple interface use => 
27
#
28
# :local interfaces         { "<interface-name-1>"; "<interface-name-2>"; "<interface-name-n>" }
29
#
30
31
:local interfaces         { "<interface-name>" }
32
:local telegramtoken      "<TELEGRAM_TOKEN>"
33
:local telegramchannel    "<TELEGRAM CHANNEL>"
34
:local domainWS           "<DOMAIN_OR_IP_WS-CAPTURE-SERVICE>"
35
:local domianGRAPH        "<IP_PORT_TO_GRAPH>"
36
:local msg                "<MESSAGE TEXT>"
37
38
:local datetime [[:parse [/system/script/get func_LINEdateTime source]]]
39
40
:local msg "$msg$datetime"
41
42
/tool/fetch url="https://api.telegram.org/bot$telegramtoken/sendmessage?chat_id=$telegramchannel&text=$msg" http-method=get output=none
43
44
:foreach inf in=$interfaces do={
45
     :local uniq ([/system clock get date]."-".[:rndnum from=100000 to=999999])
46
     :local url "https://$domainWS/api/screenshot%3Funiq=$uniq%26resX=1024%26resY=500%26outFormat=png%26waitTime=50%26isFullPage=true%26url=http://$domianGRAPH/graphs/iface/$inf/"
47-
     :local uniq [:rndnum from=100000 to=999999]
47+
48
     /tool/fetch url="https://api.telegram.org/bot$telegramtoken/sendPhoto?chat_id=$telegramchannel&photo=$url" http-method=get output=none
49
50
     :log info ("Telegram: $msg - $inf")
51
}